mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-19 10:07:24 +00:00
@@ -14,6 +14,7 @@ weight: 792
|
|||||||
|
|
||||||
## ⚙️ 优化
|
## ⚙️ 优化
|
||||||
|
|
||||||
|
1. Chat log list 优化,避免大数据时超出内存限制。
|
||||||
|
|
||||||
## 🐛 修复
|
## 🐛 修复
|
||||||
|
|
||||||
|
@@ -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')
|
||||||
}
|
}
|
||||||
|
@@ -74,108 +74,37 @@ async function handler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ $count: 'messageCount' }
|
{
|
||||||
|
$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] } }
|
||||||
|
}
|
||||||
|
}
|
||||||
],
|
],
|
||||||
as: 'messageCountData'
|
as: 'chatItemsData'
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$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: {
|
|
||||||
$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'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
$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: ['$customFeedbacksData.count', 0] }, 0]
|
$ifNull: [{ $arrayElemAt: ['$chatItemsData.customFeedback', 0] }, 0]
|
||||||
},
|
},
|
||||||
markCount: { $ifNull: [{ $arrayElemAt: ['$markData.count', 0] }, 0] },
|
markCount: { $ifNull: [{ $arrayElemAt: ['$chatItemsData.adminMark', 0] }, 0] }
|
||||||
messageCount: { $ifNull: [{ $arrayElemAt: ['$messageCountData.messageCount', 0] }, 0] }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -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']>([]);
|
||||||
|
Reference in New Issue
Block a user