Commit 0e367657 by Archer Committed by GitHub

refresh plugins (#6099)

* doc

* refresh plugins

* perf: loading in install

* background index
parent 7bfd02a4
...@@ -20,7 +20,8 @@ curl --location --request POST 'https://{{host}}/api/admin/initv4144' \ ...@@ -20,7 +20,8 @@ curl --location --request POST 'https://{{host}}/api/admin/initv4144' \
--header 'Content-Type: application/json' --header 'Content-Type: application/json'
``` ```
将 4.14.3 中,遗留的 Dataset/local 接口上传的文件,也迁移到 S3 中。 1. 将 4.14.3 中,遗留的 Dataset/local 接口上传的文件,也迁移到 S3 中。
2. 全量计算旧的 chat 中的反馈,增加 flags 值便于筛选。该函数执行较慢,所以放到异步执行,接口不会返回结果,请关注日志中是否打印:Migration feedback completed!
## 🚀 新增内容 ## 🚀 新增内容
......
...@@ -97,10 +97,10 @@ ...@@ -97,10 +97,10 @@
"document/content/docs/protocol/index.mdx": "2025-07-30T15:38:30+08:00", "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.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/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.en.mdx": "2025-12-15T23:36:54+08:00",
"document/content/docs/protocol/privacy.mdx": "2025-12-12T21:30:11+08:00", "document/content/docs/protocol/privacy.mdx": "2025-12-15T23:36:54+08:00",
"document/content/docs/protocol/terms.en.mdx": "2025-12-12T21:30:11+08:00", "document/content/docs/protocol/terms.en.mdx": "2025-12-15T23:36:54+08:00",
"document/content/docs/protocol/terms.mdx": "2025-12-12T21:30:11+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.en.mdx": "2025-08-04T13:42:36+08:00",
"document/content/docs/toc.mdx": "2025-12-09T23:33:32+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", "document/content/docs/upgrading/4-10/4100.mdx": "2025-08-02T19:38:37+08:00",
...@@ -114,12 +114,12 @@ ...@@ -114,12 +114,12 @@
"document/content/docs/upgrading/4-12/4124.mdx": "2025-09-17T22:29:56+08:00", "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/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/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/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/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/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/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/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/41.mdx": "2025-08-02T19:38:37+08:00",
"document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00", "document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00",
......
...@@ -36,12 +36,14 @@ async function createTemporaryIndexes(): Promise<void> { ...@@ -36,12 +36,14 @@ async function createTemporaryIndexes(): Promise<void> {
{ userGoodFeedback: 1, teamId: 1, appId: 1, chatId: 1 }, { userGoodFeedback: 1, teamId: 1, appId: 1, chatId: 1 },
{ {
name: 'temp_feedback_migration_good', name: 'temp_feedback_migration_good',
partialFilterExpression: { userGoodFeedback: { $exists: true } } partialFilterExpression: { userGoodFeedback: { $exists: true } },
background: true
} as any } as any
), ),
MongoChatItem.collection.createIndex({ userBadFeedback: 1, teamId: 1, appId: 1, chatId: 1 }, { MongoChatItem.collection.createIndex({ userBadFeedback: 1, teamId: 1, appId: 1, chatId: 1 }, {
name: 'temp_feedback_migration_bad', name: 'temp_feedback_migration_bad',
partialFilterExpression: { userBadFeedback: { $exists: true } } partialFilterExpression: { userBadFeedback: { $exists: true } },
background: true
} as any) } as any)
]); ]);
...@@ -203,7 +205,7 @@ export async function migrateFeedbackFlags() { ...@@ -203,7 +205,7 @@ export async function migrateFeedbackFlags() {
const durationMinutes = (duration / 1000 / 60).toFixed(2); const durationMinutes = (duration / 1000 / 60).toFixed(2);
addLog.info('========================================'); addLog.info('========================================');
addLog.info('Migration completed!'); addLog.info('Migration feedback completed!');
addLog.info(`Total: ${chats.length.toLocaleString()}`); addLog.info(`Total: ${chats.length.toLocaleString()}`);
addLog.info(`Succeeded: ${succeeded.toLocaleString()}`); addLog.info(`Succeeded: ${succeeded.toLocaleString()}`);
addLog.info(`Failed: ${failed.toLocaleString()}`); addLog.info(`Failed: ${failed.toLocaleString()}`);
......
...@@ -979,7 +979,7 @@ async function handler(req: NextApiRequest, _res: NextApiResponse) { ...@@ -979,7 +979,7 @@ async function handler(req: NextApiRequest, _res: NextApiResponse) {
addLog.info(`[Migration ${batchId}] =======================================`); addLog.info(`[Migration ${batchId}] =======================================`);
// 重新统计每一个 chat 的反馈情况 // 重新统计每一个 chat 的反馈情况
await migrateFeedbackFlags(); migrateFeedbackFlags();
return { return {
batchId, batchId,
......
...@@ -8,7 +8,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon'; ...@@ -8,7 +8,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
import MyBox from '@fastgpt/web/components/common/MyBox'; import MyBox from '@fastgpt/web/components/common/MyBox';
import MyIconButton from '@fastgpt/web/components/common/Icon/button'; import MyIconButton from '@fastgpt/web/components/common/Icon/button';
import MyMenu from '@fastgpt/web/components/common/MyMenu'; 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 { useDebounce, useMount, useSet } from 'ahooks';
import ToolCard, { type ToolCardItemType } from '@fastgpt/web/components/core/plugin/tool/ToolCard'; import ToolCard, { type ToolCardItemType } from '@fastgpt/web/components/core/plugin/tool/ToolCard';
import ToolTagFilterBox from '@fastgpt/web/components/core/plugin/tool/TagFilterBox'; import ToolTagFilterBox from '@fastgpt/web/components/core/plugin/tool/TagFilterBox';
...@@ -153,18 +153,20 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => { ...@@ -153,18 +153,20 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
// Controler // Controler
const { runAsync: handleInstallTool } = useRequest2( const { runAsync: handleInstallTool } = useRequest2(
async (tool: ToolCardItemType) => { async (tool: ToolCardItemType) => {
const downloadUrl = await getMarketplaceDownloadURL(tool.id);
if (!downloadUrl) return;
const existingPromise = operatingPromisesRef.current.get(tool.id); const existingPromise = operatingPromisesRef.current.get(tool.id);
if (existingPromise) { if (existingPromise) {
await existingPromise; await existingPromise;
return; 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 { try {
await intallPluginWithUrl({ await intallPluginWithUrl({
downloadUrls: [downloadUrl] downloadUrls: [downloadUrl]
...@@ -173,10 +175,10 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => { ...@@ -173,10 +175,10 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
if (selectedTool?.id === tool.id) { if (selectedTool?.id === tool.id) {
setSelectedTool((prev) => (prev ? { ...prev, status: 3 } : null)); setSelectedTool((prev) => (prev ? { ...prev, status: 3 } : null));
} }
await refreshInstalledPlugins();
} finally { } finally {
installingOrDeletingToolIdsDispatch.remove(tool.id); installingOrDeletingToolIdsDispatch.remove(tool.id);
operatingPromisesRef.current.delete(tool.id); operatingPromisesRef.current.delete(tool.id);
await refreshInstalledPlugins();
} }
})(); })();
operatingPromisesRef.current.set(tool.id, operationPromise); operatingPromisesRef.current.set(tool.id, operationPromise);
...@@ -213,10 +215,10 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => { ...@@ -213,10 +215,10 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
if (selectedTool?.id === tool.id) { if (selectedTool?.id === tool.id) {
setSelectedTool((prev) => (prev ? { ...prev, status: 3 } : null)); setSelectedTool((prev) => (prev ? { ...prev, status: 3 } : null));
} }
await refreshInstalledPlugins();
} finally { } finally {
updatingToolIdsDispatch.remove(tool.id); updatingToolIdsDispatch.remove(tool.id);
operatingPromisesRef.current.delete(tool.id); operatingPromisesRef.current.delete(tool.id);
await refreshInstalledPlugins();
} }
})(); })();
...@@ -243,10 +245,10 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => { ...@@ -243,10 +245,10 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
if (selectedTool?.id === tool.id) { if (selectedTool?.id === tool.id) {
setSelectedTool((prev) => (prev ? { ...prev, status: 1 } : null)); setSelectedTool((prev) => (prev ? { ...prev, status: 1 } : null));
} }
await refreshInstalledPlugins();
} finally { } finally {
installingOrDeletingToolIdsDispatch.remove(tool.id); installingOrDeletingToolIdsDispatch.remove(tool.id);
operatingPromisesRef.current.delete(tool.id); operatingPromisesRef.current.delete(tool.id);
await refreshInstalledPlugins();
} }
})(); })();
operatingPromisesRef.current.set(tool.id, operationPromise); operatingPromisesRef.current.set(tool.id, operationPromise);
...@@ -374,6 +376,7 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => { ...@@ -374,6 +376,7 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
onClick={() => router.push('/config/tool')} onClick={() => router.push('/config/tool')}
position={'absolute'} position={'absolute'}
top={4} top={4}
zIndex={1000}
{...(showCompactSearch ? { right: 4 } : { left: 4 })} {...(showCompactSearch ? { right: 4 } : { left: 4 })}
/> />
{!showCompactSearch && ( {!showCompactSearch && (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment