mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-21 11:43:56 +00:00
@@ -14,6 +14,7 @@ weight: 792
|
||||
|
||||
## ⚙️ 优化
|
||||
|
||||
1. Chat log list 优化,避免大数据时超出内存限制。
|
||||
|
||||
## 🐛 修复
|
||||
|
||||
|
@@ -134,9 +134,7 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {
|
||||
onSuccess(id: string) {
|
||||
router.push(`/app/detail?appId=${id}`);
|
||||
loadMyApps();
|
||||
onClose();
|
||||
removeUtmParams();
|
||||
removeUtmWorkflow();
|
||||
handleCloseJsonImportModal();
|
||||
},
|
||||
successToast: t('common:common.Create Success')
|
||||
}
|
||||
|
@@ -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] }
|
||||
]
|
||||
}
|
||||
$group: {
|
||||
_id: null,
|
||||
messageCount: { $sum: 1 },
|
||||
goodFeedback: { $sum: { $cond: [{ $eq: ['$userGoodFeedback', true] }, 1, 0] } },
|
||||
badFeedback: { $sum: { $cond: [{ $eq: ['$userBadFeedback', true] }, 1, 0] } },
|
||||
customFeedback: {
|
||||
$sum: {
|
||||
$cond: [{ $gt: [{ $size: { $ifNull: ['$customFeedbacks', []] } }, 0] }, 1, 0]
|
||||
}
|
||||
},
|
||||
adminMark: { $sum: { $cond: [{ $eq: ['$adminFeedback', true] }, 1, 0] } }
|
||||
}
|
||||
},
|
||||
{ $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: {
|
||||
$expr: {
|
||||
$and: [
|
||||
{ $eq: ['$appId', '$$appId'] },
|
||||
{ $eq: ['$chatId', '$$chatId'] },
|
||||
{ $gt: [{ $size: { $ifNull: ['$customFeedbacks', []] } }, 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: 'markData'
|
||||
as: 'chatItemsData'
|
||||
}
|
||||
},
|
||||
{
|
||||
$addFields: {
|
||||
messageCount: { $ifNull: [{ $arrayElemAt: ['$chatItemsData.messageCount', 0] }, 0] },
|
||||
userGoodFeedbackCount: {
|
||||
$ifNull: [{ $arrayElemAt: ['$userGoodFeedbackData.count', 0] }, 0]
|
||||
$ifNull: [{ $arrayElemAt: ['$chatItemsData.goodFeedback', 0] }, 0]
|
||||
},
|
||||
userBadFeedbackCount: {
|
||||
$ifNull: [{ $arrayElemAt: ['$userBadFeedbackData.count', 0] }, 0]
|
||||
$ifNull: [{ $arrayElemAt: ['$chatItemsData.badFeedback', 0] }, 0]
|
||||
},
|
||||
customFeedbacksCount: {
|
||||
$ifNull: [{ $arrayElemAt: ['$customFeedbacksData.count', 0] }, 0]
|
||||
$ifNull: [{ $arrayElemAt: ['$chatItemsData.customFeedback', 0] }, 0]
|
||||
},
|
||||
markCount: { $ifNull: [{ $arrayElemAt: ['$markData.count', 0] }, 0] },
|
||||
messageCount: { $ifNull: [{ $arrayElemAt: ['$messageCountData.messageCount', 0] }, 0] }
|
||||
markCount: { $ifNull: [{ $arrayElemAt: ['$chatItemsData.adminMark', 0] }, 0] }
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@@ -43,6 +43,7 @@ export const useInitApp = () => {
|
||||
const router = useRouter();
|
||||
const { hiId, bd_vid, k, sourceDomain, utm_source, utm_medium, utm_content, utm_workflow } =
|
||||
router.query as MarketingQueryParams;
|
||||
|
||||
const { loadGitStar, setInitd, feConfigs } = useSystemStore();
|
||||
const { userInfo } = useUserStore();
|
||||
const [scripts, setScripts] = useState<FastGPTFeConfigsType['scripts']>([]);
|
||||
|
Reference in New Issue
Block a user