Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
d2a32c36
authored
Apr 28, 2025
by
Archer
Committed by
GitHub
Apr 28, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: chat log list (#4704)
* perf: chat log list * remove log
parent
e0b85ca4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
92 deletions
+21
-92
docSite/content/zh-cn/docs/development/upgrading/498.md
+1
-0
projects/app/src/pageComponents/dashboard/apps/JsonImportModal.tsx
+1
-3
projects/app/src/pages/api/core/app/getChatLogs.ts
+18
-89
projects/app/src/web/context/useInitApp.ts
+1
-0
No files found.
docSite/content/zh-cn/docs/development/upgrading/498.md
View file @
d2a32c36
...
@@ -14,6 +14,7 @@ weight: 792
...
@@ -14,6 +14,7 @@ weight: 792
## ⚙️ 优化
## ⚙️ 优化
1.
Chat log list 优化,避免大数据时超出内存限制。
## 🐛 修复
## 🐛 修复
...
...
projects/app/src/pageComponents/dashboard/apps/JsonImportModal.tsx
View file @
d2a32c36
...
@@ -134,9 +134,7 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {
...
@@ -134,9 +134,7 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {
onSuccess
(
id
:
string
)
{
onSuccess
(
id
:
string
)
{
router
.
push
(
`/app/detail?appId=
${
id
}
`
);
router
.
push
(
`/app/detail?appId=
${
id
}
`
);
loadMyApps
();
loadMyApps
();
onClose
();
handleCloseJsonImportModal
();
removeUtmParams
();
removeUtmWorkflow
();
},
},
successToast
:
t
(
'common:common.Create Success'
)
successToast
:
t
(
'common:common.Create Success'
)
}
}
...
...
projects/app/src/pages/api/core/app/getChatLogs.ts
View file @
d2a32c36
...
@@ -74,108 +74,37 @@ async function handler(
...
@@ -74,108 +74,37 @@ async function handler(
}
}
}
}
},
},
{
$count
:
'messageCount'
}
],
as
:
'messageCountData'
}
},
{
$lookup
:
{
from
:
ChatItemCollectionName
,
let
:
{
chatId
:
'$chatId'
,
appId
:
new
Types
.
ObjectId
(
appId
)
},
pipeline
:
[
{
$match
:
{
$expr
:
{
$and
:
[
{
$eq
:
[
'$appId'
,
'$$appId'
]
},
{
$eq
:
[
'$chatId'
,
'$$chatId'
]
},
{
$eq
:
[
'$userGoodFeedback'
,
true
]
}
]
}
}
},
{
$count
:
'count'
}
],
as
:
'userGoodFeedbackData'
}
},
{
$lookup
:
{
from
:
ChatItemCollectionName
,
let
:
{
chatId
:
'$chatId'
,
appId
:
new
Types
.
ObjectId
(
appId
)
},
pipeline
:
[
{
$match
:
{
$expr
:
{
$and
:
[
{
$eq
:
[
'$appId'
,
'$$appId'
]
},
{
$eq
:
[
'$chatId'
,
'$$chatId'
]
},
{
$eq
:
[
'$userBadFeedback'
,
true
]
}
]
}
}
},
{
$count
:
'count'
}
],
as
:
'userBadFeedbackData'
}
},
{
$lookup
:
{
from
:
ChatItemCollectionName
,
let
:
{
chatId
:
'$chatId'
,
appId
:
new
Types
.
ObjectId
(
appId
)
},
pipeline
:
[
{
{
$match
:
{
$group
:
{
$expr
:
{
_id
:
null
,
$and
:
[
messageCount
:
{
$sum
:
1
},
{
$eq
:
[
'$appId'
,
'$$appId'
]
},
goodFeedback
:
{
$sum
:
{
$cond
:
[{
$eq
:
[
'$userGoodFeedback'
,
true
]
},
1
,
0
]
}
},
{
$eq
:
[
'$chatId'
,
'$$chatId'
]
},
badFeedback
:
{
$sum
:
{
$cond
:
[{
$eq
:
[
'$userBadFeedback'
,
true
]
},
1
,
0
]
}
},
{
$gt
:
[{
$size
:
{
$ifNull
:
[
'$customFeedbacks'
,
[]]
}
},
0
]
}
customFeedback
:
{
]
$sum
:
{
}
$cond
:
[{
$gt
:
[{
$size
:
{
$ifNull
:
[
'$customFeedbacks'
,
[]]
}
},
0
]
},
1
,
0
]
}
},
adminMark
:
{
$sum
:
{
$cond
:
[{
$eq
:
[
'$adminFeedback'
,
true
]
},
1
,
0
]
}
}
}
}
},
}
{
$count
:
'count'
}
],
as
:
'customFeedbacksData'
}
},
{
$lookup
:
{
from
:
ChatItemCollectionName
,
let
:
{
chatId
:
'$chatId'
,
appId
:
new
Types
.
ObjectId
(
appId
)
},
pipeline
:
[
{
$match
:
{
$expr
:
{
$and
:
[
{
$eq
:
[
'$appId'
,
'$$appId'
]
},
{
$eq
:
[
'$chatId'
,
'$$chatId'
]
},
{
$eq
:
[
'$adminFeedback'
,
true
]
}
]
}
}
},
{
$count
:
'count'
}
],
],
as
:
'
mark
Data'
as
:
'
chatItems
Data'
}
}
},
},
{
{
$addFields
:
{
$addFields
:
{
messageCount
:
{
$ifNull
:
[{
$arrayElemAt
:
[
'$chatItemsData.messageCount'
,
0
]
},
0
]
},
userGoodFeedbackCount
:
{
userGoodFeedbackCount
:
{
$ifNull
:
[{
$arrayElemAt
:
[
'$
userGoodFeedbackData.count
'
,
0
]
},
0
]
$ifNull
:
[{
$arrayElemAt
:
[
'$
chatItemsData.goodFeedback
'
,
0
]
},
0
]
},
},
userBadFeedbackCount
:
{
userBadFeedbackCount
:
{
$ifNull
:
[{
$arrayElemAt
:
[
'$
userBadFeedbackData.count
'
,
0
]
},
0
]
$ifNull
:
[{
$arrayElemAt
:
[
'$
chatItemsData.badFeedback
'
,
0
]
},
0
]
},
},
customFeedbacksCount
:
{
customFeedbacksCount
:
{
$ifNull
:
[{
$arrayElemAt
:
[
'$c
ustomFeedbacksData.count
'
,
0
]
},
0
]
$ifNull
:
[{
$arrayElemAt
:
[
'$c
hatItemsData.customFeedback
'
,
0
]
},
0
]
},
},
markCount
:
{
$ifNull
:
[{
$arrayElemAt
:
[
'$markData.count'
,
0
]
},
0
]
},
markCount
:
{
$ifNull
:
[{
$arrayElemAt
:
[
'$chatItemsData.adminMark'
,
0
]
},
0
]
}
messageCount
:
{
$ifNull
:
[{
$arrayElemAt
:
[
'$messageCountData.messageCount'
,
0
]
},
0
]
}
}
}
},
},
{
{
...
...
projects/app/src/web/context/useInitApp.ts
View file @
d2a32c36
...
@@ -43,6 +43,7 @@ export const useInitApp = () => {
...
@@ -43,6 +43,7 @@ export const useInitApp = () => {
const
router
=
useRouter
();
const
router
=
useRouter
();
const
{
hiId
,
bd_vid
,
k
,
sourceDomain
,
utm_source
,
utm_medium
,
utm_content
,
utm_workflow
}
=
const
{
hiId
,
bd_vid
,
k
,
sourceDomain
,
utm_source
,
utm_medium
,
utm_content
,
utm_workflow
}
=
router
.
query
as
MarketingQueryParams
;
router
.
query
as
MarketingQueryParams
;
const
{
loadGitStar
,
setInitd
,
feConfigs
}
=
useSystemStore
();
const
{
loadGitStar
,
setInitd
,
feConfigs
}
=
useSystemStore
();
const
{
userInfo
}
=
useUserStore
();
const
{
userInfo
}
=
useUserStore
();
const
[
scripts
,
setScripts
]
=
useState
<
FastGPTFeConfigsType
[
'scripts'
]
>
([]);
const
[
scripts
,
setScripts
]
=
useState
<
FastGPTFeConfigsType
[
'scripts'
]
>
([]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment