mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-25 20:02:47 +00:00
perf: init shell (#6097)
Some checks are pending
Build FastGPT images in Personal warehouse / get-vars (push) Waiting to run
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:amd64 runs-on:ubuntu-24.04]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / release-fastgpt-images (push) Blocked by required conditions
Some checks are pending
Build FastGPT images in Personal warehouse / get-vars (push) Waiting to run
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:amd64 runs-on:ubuntu-24.04]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / release-fastgpt-images (push) Blocked by required conditions
* perf: init shell * init shell * init shell * fix: custom domain check * support * perf: init shell
This commit is contained in:
parent
106417b109
commit
7bfd02a490
|
|
@ -210,7 +210,7 @@
|
|||
"comfirm_leave_page": "Confirm to Leave This Page?",
|
||||
"comfirn_create": "Confirm Creation",
|
||||
"commercial_function_tip": "Please Upgrade to the Commercial Version to Use This Feature: https://doc.fastgpt.cn/docs/introduction/commercial/",
|
||||
"community_support": "Community free support",
|
||||
"community_support": "community support",
|
||||
"comon.Continue_Adding": "Continue Adding",
|
||||
"compliance.chat": "The content is generated by third-party AI and cannot be guaranteed to be true and accurate. It is for reference only.",
|
||||
"compliance.dataset": "Please ensure that your content strictly complies with relevant laws and regulations and avoid containing any illegal or infringing content. \nPlease be careful when uploading materials that may contain sensitive information.",
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@
|
|||
"comfirm_leave_page": "确认离开该页面?",
|
||||
"comfirn_create": "确认创建",
|
||||
"commercial_function_tip": "请升级商业版后使用该功能:https://doc.fastgpt.cn/docs/introduction/commercial/",
|
||||
"community_support": "社区免费支持",
|
||||
"community_support": "社区支持",
|
||||
"comon.Continue_Adding": "继续添加",
|
||||
"compliance.chat": "内容由第三方 AI 生成,无法确保真实准确,仅供参考",
|
||||
"compliance.dataset": "请确保您的内容严格遵守相关法律法规,避免包含任何违法或侵权的内容。请谨慎上传可能涉及敏感信息的资料。",
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@
|
|||
"comfirm_leave_page": "確認離開此頁面?",
|
||||
"comfirn_create": "確認建立",
|
||||
"commercial_function_tip": "請升級為商業版後使用此功能:https://doc.fastgpt.cn/docs/introduction/commercial/",
|
||||
"community_support": "社群免費支持",
|
||||
"community_support": "社區支持",
|
||||
"comon.Continue_Adding": "繼續新增",
|
||||
"compliance.chat": "內容由第三方 AI 產生,無法保證其真實性與準確性,僅供參考。",
|
||||
"compliance.dataset": "請確保您的內容嚴格遵守相關法律法規,避免包含任何違法或侵權的內容。\n在上傳可能涉及敏感資訊的資料時請務必謹慎。",
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ const StandardPlanContentList = ({
|
|||
})
|
||||
: t('common:community_support')}
|
||||
</Box>
|
||||
{subPlans?.communitySupportTip && (
|
||||
{subPlans?.communitySupportTip && !planContent.ticketResponseTime && (
|
||||
<MyPopover
|
||||
trigger="hover"
|
||||
placement="bottom"
|
||||
|
|
|
|||
|
|
@ -75,11 +75,11 @@ const CustomDomain = () => {
|
|||
|
||||
// 检查用户是否有 advanced 套餐
|
||||
const isAdvancedPlan = useMemo(() => {
|
||||
const currentLevel = teamPlanStatus?.standard?.currentSubLevel;
|
||||
if (!currentLevel) return false;
|
||||
const plan = teamPlanStatus?.standard;
|
||||
if (!plan) return false;
|
||||
|
||||
return currentLevel === StandardSubLevelEnum.advanced;
|
||||
}, [teamPlanStatus?.standard?.currentSubLevel]);
|
||||
return plan.customDomain && plan.customDomain > 0;
|
||||
}, [teamPlanStatus?.standard]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -31,23 +31,19 @@ async function createTemporaryIndexes(): Promise<void> {
|
|||
addLog.info('Creating temporary indexes for migration...');
|
||||
|
||||
try {
|
||||
// Create index on ChatItem for finding chats with good feedback
|
||||
await MongoChatItem.collection.createIndex(
|
||||
{ userGoodFeedback: 1, teamId: 1, appId: 1, chatId: 1 },
|
||||
{
|
||||
name: 'temp_feedback_migration_good',
|
||||
partialFilterExpression: { userGoodFeedback: { $exists: true } }
|
||||
} as any
|
||||
);
|
||||
|
||||
// Create index on ChatItem for finding chats with bad feedback
|
||||
await MongoChatItem.collection.createIndex(
|
||||
{ userBadFeedback: 1, teamId: 1, appId: 1, chatId: 1 },
|
||||
{
|
||||
await Promise.all([
|
||||
MongoChatItem.collection.createIndex(
|
||||
{ userGoodFeedback: 1, teamId: 1, appId: 1, chatId: 1 },
|
||||
{
|
||||
name: 'temp_feedback_migration_good',
|
||||
partialFilterExpression: { userGoodFeedback: { $exists: true } }
|
||||
} as any
|
||||
),
|
||||
MongoChatItem.collection.createIndex({ userBadFeedback: 1, teamId: 1, appId: 1, chatId: 1 }, {
|
||||
name: 'temp_feedback_migration_bad',
|
||||
partialFilterExpression: { userBadFeedback: { $exists: true } }
|
||||
} as any
|
||||
);
|
||||
} as any)
|
||||
]);
|
||||
|
||||
addLog.info('Temporary indexes created successfully');
|
||||
} catch (error: any) {
|
||||
|
|
@ -58,39 +54,90 @@ async function createTemporaryIndexes(): Promise<void> {
|
|||
|
||||
/**
|
||||
* Get all unique chats that have feedback
|
||||
* Optimized: Separate queries for good/bad feedback to utilize indexes better
|
||||
*/
|
||||
async function getChatsWithFeedback(): Promise<ChatIdentifier[]> {
|
||||
addLog.info('Aggregating chats with feedback from chatItems...');
|
||||
|
||||
const result = await MongoChatItem.aggregate<ChatIdentifier>([
|
||||
{
|
||||
$match: {
|
||||
$or: [
|
||||
{ userGoodFeedback: { $exists: true, $ne: null } },
|
||||
{ userBadFeedback: { $exists: true, $ne: null } }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
$group: {
|
||||
_id: {
|
||||
teamId: '$teamId',
|
||||
appId: '$appId',
|
||||
chatId: '$chatId'
|
||||
// Separate queries for good and bad feedback to utilize partial indexes better
|
||||
const goodFeedbackChatsPromise = MongoChatItem.aggregate<ChatIdentifier>(
|
||||
[
|
||||
{
|
||||
$match: {
|
||||
userGoodFeedback: { $exists: true }
|
||||
}
|
||||
},
|
||||
{
|
||||
$group: {
|
||||
_id: {
|
||||
teamId: '$teamId',
|
||||
appId: '$appId',
|
||||
chatId: '$chatId'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
$project: {
|
||||
_id: 0,
|
||||
teamId: { $toString: '$_id.teamId' },
|
||||
appId: { $toString: '$_id.appId' },
|
||||
chatId: '$_id.chatId'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
$project: {
|
||||
_id: 0,
|
||||
teamId: { $toString: '$_id.teamId' },
|
||||
appId: { $toString: '$_id.appId' },
|
||||
chatId: '$_id.chatId'
|
||||
],
|
||||
{ allowDiskUse: true, maxTimeMS: 6000000 }
|
||||
);
|
||||
|
||||
const badFeedbackChatsPromise = MongoChatItem.aggregate<ChatIdentifier>(
|
||||
[
|
||||
{
|
||||
$match: {
|
||||
userBadFeedback: { $exists: true }
|
||||
}
|
||||
},
|
||||
{
|
||||
$group: {
|
||||
_id: {
|
||||
teamId: '$teamId',
|
||||
appId: '$appId',
|
||||
chatId: '$chatId'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
$project: {
|
||||
_id: 0,
|
||||
teamId: { $toString: '$_id.teamId' },
|
||||
appId: { $toString: '$_id.appId' },
|
||||
chatId: '$_id.chatId'
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
{ allowDiskUse: true, maxTimeMS: 6000000 }
|
||||
);
|
||||
|
||||
// Execute both queries in parallel
|
||||
const [goodChats, badChats] = await Promise.all([
|
||||
goodFeedbackChatsPromise,
|
||||
badFeedbackChatsPromise
|
||||
]);
|
||||
|
||||
addLog.info(`Found ${result.length.toLocaleString()} unique chats with feedback`);
|
||||
addLog.info(`Found ${goodChats.length.toLocaleString()} chats with good feedback`);
|
||||
addLog.info(`Found ${badChats.length.toLocaleString()} chats with bad feedback`);
|
||||
|
||||
// Deduplicate in application layer using Map
|
||||
const chatMap = new Map<string, ChatIdentifier>();
|
||||
|
||||
for (const chat of [...goodChats, ...badChats]) {
|
||||
const key = `${chat.teamId}_${chat.appId}_${chat.chatId}`;
|
||||
if (!chatMap.has(key)) {
|
||||
chatMap.set(key, chat);
|
||||
}
|
||||
}
|
||||
|
||||
const result = Array.from(chatMap.values());
|
||||
addLog.info(`Found ${result.length.toLocaleString()} unique chats with feedback (after dedup)`);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +153,6 @@ export async function migrateFeedbackFlags() {
|
|||
addLog.info('========================================');
|
||||
|
||||
// Step 1: Create temporary indexes
|
||||
addLog.info('Creating temporary indexes for migration...');
|
||||
await createTemporaryIndexes();
|
||||
|
||||
// Step 2: Get all chats with feedback
|
||||
|
|
|
|||
Loading…
Reference in New Issue