refresh plugins (#6099)

* doc

* refresh plugins

* perf: loading in install

* background index
This commit is contained in:
Archer 2025-12-16 13:02:00 +08:00 committed by GitHub
parent 7bfd02a490
commit 0e3676579d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 26 additions and 20 deletions

View File

@ -20,7 +20,8 @@ curl --location --request POST 'https://{{host}}/api/admin/initv4144' \
--header 'Content-Type: application/json'
```
将 4.14.3 中,遗留的 Dataset/local 接口上传的文件,也迁移到 S3 中。
1. 将 4.14.3 中,遗留的 Dataset/local 接口上传的文件,也迁移到 S3 中。
2. 全量计算旧的 chat 中的反馈,增加 flags 值便于筛选。该函数执行较慢所以放到异步执行接口不会返回结果请关注日志中是否打印Migration feedback completed!
## 🚀 新增内容

View File

@ -97,10 +97,10 @@
"document/content/docs/protocol/index.mdx": "2025-07-30T15:38:30+08:00",
"document/content/docs/protocol/open-source.en.mdx": "2025-08-05T23:20:39+08:00",
"document/content/docs/protocol/open-source.mdx": "2025-08-05T23:20:39+08:00",
"document/content/docs/protocol/privacy.en.mdx": "2025-12-12T21:30:11+08:00",
"document/content/docs/protocol/privacy.mdx": "2025-12-12T21:30:11+08:00",
"document/content/docs/protocol/terms.en.mdx": "2025-12-12T21:30:11+08:00",
"document/content/docs/protocol/terms.mdx": "2025-12-12T21:30:11+08:00",
"document/content/docs/protocol/privacy.en.mdx": "2025-12-15T23:36:54+08:00",
"document/content/docs/protocol/privacy.mdx": "2025-12-15T23:36:54+08:00",
"document/content/docs/protocol/terms.en.mdx": "2025-12-15T23:36:54+08:00",
"document/content/docs/protocol/terms.mdx": "2025-12-15T23:36:54+08:00",
"document/content/docs/toc.en.mdx": "2025-08-04T13:42:36+08:00",
"document/content/docs/toc.mdx": "2025-12-09T23:33:32+08:00",
"document/content/docs/upgrading/4-10/4100.mdx": "2025-08-02T19:38:37+08:00",
@ -114,12 +114,12 @@
"document/content/docs/upgrading/4-12/4124.mdx": "2025-09-17T22:29:56+08:00",
"document/content/docs/upgrading/4-13/4130.mdx": "2025-11-04T15:06:39+08:00",
"document/content/docs/upgrading/4-13/4131.mdx": "2025-09-30T15:47:06+08:00",
"document/content/docs/upgrading/4-13/4132.mdx": "2025-10-21T11:46:53+08:00",
"document/content/docs/upgrading/4-13/4132.mdx": "2025-12-15T11:50:00+08:00",
"document/content/docs/upgrading/4-14/4140.mdx": "2025-11-06T15:43:00+08:00",
"document/content/docs/upgrading/4-14/4141.mdx": "2025-11-19T10:15:27+08:00",
"document/content/docs/upgrading/4-14/4142.mdx": "2025-11-18T19:27:14+08:00",
"document/content/docs/upgrading/4-14/4143.mdx": "2025-11-26T20:52:05+08:00",
"document/content/docs/upgrading/4-14/4144.mdx": "2025-12-15T15:09:13+08:00",
"document/content/docs/upgrading/4-14/4144.mdx": "2025-12-15T23:36:54+08:00",
"document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00",
"document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00",
"document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00",

View File

@ -36,12 +36,14 @@ async function createTemporaryIndexes(): Promise<void> {
{ userGoodFeedback: 1, teamId: 1, appId: 1, chatId: 1 },
{
name: 'temp_feedback_migration_good',
partialFilterExpression: { userGoodFeedback: { $exists: true } }
partialFilterExpression: { userGoodFeedback: { $exists: true } },
background: true
} as any
),
MongoChatItem.collection.createIndex({ userBadFeedback: 1, teamId: 1, appId: 1, chatId: 1 }, {
name: 'temp_feedback_migration_bad',
partialFilterExpression: { userBadFeedback: { $exists: true } }
partialFilterExpression: { userBadFeedback: { $exists: true } },
background: true
} as any)
]);
@ -203,7 +205,7 @@ export async function migrateFeedbackFlags() {
const durationMinutes = (duration / 1000 / 60).toFixed(2);
addLog.info('========================================');
addLog.info('Migration completed!');
addLog.info('Migration feedback completed!');
addLog.info(`Total: ${chats.length.toLocaleString()}`);
addLog.info(`Succeeded: ${succeeded.toLocaleString()}`);
addLog.info(`Failed: ${failed.toLocaleString()}`);

View File

@ -979,7 +979,7 @@ async function handler(req: NextApiRequest, _res: NextApiResponse) {
addLog.info(`[Migration ${batchId}] =======================================`);
// 重新统计每一个 chat 的反馈情况
await migrateFeedbackFlags();
migrateFeedbackFlags();
return {
batchId,

View File

@ -8,7 +8,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
import MyBox from '@fastgpt/web/components/common/MyBox';
import MyIconButton from '@fastgpt/web/components/common/Icon/button';
import MyMenu from '@fastgpt/web/components/common/MyMenu';
import { useState, useMemo, useRef, useEffect, useCallback, useReducer } from 'react';
import { useState, useMemo, useRef, useEffect, useCallback } from 'react';
import { useDebounce, useMount, useSet } from 'ahooks';
import ToolCard, { type ToolCardItemType } from '@fastgpt/web/components/core/plugin/tool/ToolCard';
import ToolTagFilterBox from '@fastgpt/web/components/core/plugin/tool/TagFilterBox';
@ -153,18 +153,20 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
// Controler
const { runAsync: handleInstallTool } = useRequest2(
async (tool: ToolCardItemType) => {
const downloadUrl = await getMarketplaceDownloadURL(tool.id);
if (!downloadUrl) return;
const existingPromise = operatingPromisesRef.current.get(tool.id);
if (existingPromise) {
await existingPromise;
return;
}
const operationPromise = (async () => {
installingOrDeletingToolIdsDispatch.add(tool.id);
installingOrDeletingToolIdsDispatch.add(tool.id);
const downloadUrl = await getMarketplaceDownloadURL(tool.id);
if (!downloadUrl) {
installingOrDeletingToolIdsDispatch.remove(tool.id);
return;
}
const operationPromise = (async () => {
try {
await intallPluginWithUrl({
downloadUrls: [downloadUrl]
@ -173,10 +175,10 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
if (selectedTool?.id === tool.id) {
setSelectedTool((prev) => (prev ? { ...prev, status: 3 } : null));
}
await refreshInstalledPlugins();
} finally {
installingOrDeletingToolIdsDispatch.remove(tool.id);
operatingPromisesRef.current.delete(tool.id);
await refreshInstalledPlugins();
}
})();
operatingPromisesRef.current.set(tool.id, operationPromise);
@ -213,10 +215,10 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
if (selectedTool?.id === tool.id) {
setSelectedTool((prev) => (prev ? { ...prev, status: 3 } : null));
}
await refreshInstalledPlugins();
} finally {
updatingToolIdsDispatch.remove(tool.id);
operatingPromisesRef.current.delete(tool.id);
await refreshInstalledPlugins();
}
})();
@ -243,10 +245,10 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
if (selectedTool?.id === tool.id) {
setSelectedTool((prev) => (prev ? { ...prev, status: 1 } : null));
}
await refreshInstalledPlugins();
} finally {
installingOrDeletingToolIdsDispatch.remove(tool.id);
operatingPromisesRef.current.delete(tool.id);
await refreshInstalledPlugins();
}
})();
operatingPromisesRef.current.set(tool.id, operationPromise);
@ -374,6 +376,7 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
onClick={() => router.push('/config/tool')}
position={'absolute'}
top={4}
zIndex={1000}
{...(showCompactSearch ? { right: 4 } : { left: 4 })}
/>
{!showCompactSearch && (