add model test log (#4272)

* sync collection

* remove lock

* add model test log

* update ui

* update log

* fix: channel test

* preview chunk ui

* test model ux

* test model log

* perf: dataset selector

* fix: system plugin auth

* update nextjs
This commit is contained in:
Archer
2025-03-24 13:49:43 +08:00
committed by archer
parent a680b565ea
commit 2fcf421672
24 changed files with 210 additions and 153 deletions

View File

@@ -25,7 +25,11 @@ weight: 799
2. 邀请链接交互。 2. 邀请链接交互。
3. 无 SSL 证书时复制失败,会提示弹窗用于手动复制。 3. 无 SSL 证书时复制失败,会提示弹窗用于手动复制。
4. FastGPT 未内置 ai proxy 渠道时,也能正常展示其名称。 4. FastGPT 未内置 ai proxy 渠道时,也能正常展示其名称。
5. 升级 nextjs 版本至 14.2.25。
## 🐛 修复 ## 🐛 修复
1. 飞书和语雀知识库无法同步。 1. 飞书和语雀知识库无法同步。
2. 渠道测试时,如果配置了模型自定义请求地址,会走自定义请求地址,而不是渠道请求地址。
3. 语音识别模型测试未启用的模型时,无法正常测试。
4. 管理员配置系统插件时,如果插件包含其他系统应用,无法正常鉴权。

View File

@@ -41,6 +41,8 @@ export type PluginTemplateType = PluginRuntimeType & {
export type PluginRuntimeType = { export type PluginRuntimeType = {
id: string; id: string;
teamId?: string; teamId?: string;
tmbId?: string;
name: string; name: string;
avatar: string; avatar: string;
showStatus?: boolean; showStatus?: boolean;

View File

@@ -10,7 +10,7 @@
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"jschardet": "3.1.1", "jschardet": "3.1.1",
"nanoid": "^5.1.3", "nanoid": "^5.1.3",
"next": "14.2.24", "next": "14.2.25",
"openai": "4.61.0", "openai": "4.61.0",
"openapi-types": "^12.1.3", "openapi-types": "^12.1.3",
"json5": "^2.2.3", "json5": "^2.2.3",

View File

@@ -3,21 +3,25 @@ import { getAxiosConfig } from '../config';
import axios from 'axios'; import axios from 'axios';
import FormData from 'form-data'; import FormData from 'form-data';
import { getSTTModel } from '../model'; import { getSTTModel } from '../model';
import { STTModelType } from '@fastgpt/global/core/ai/model.d';
export const aiTranscriptions = async ({ export const aiTranscriptions = async ({
model, model: modelData,
fileStream, fileStream,
headers headers
}: { }: {
model: string; model: STTModelType;
fileStream: fs.ReadStream; fileStream: fs.ReadStream;
headers?: Record<string, string>; headers?: Record<string, string>;
}) => { }) => {
if (!modelData) {
return Promise.reject('no model');
}
const data = new FormData(); const data = new FormData();
data.append('model', model); data.append('model', modelData.model);
data.append('file', fileStream); data.append('file', fileStream);
const modelData = getSTTModel(model);
const aiAxiosConfig = getAxiosConfig(); const aiAxiosConfig = getAxiosConfig();
const { data: result } = await axios<{ text: string }>({ const { data: result } = await axios<{ text: string }>({

View File

@@ -37,11 +37,12 @@ export async function splitCombinePluginId(id: string) {
return { source, pluginId: id }; return { source, pluginId: id };
} }
type ChildAppType = SystemPluginTemplateItemType & { teamId?: string }; type ChildAppType = SystemPluginTemplateItemType & { teamId?: string; tmbId?: string };
const getSystemPluginTemplateById = async ( const getSystemPluginTemplateById = async (
pluginId: string, pluginId: string,
versionId?: string versionId?: string
): Promise<SystemPluginTemplateItemType> => { ): Promise<ChildAppType> => {
const item = getSystemPluginTemplates().find((plugin) => plugin.id === pluginId); const item = getSystemPluginTemplates().find((plugin) => plugin.id === pluginId);
if (!item) return Promise.reject(PluginErrEnum.unAuth); if (!item) return Promise.reject(PluginErrEnum.unAuth);
@@ -67,12 +68,17 @@ const getSystemPluginTemplateById = async (
: await getAppLatestVersion(plugin.associatedPluginId, app); : await getAppLatestVersion(plugin.associatedPluginId, app);
if (!version.versionId) return Promise.reject('App version not found'); if (!version.versionId) return Promise.reject('App version not found');
plugin.workflow = { return {
nodes: version.nodes, ...plugin,
edges: version.edges, workflow: {
chatConfig: version.chatConfig nodes: version.nodes,
edges: version.edges,
chatConfig: version.chatConfig
},
version: versionId || String(version.versionId),
teamId: String(app.teamId),
tmbId: String(app.tmbId)
}; };
plugin.version = versionId || String(version.versionId);
} }
return plugin; return plugin;
}; };
@@ -168,6 +174,7 @@ export async function getChildAppRuntimeById(
return { return {
id: String(item._id), id: String(item._id),
teamId: String(item.teamId), teamId: String(item.teamId),
tmbId: String(item.tmbId),
name: item.name, name: item.name,
avatar: item.avatar, avatar: item.avatar,
intro: item.intro, intro: item.intro,
@@ -187,6 +194,7 @@ export async function getChildAppRuntimeById(
pluginOrder: 0 pluginOrder: 0
}; };
} else { } else {
// System
return getSystemPluginTemplateById(pluginId, versionId); return getSystemPluginTemplateById(pluginId, versionId);
} }
})(); })();
@@ -194,6 +202,7 @@ export async function getChildAppRuntimeById(
return { return {
id: app.id, id: app.id,
teamId: app.teamId, teamId: app.teamId,
tmbId: app.tmbId,
name: app.name, name: app.name,
avatar: app.avatar, avatar: app.avatar,
showStatus: app.showStatus, showStatus: app.showStatus,

View File

@@ -88,9 +88,9 @@ export const dispatchRunPlugin = async (props: RunPluginProps): Promise<RunPlugi
: {}), : {}),
runningAppInfo: { runningAppInfo: {
id: String(plugin.id), id: String(plugin.id),
// 如果系统插件,则使用当前团队的 teamId 和 tmbId // 如果系统插件有 teamId 和 tmbId则使用系统插件的 teamId 和 tmbId管理员指定了插件作为系统插件
teamId: plugin.teamId || runningAppInfo.teamId, teamId: plugin.teamId || runningAppInfo.teamId,
tmbId: pluginData?.tmbId || runningAppInfo.tmbId tmbId: plugin.tmbId || runningAppInfo.tmbId
}, },
variables: runtimeVariables, variables: runtimeVariables,
query: getPluginRunUserQuery({ query: getPluginRunUserQuery({

View File

@@ -26,7 +26,7 @@
"mammoth": "^1.6.0", "mammoth": "^1.6.0",
"mongoose": "^8.10.1", "mongoose": "^8.10.1",
"multer": "1.4.5-lts.1", "multer": "1.4.5-lts.1",
"next": "14.2.24", "next": "14.2.25",
"nextjs-cors": "^2.2.0", "nextjs-cors": "^2.2.0",
"node-cron": "^3.0.3", "node-cron": "^3.0.3",
"node-xlsx": "^0.24.0", "node-xlsx": "^0.24.0",

View File

@@ -12,6 +12,7 @@
"channel_status_unknown": "unknown", "channel_status_unknown": "unknown",
"channel_type": "Manufacturer", "channel_type": "Manufacturer",
"clear_model": "Clear the model", "clear_model": "Clear the model",
"confirm_delete_channel": "Confirm the deletion of the [{{name}}] channel?",
"copy_model_id_success": "Copyed model id", "copy_model_id_success": "Copyed model id",
"create_channel": "Added channels", "create_channel": "Added channels",
"default_url": "Default address", "default_url": "Default address",

View File

@@ -80,7 +80,7 @@
"permission.des.write": "Ability to add and change knowledge base content", "permission.des.write": "Ability to add and change knowledge base content",
"preview_chunk": "Preview chunks", "preview_chunk": "Preview chunks",
"preview_chunk_empty": "Unable to read the contents of the file", "preview_chunk_empty": "Unable to read the contents of the file",
"preview_chunk_intro": "Display up to 10 pieces", "preview_chunk_intro": "A total of {{total}} blocks, up to 10",
"preview_chunk_not_selected": "Click on the file on the left to preview", "preview_chunk_not_selected": "Click on the file on the left to preview",
"rebuild_embedding_start_tip": "Index model switching task has started", "rebuild_embedding_start_tip": "Index model switching task has started",
"rebuilding_index_count": "Number of indexes being rebuilt: {{count}}", "rebuilding_index_count": "Number of indexes being rebuilt: {{count}}",

View File

@@ -12,6 +12,7 @@
"channel_status_unknown": "未知", "channel_status_unknown": "未知",
"channel_type": "厂商", "channel_type": "厂商",
"clear_model": "清空模型", "clear_model": "清空模型",
"confirm_delete_channel": "确认删除 【{{name}}】渠道?",
"copy_model_id_success": "已复制模型id", "copy_model_id_success": "已复制模型id",
"create_channel": "新增渠道", "create_channel": "新增渠道",
"default_url": "默认地址", "default_url": "默认地址",

View File

@@ -80,7 +80,7 @@
"permission.des.write": "可增加和变更知识库内容", "permission.des.write": "可增加和变更知识库内容",
"preview_chunk": "分块预览", "preview_chunk": "分块预览",
"preview_chunk_empty": "无法读取该文件内容", "preview_chunk_empty": "无法读取该文件内容",
"preview_chunk_intro": "最多展示 10 个分块", "preview_chunk_intro": "共 {{total}} 个分块,最多展示 10 个",
"preview_chunk_not_selected": "点击左侧文件后进行预览", "preview_chunk_not_selected": "点击左侧文件后进行预览",
"rebuild_embedding_start_tip": "切换索引模型任务已开始", "rebuild_embedding_start_tip": "切换索引模型任务已开始",
"rebuilding_index_count": "重建中索引数量:{{count}}", "rebuilding_index_count": "重建中索引数量:{{count}}",

View File

@@ -12,6 +12,7 @@
"channel_status_unknown": "未知", "channel_status_unknown": "未知",
"channel_type": "廠商", "channel_type": "廠商",
"clear_model": "清空模型", "clear_model": "清空模型",
"confirm_delete_channel": "確認刪除 【{{name}}】渠道?",
"copy_model_id_success": "已復制模型id", "copy_model_id_success": "已復制模型id",
"create_channel": "新增渠道", "create_channel": "新增渠道",
"default_url": "默認地址", "default_url": "默認地址",

View File

@@ -80,7 +80,7 @@
"permission.des.write": "可新增和變更資料集內容", "permission.des.write": "可新增和變更資料集內容",
"preview_chunk": "分塊預覽", "preview_chunk": "分塊預覽",
"preview_chunk_empty": "無法讀取該文件內容", "preview_chunk_empty": "無法讀取該文件內容",
"preview_chunk_intro": "最多展示 10 個分塊", "preview_chunk_intro": "共 {{total}} 個分塊,最多展示 10 個",
"preview_chunk_not_selected": "點擊左側文件後進行預覽", "preview_chunk_not_selected": "點擊左側文件後進行預覽",
"rebuild_embedding_start_tip": "切換索引模型任務已開始", "rebuild_embedding_start_tip": "切換索引模型任務已開始",
"rebuilding_index_count": "重建中索引數量:{{count}}", "rebuilding_index_count": "重建中索引數量:{{count}}",

122
pnpm-lock.yaml generated
View File

@@ -25,7 +25,7 @@ importers:
version: 13.3.0 version: 13.3.0
next-i18next: next-i18next:
specifier: 15.4.2 specifier: 15.4.2
version: 15.4.2(i18next@23.16.8)(next@14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react-i18next@14.1.2(i18next@23.16.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) version: 15.4.2(i18next@23.16.8)(next@14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react-i18next@14.1.2(i18next@23.16.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)
prettier: prettier:
specifier: 3.2.4 specifier: 3.2.4
version: 3.2.4 version: 3.2.4
@@ -75,8 +75,8 @@ importers:
specifier: ^5.1.3 specifier: ^5.1.3
version: 5.1.3 version: 5.1.3
next: next:
specifier: 14.2.24 specifier: 14.2.25
version: 14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1) version: 14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1)
openai: openai:
specifier: 4.61.0 specifier: 4.61.0
version: 4.61.0(encoding@0.1.13)(zod@3.24.2) version: 4.61.0(encoding@0.1.13)(zod@3.24.2)
@@ -221,11 +221,11 @@ importers:
specifier: 1.4.5-lts.1 specifier: 1.4.5-lts.1
version: 1.4.5-lts.1 version: 1.4.5-lts.1
next: next:
specifier: 14.2.24 specifier: 14.2.25
version: 14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1) version: 14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1)
nextjs-cors: nextjs-cors:
specifier: ^2.2.0 specifier: ^2.2.0
version: 2.2.0(next@14.2.24(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1)) version: 2.2.0(next@14.2.25(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))
node-cron: node-cron:
specifier: ^3.0.3 specifier: ^3.0.3
version: 3.0.3 version: 3.0.3
@@ -307,7 +307,7 @@ importers:
version: 2.1.1(@chakra-ui/system@2.6.1(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(react@18.3.1))(react@18.3.1) version: 2.1.1(@chakra-ui/system@2.6.1(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(react@18.3.1))(react@18.3.1)
'@chakra-ui/next-js': '@chakra-ui/next-js':
specifier: 2.4.2 specifier: 2.4.2
version: 2.4.2(@chakra-ui/react@2.10.7(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(framer-motion@9.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(next@14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react@18.3.1) version: 2.4.2(@chakra-ui/react@2.10.7(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(framer-motion@9.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(next@14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react@18.3.1)
'@chakra-ui/react': '@chakra-ui/react':
specifier: 2.10.7 specifier: 2.10.7
version: 2.10.7(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(framer-motion@9.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) version: 2.10.7(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(framer-motion@9.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@@ -370,7 +370,7 @@ importers:
version: 4.17.21 version: 4.17.21
next-i18next: next-i18next:
specifier: 15.4.2 specifier: 15.4.2
version: 15.4.2(i18next@23.16.8)(next@14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react-i18next@14.1.2(i18next@23.16.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) version: 15.4.2(i18next@23.16.8)(next@14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react-i18next@14.1.2(i18next@23.16.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)
papaparse: papaparse:
specifier: ^5.4.1 specifier: ^5.4.1
version: 5.4.1 version: 5.4.1
@@ -431,7 +431,7 @@ importers:
version: 2.1.1(@chakra-ui/system@2.6.1(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(react@18.3.1))(react@18.3.1) version: 2.1.1(@chakra-ui/system@2.6.1(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(react@18.3.1))(react@18.3.1)
'@chakra-ui/next-js': '@chakra-ui/next-js':
specifier: 2.4.2 specifier: 2.4.2
version: 2.4.2(@chakra-ui/react@2.10.7(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(framer-motion@9.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(next@14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react@18.3.1) version: 2.4.2(@chakra-ui/react@2.10.7(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(framer-motion@9.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(next@14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react@18.3.1)
'@chakra-ui/react': '@chakra-ui/react':
specifier: 2.10.7 specifier: 2.10.7
version: 2.10.7(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(framer-motion@9.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) version: 2.10.7(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(framer-motion@9.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@@ -526,11 +526,11 @@ importers:
specifier: ^5.1.3 specifier: ^5.1.3
version: 5.1.3 version: 5.1.3
next: next:
specifier: 14.2.24 specifier: 14.2.25
version: 14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1) version: 14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1)
next-i18next: next-i18next:
specifier: 15.4.2 specifier: 15.4.2
version: 15.4.2(i18next@23.16.8)(next@14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react-i18next@14.1.2(i18next@23.16.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) version: 15.4.2(i18next@23.16.8)(next@14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react-i18next@14.1.2(i18next@23.16.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)
nprogress: nprogress:
specifier: ^0.2.0 specifier: ^0.2.0
version: 0.2.0 version: 0.2.0
@@ -2412,62 +2412,62 @@ packages:
'@nestjs/platform-express': '@nestjs/platform-express':
optional: true optional: true
'@next/env@14.2.24': '@next/env@14.2.25':
resolution: {integrity: sha512-LAm0Is2KHTNT6IT16lxT+suD0u+VVfYNQqM+EJTKuFRRuY2z+zj01kueWXPCxbMBDt0B5vONYzabHGUNbZYAhA==} resolution: {integrity: sha512-JnzQ2cExDeG7FxJwqAksZ3aqVJrHjFwZQAEJ9gQZSoEhIow7SNoKZzju/AwQ+PLIR4NY8V0rhcVozx/2izDO0w==}
'@next/eslint-plugin-next@14.2.24': '@next/eslint-plugin-next@14.2.24':
resolution: {integrity: sha512-FDL3qs+5DML0AJz56DCVr+KnFYivxeAX73En8QbPw9GjJZ6zbfvqDy+HrarHFzbsIASn7y8y5ySJ/lllSruNVQ==} resolution: {integrity: sha512-FDL3qs+5DML0AJz56DCVr+KnFYivxeAX73En8QbPw9GjJZ6zbfvqDy+HrarHFzbsIASn7y8y5ySJ/lllSruNVQ==}
'@next/swc-darwin-arm64@14.2.24': '@next/swc-darwin-arm64@14.2.25':
resolution: {integrity: sha512-7Tdi13aojnAZGpapVU6meVSpNzgrFwZ8joDcNS8cJVNuP3zqqrLqeory9Xec5TJZR/stsGJdfwo8KeyloT3+rQ==} resolution: {integrity: sha512-09clWInF1YRd6le00vt750s3m7SEYNehz9C4PUcSu3bAdCTpjIV4aTYQZ25Ehrr83VR1rZeqtKUPWSI7GfuKZQ==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [arm64] cpu: [arm64]
os: [darwin] os: [darwin]
'@next/swc-darwin-x64@14.2.24': '@next/swc-darwin-x64@14.2.25':
resolution: {integrity: sha512-lXR2WQqUtu69l5JMdTwSvQUkdqAhEWOqJEYUQ21QczQsAlNOW2kWZCucA6b3EXmPbcvmHB1kSZDua/713d52xg==} resolution: {integrity: sha512-V+iYM/QR+aYeJl3/FWWU/7Ix4b07ovsQ5IbkwgUK29pTHmq+5UxeDr7/dphvtXEq5pLB/PucfcBNh9KZ8vWbug==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [x64] cpu: [x64]
os: [darwin] os: [darwin]
'@next/swc-linux-arm64-gnu@14.2.24': '@next/swc-linux-arm64-gnu@14.2.25':
resolution: {integrity: sha512-nxvJgWOpSNmzidYvvGDfXwxkijb6hL9+cjZx1PVG6urr2h2jUqBALkKjT7kpfurRWicK6hFOvarmaWsINT1hnA==} resolution: {integrity: sha512-LFnV2899PJZAIEHQ4IMmZIgL0FBieh5keMnriMY1cK7ompR+JUd24xeTtKkcaw8QmxmEdhoE5Mu9dPSuDBgtTg==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
'@next/swc-linux-arm64-musl@14.2.24': '@next/swc-linux-arm64-musl@14.2.25':
resolution: {integrity: sha512-PaBgOPhqa4Abxa3y/P92F3kklNPsiFjcjldQGT7kFmiY5nuFn8ClBEoX8GIpqU1ODP2y8P6hio6vTomx2Vy0UQ==} resolution: {integrity: sha512-QC5y5PPTmtqFExcKWKYgUNkHeHE/z3lUsu83di488nyP0ZzQ3Yse2G6TCxz6nNsQwgAx1BehAJTZez+UQxzLfw==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
'@next/swc-linux-x64-gnu@14.2.24': '@next/swc-linux-x64-gnu@14.2.25':
resolution: {integrity: sha512-vEbyadiRI7GOr94hd2AB15LFVgcJZQWu7Cdi9cWjCMeCiUsHWA0U5BkGPuoYRnTxTn0HacuMb9NeAmStfBCLoQ==} resolution: {integrity: sha512-y6/ML4b9eQ2D/56wqatTJN5/JR8/xdObU2Fb1RBidnrr450HLCKr6IJZbPqbv7NXmje61UyxjF5kvSajvjye5w==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
'@next/swc-linux-x64-musl@14.2.24': '@next/swc-linux-x64-musl@14.2.25':
resolution: {integrity: sha512-df0FC9ptaYsd8nQCINCzFtDWtko8PNRTAU0/+d7hy47E0oC17tI54U/0NdGk7l/76jz1J377dvRjmt6IUdkpzQ==} resolution: {integrity: sha512-sPX0TSXHGUOZFvv96GoBXpB3w4emMqKeMgemrSxI7A6l55VBJp/RKYLwZIB9JxSqYPApqiREaIIap+wWq0RU8w==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
'@next/swc-win32-arm64-msvc@14.2.24': '@next/swc-win32-arm64-msvc@14.2.25':
resolution: {integrity: sha512-ZEntbLjeYAJ286eAqbxpZHhDFYpYjArotQ+/TW9j7UROh0DUmX7wYDGtsTPpfCV8V+UoqHBPU7q9D4nDNH014Q==} resolution: {integrity: sha512-ReO9S5hkA1DU2cFCsGoOEp7WJkhFzNbU/3VUF6XxNGUCQChyug6hZdYL/istQgfT/GWE6PNIg9cm784OI4ddxQ==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [arm64] cpu: [arm64]
os: [win32] os: [win32]
'@next/swc-win32-ia32-msvc@14.2.24': '@next/swc-win32-ia32-msvc@14.2.25':
resolution: {integrity: sha512-9KuS+XUXM3T6v7leeWU0erpJ6NsFIwiTFD5nzNg8J5uo/DMIPvCp3L1Ao5HjbHX0gkWPB1VrKoo/Il4F0cGK2Q==} resolution: {integrity: sha512-DZ/gc0o9neuCDyD5IumyTGHVun2dCox5TfPQI/BJTYwpSNYM3CZDI4i6TOdjeq1JMo+Ug4kPSMuZdwsycwFbAw==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [ia32] cpu: [ia32]
os: [win32] os: [win32]
'@next/swc-win32-x64-msvc@14.2.24': '@next/swc-win32-x64-msvc@14.2.25':
resolution: {integrity: sha512-cXcJ2+x0fXQ2CntaE00d7uUH+u1Bfp/E0HsNQH79YiLaZE5Rbm7dZzyAYccn3uICM7mw+DxoMqEfGXZtF4Fgaw==} resolution: {integrity: sha512-KSznmS6eFjQ9RJ1nEc66kJvtGIL1iZMYmGEXsZPh2YtnLtqrgdVvKXJY2ScjjoFnG6nGLyPFR0UiEvDwVah4Tw==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
@@ -7191,8 +7191,8 @@ packages:
react: '>= 17.0.2' react: '>= 17.0.2'
react-i18next: '>= 13.5.0' react-i18next: '>= 13.5.0'
next@14.2.24: next@14.2.25:
resolution: {integrity: sha512-En8VEexSJ0Py2FfVnRRh8gtERwDRaJGNvsvad47ShkC2Yi8AXQPXEA2vKoDJlGFSj5WE5SyF21zNi4M5gyi+SQ==} resolution: {integrity: sha512-N5M7xMc4wSb4IkPvEV5X2BRRXUmhVHNyaXwEM86+voXthSZz8ZiRyQW4p9mwAoAPIm6OzuVZtn7idgEJeAJN3Q==}
engines: {node: '>=18.17.0'} engines: {node: '>=18.17.0'}
hasBin: true hasBin: true
peerDependencies: peerDependencies:
@@ -10652,12 +10652,12 @@ snapshots:
'@chakra-ui/system': 2.6.1(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(react@18.3.1) '@chakra-ui/system': 2.6.1(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(react@18.3.1)
react: 18.3.1 react: 18.3.1
'@chakra-ui/next-js@2.4.2(@chakra-ui/react@2.10.7(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(framer-motion@9.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(next@14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react@18.3.1)': '@chakra-ui/next-js@2.4.2(@chakra-ui/react@2.10.7(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(framer-motion@9.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(next@14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react@18.3.1)':
dependencies: dependencies:
'@chakra-ui/react': 2.10.7(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(framer-motion@9.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@chakra-ui/react': 2.10.7(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@emotion/styled@11.11.0(@emotion/react@11.11.1(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(react@18.3.1))(@types/react@18.3.1)(framer-motion@9.1.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@emotion/cache': 11.14.0 '@emotion/cache': 11.14.0
'@emotion/react': 11.11.1(@types/react@18.3.1)(react@18.3.1) '@emotion/react': 11.11.1(@types/react@18.3.1)(react@18.3.1)
next: 14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1) next: 14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1)
react: 18.3.1 react: 18.3.1
'@chakra-ui/object-utils@2.1.0': {} '@chakra-ui/object-utils@2.1.0': {}
@@ -11665,37 +11665,37 @@ snapshots:
'@nestjs/core': 10.4.15(@nestjs/common@10.4.15(reflect-metadata@0.2.2)(rxjs@7.8.2))(encoding@0.1.13)(reflect-metadata@0.2.2)(rxjs@7.8.2) '@nestjs/core': 10.4.15(@nestjs/common@10.4.15(reflect-metadata@0.2.2)(rxjs@7.8.2))(encoding@0.1.13)(reflect-metadata@0.2.2)(rxjs@7.8.2)
tslib: 2.8.1 tslib: 2.8.1
'@next/env@14.2.24': {} '@next/env@14.2.25': {}
'@next/eslint-plugin-next@14.2.24': '@next/eslint-plugin-next@14.2.24':
dependencies: dependencies:
glob: 10.3.10 glob: 10.3.10
'@next/swc-darwin-arm64@14.2.24': '@next/swc-darwin-arm64@14.2.25':
optional: true optional: true
'@next/swc-darwin-x64@14.2.24': '@next/swc-darwin-x64@14.2.25':
optional: true optional: true
'@next/swc-linux-arm64-gnu@14.2.24': '@next/swc-linux-arm64-gnu@14.2.25':
optional: true optional: true
'@next/swc-linux-arm64-musl@14.2.24': '@next/swc-linux-arm64-musl@14.2.25':
optional: true optional: true
'@next/swc-linux-x64-gnu@14.2.24': '@next/swc-linux-x64-gnu@14.2.25':
optional: true optional: true
'@next/swc-linux-x64-musl@14.2.24': '@next/swc-linux-x64-musl@14.2.25':
optional: true optional: true
'@next/swc-win32-arm64-msvc@14.2.24': '@next/swc-win32-arm64-msvc@14.2.25':
optional: true optional: true
'@next/swc-win32-ia32-msvc@14.2.24': '@next/swc-win32-ia32-msvc@14.2.25':
optional: true optional: true
'@next/swc-win32-x64-msvc@14.2.24': '@next/swc-win32-x64-msvc@14.2.25':
optional: true optional: true
'@node-rs/jieba-android-arm-eabi@2.0.1': '@node-rs/jieba-android-arm-eabi@2.0.1':
@@ -17532,7 +17532,7 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
next-i18next@15.4.2(i18next@23.16.8)(next@14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react-i18next@14.1.2(i18next@23.16.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1): next-i18next@15.4.2(i18next@23.16.8)(next@14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1))(react-i18next@14.1.2(i18next@23.16.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1):
dependencies: dependencies:
'@babel/runtime': 7.26.10 '@babel/runtime': 7.26.10
'@types/hoist-non-react-statics': 3.3.6 '@types/hoist-non-react-statics': 3.3.6
@@ -17540,13 +17540,13 @@ snapshots:
hoist-non-react-statics: 3.3.2 hoist-non-react-statics: 3.3.2
i18next: 23.16.8 i18next: 23.16.8
i18next-fs-backend: 2.6.0 i18next-fs-backend: 2.6.0
next: 14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1) next: 14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1)
react: 18.3.1 react: 18.3.1
react-i18next: 14.1.2(i18next@23.16.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-i18next: 14.1.2(i18next@23.16.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
next@14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1): next@14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1):
dependencies: dependencies:
'@next/env': 14.2.24 '@next/env': 14.2.25
'@swc/helpers': 0.5.5 '@swc/helpers': 0.5.5
busboy: 1.6.0 busboy: 1.6.0
caniuse-lite: 1.0.30001704 caniuse-lite: 1.0.30001704
@@ -17556,24 +17556,24 @@ snapshots:
react-dom: 18.3.1(react@18.3.1) react-dom: 18.3.1(react@18.3.1)
styled-jsx: 5.1.1(@babel/core@7.26.10)(react@18.3.1) styled-jsx: 5.1.1(@babel/core@7.26.10)(react@18.3.1)
optionalDependencies: optionalDependencies:
'@next/swc-darwin-arm64': 14.2.24 '@next/swc-darwin-arm64': 14.2.25
'@next/swc-darwin-x64': 14.2.24 '@next/swc-darwin-x64': 14.2.25
'@next/swc-linux-arm64-gnu': 14.2.24 '@next/swc-linux-arm64-gnu': 14.2.25
'@next/swc-linux-arm64-musl': 14.2.24 '@next/swc-linux-arm64-musl': 14.2.25
'@next/swc-linux-x64-gnu': 14.2.24 '@next/swc-linux-x64-gnu': 14.2.25
'@next/swc-linux-x64-musl': 14.2.24 '@next/swc-linux-x64-musl': 14.2.25
'@next/swc-win32-arm64-msvc': 14.2.24 '@next/swc-win32-arm64-msvc': 14.2.25
'@next/swc-win32-ia32-msvc': 14.2.24 '@next/swc-win32-ia32-msvc': 14.2.25
'@next/swc-win32-x64-msvc': 14.2.24 '@next/swc-win32-x64-msvc': 14.2.25
sass: 1.85.1 sass: 1.85.1
transitivePeerDependencies: transitivePeerDependencies:
- '@babel/core' - '@babel/core'
- babel-plugin-macros - babel-plugin-macros
nextjs-cors@2.2.0(next@14.2.24(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1)): nextjs-cors@2.2.0(next@14.2.25(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1)):
dependencies: dependencies:
cors: 2.8.5 cors: 2.8.5
next: 14.2.24(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1) next: 14.2.25(@babel/core@7.26.10)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.85.1)
node-abi@3.74.0: node-abi@3.74.0:
dependencies: dependencies:

View File

@@ -42,7 +42,7 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mermaid": "^10.2.3", "mermaid": "^10.2.3",
"nanoid": "^5.1.3", "nanoid": "^5.1.3",
"next": "14.2.24", "next": "14.2.25",
"next-i18next": "15.4.2", "next-i18next": "15.4.2",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"qrcode": "^1.5.4", "qrcode": "^1.5.4",

View File

@@ -69,31 +69,37 @@ export const DatasetSelectModal = ({
{selectedDatasets.map((item) => {selectedDatasets.map((item) =>
(() => { (() => {
return ( return (
<Card <MyTooltip label={item.name}>
key={item.datasetId} <Card
p={3} key={item.datasetId}
border={theme.borders.base} p={3}
boxShadow={'sm'} border={'base'}
bg={'primary.200'} boxShadow={'sm'}
> bg={'primary.200'}
<Flex alignItems={'center'} h={'38px'}> >
<Avatar src={item.avatar} w={['1.25rem', '1.75rem']}></Avatar> <Flex alignItems={'center'} h={'38px'}>
<Box flex={'1 0 0'} w={0} className="textEllipsis" mx={3}> <Avatar
{item.name} src={item.avatar}
</Box> w={['1.25rem', '1.75rem']}
<MyIcon borderRadius={'sm'}
name={'delete'} ></Avatar>
w={'14px'} <Box flex={'1 0 0'} w={0} className="textEllipsis" mx={3} fontSize={'sm'}>
cursor={'pointer'} {item.name}
_hover={{ color: 'red.500' }} </Box>
onClick={() => { <MyIcon
setSelectedDatasets((state) => name={'delete'}
state.filter((dataset) => dataset.datasetId !== item.datasetId) w={'14px'}
); cursor={'pointer'}
}} _hover={{ color: 'red.500' }}
/> onClick={() => {
</Flex> setSelectedDatasets((state) =>
</Card> state.filter((dataset) => dataset.datasetId !== item.datasetId)
);
}}
/>
</Flex>
</Card>
</MyTooltip>
); );
})() })()
)} )}
@@ -117,7 +123,7 @@ export const DatasetSelectModal = ({
label={ label={
item.type === DatasetTypeEnum.folder item.type === DatasetTypeEnum.folder
? t('common:dataset.Select Folder') ? t('common:dataset.Select Folder')
: t('common:dataset.Select Dataset') : item.name
} }
> >
<Card <Card
@@ -152,14 +158,18 @@ export const DatasetSelectModal = ({
}} }}
> >
<Flex alignItems={'center'} h={'38px'}> <Flex alignItems={'center'} h={'38px'}>
<Avatar src={item.avatar} w={['24px', '28px']}></Avatar> <Avatar
src={item.avatar}
w={['1.25rem', '1.75rem']}
borderRadius={'sm'}
></Avatar>
<Box <Box
flex={'1 0 0'} flex={'1 0 0'}
w={0} w={0}
className="textEllipsis" className="textEllipsis"
ml={3} ml={3}
fontSize={'md'}
color={'myGray.900'} color={'myGray.900'}
fontSize={'sm'}
> >
{item.name} {item.name}
</Box> </Box>

View File

@@ -268,12 +268,10 @@ const RenderUserFormInteractive = React.memo(function RenderFormInput({
{interactive.params.description && <Markdown source={interactive.params.description} />} {interactive.params.description && <Markdown source={interactive.params.description} />}
{interactive.params.inputForm?.map((input) => ( {interactive.params.inputForm?.map((input) => (
<Box key={input.label}> <Box key={input.label}>
<Flex mb={1} alignItems={'center'} w={'full'}> <FormLabel mb={1} required={input.required} whiteSpace={'pre-wrap'}>
<FormLabel required={input.required} w={'full'} whiteSpace={'pre-wrap'}> {input.label}
{input.label} {input.description && <QuestionTip ml={1} label={input.description} />}
{input.description && <QuestionTip ml={1} label={input.description} />} </FormLabel>
</FormLabel>
</Flex>
{input.type === FlowNodeInputTypeEnum.input && ( {input.type === FlowNodeInputTypeEnum.input && (
<MyTextarea <MyTextarea
isDisabled={interactive.params.submitted} isDisabled={interactive.params.submitted}

View File

@@ -250,22 +250,24 @@ export const WholeResponseContent = ({
value={activeModule?.similarity} value={activeModule?.similarity}
/> />
<Row label={t('common:core.chat.response.module limit')} value={activeModule?.limit} /> <Row label={t('common:core.chat.response.module limit')} value={activeModule?.limit} />
<Row {activeModule?.searchUsingReRank !== undefined && (
label={t('common:core.chat.response.search using reRank')} <Row
rawDom={ label={t('common:core.chat.response.search using reRank')}
<Box border={'base'} borderRadius={'md'} p={2}> rawDom={
{activeModule?.searchUsingReRank ? ( <Box border={'base'} borderRadius={'md'} p={2}>
activeModule?.rerankModel ? ( {activeModule?.searchUsingReRank ? (
<Box>{`${activeModule.rerankModel}: ${activeModule.rerankWeight}`}</Box> activeModule?.rerankModel ? (
<Box>{`${activeModule.rerankModel}: ${activeModule.rerankWeight}`}</Box>
) : (
'True'
)
) : ( ) : (
'True' `False`
) )}
) : ( </Box>
`False` }
)} />
</Box> )}
}
/>
{activeModule.queryExtensionResult && ( {activeModule.queryExtensionResult && (
<> <>
<Row <Row

View File

@@ -38,6 +38,7 @@ import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
import MyNumberInput from '@fastgpt/web/components/common/Input/NumberInput'; import MyNumberInput from '@fastgpt/web/components/common/Input/NumberInput';
import { getModelProvider } from '@fastgpt/global/core/ai/provider'; import { getModelProvider } from '@fastgpt/global/core/ai/provider';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import { useConfirm } from '@fastgpt/web/hooks/useConfirm';
const EditChannelModal = dynamic(() => import('./EditChannelModal'), { ssr: false }); const EditChannelModal = dynamic(() => import('./EditChannelModal'), { ssr: false });
const ModelTest = dynamic(() => import('./ModelTest'), { ssr: false }); const ModelTest = dynamic(() => import('./ModelTest'), { ssr: false });
@@ -77,6 +78,9 @@ const ChannelTable = ({ Tab }: { Tab: React.ReactNode }) => {
} }
); );
const { openConfirm, ConfirmModal } = useConfirm({
type: 'delete'
});
const { runAsync: onDeleteChannel, loading: loadingDeleteChannel } = useRequest2(deleteChannel, { const { runAsync: onDeleteChannel, loading: loadingDeleteChannel } = useRequest2(deleteChannel, {
manual: true, manual: true,
onSuccess: () => { onSuccess: () => {
@@ -212,7 +216,14 @@ const ChannelTable = ({ Tab }: { Tab: React.ReactNode }) => {
type: 'danger', type: 'danger',
icon: 'delete', icon: 'delete',
label: t('common:common.Delete'), label: t('common:common.Delete'),
onClick: () => onDeleteChannel(item.id) onClick: () =>
openConfirm(
() => onDeleteChannel(item.id),
undefined,
t('account_model:confirm_delete_channel', {
name: item.name
})
)()
} }
] ]
} }
@@ -238,6 +249,7 @@ const ChannelTable = ({ Tab }: { Tab: React.ReactNode }) => {
{!!modelTestData && ( {!!modelTestData && (
<ModelTest {...modelTestData} onClose={() => setTestModelData(undefined)} /> <ModelTest {...modelTestData} onClose={() => setTestModelData(undefined)} />
)} )}
<ConfirmModal />
</> </>
); );
}; };

View File

@@ -197,7 +197,7 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => {
/> />
</Box> </Box>
</HStack> </HStack>
<HStack flex={'0 0 200px'}> <HStack>
<FormLabel>{t('account_model:channel_name')}</FormLabel> <FormLabel>{t('account_model:channel_name')}</FormLabel>
<Box flex={'1 0 0'}> <Box flex={'1 0 0'}>
<MySelect<string> <MySelect<string>
@@ -210,7 +210,7 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => {
/> />
</Box> </Box>
</HStack> </HStack>
<HStack flex={'0 0 200px'}> <HStack>
<FormLabel>{t('account_model:model_name')}</FormLabel> <FormLabel>{t('account_model:model_name')}</FormLabel>
<Box flex={'1 0 0'}> <Box flex={'1 0 0'}>
<MySelect<string> <MySelect<string>

View File

@@ -34,9 +34,9 @@ const PreviewData = () => {
const [previewFile, setPreviewFile] = useState<ImportSourceItemType>(); const [previewFile, setPreviewFile] = useState<ImportSourceItemType>();
const { data = [], loading: isLoading } = useRequest2( const { data = { chunks: [], total: 0 }, loading: isLoading } = useRequest2(
async () => { async () => {
if (!previewFile) return; if (!previewFile) return { chunks: [], total: 0 };
if (importSource === ImportDataSourceEnum.fileCustom) { if (importSource === ImportDataSourceEnum.fileCustom) {
const chunkSplitter = processParamsForm.getValues('chunkSplitter'); const chunkSplitter = processParamsForm.getValues('chunkSplitter');
const { chunks } = splitText2Chunks({ const { chunks } = splitText2Chunks({
@@ -46,10 +46,13 @@ const PreviewData = () => {
overlapRatio: chunkOverlapRatio, overlapRatio: chunkOverlapRatio,
customReg: chunkSplitter ? [chunkSplitter] : [] customReg: chunkSplitter ? [chunkSplitter] : []
}); });
return chunks.map((chunk) => ({ return {
q: chunk, chunks: chunks.map((chunk) => ({
a: '' q: chunk,
})); a: ''
})),
total: chunks.length
};
} }
return getPreviewChunks({ return getPreviewChunks({
@@ -81,7 +84,7 @@ const PreviewData = () => {
manual: false, manual: false,
onSuccess(result) { onSuccess(result) {
if (!previewFile) return; if (!previewFile) return;
if (!result || result.length === 0) { if (!result || result.total === 0) {
toast({ toast({
title: t('dataset:preview_chunk_empty'), title: t('dataset:preview_chunk_empty'),
status: 'error' status: 'error'
@@ -130,14 +133,14 @@ const PreviewData = () => {
<Flex py={4} px={5} borderBottom={'base'} justifyContent={'space-between'}> <Flex py={4} px={5} borderBottom={'base'} justifyContent={'space-between'}>
<FormLabel fontSize={'md'}>{t('dataset:preview_chunk')}</FormLabel> <FormLabel fontSize={'md'}>{t('dataset:preview_chunk')}</FormLabel>
<Box fontSize={'xs'} color={'myGray.500'}> <Box fontSize={'xs'} color={'myGray.500'}>
{t('dataset:preview_chunk_intro')} {t('dataset:preview_chunk_intro', { total: data.total })}
</Box> </Box>
</Flex> </Flex>
<MyBox isLoading={isLoading} flex={'1 0 0'} h={0}> <MyBox isLoading={isLoading} flex={'1 0 0'} h={0}>
<Box h={'100%'} overflowY={'auto'} px={5} py={3}> <Box h={'100%'} overflowY={'auto'} px={5} py={3}>
{previewFile ? ( {previewFile ? (
<> <>
{data.map((item, index) => ( {data.chunks.map((item, index) => (
<Box <Box
key={index} key={index}
fontSize={'sm'} fontSize={'sm'}

View File

@@ -35,11 +35,17 @@ async function handler(
if (!modelData) return Promise.reject('Model not found'); if (!modelData) return Promise.reject('Model not found');
if (channelId) {
delete modelData.requestUrl;
delete modelData.requestAuth;
}
const headers: Record<string, string> = channelId const headers: Record<string, string> = channelId
? { ? {
'Aiproxy-Channel': String(channelId) 'Aiproxy-Channel': String(channelId)
} }
: {}; : {};
addLog.debug(`Test model`, modelData);
if (modelData.type === 'llm') { if (modelData.type === 'llm') {
return testLLMModel(modelData, headers); return testLLMModel(modelData, headers);
@@ -63,10 +69,6 @@ async function handler(
export default NextAPI(handler); export default NextAPI(handler);
const testLLMModel = async (model: LLMModelItemType, headers: Record<string, string>) => { const testLLMModel = async (model: LLMModelItemType, headers: Record<string, string>) => {
const ai = getAIApi({
timeout: 10000
});
const requestBody = llmCompletionsBodyFormat( const requestBody = llmCompletionsBodyFormat(
{ {
model: model.model, model: model.model,
@@ -75,6 +77,7 @@ const testLLMModel = async (model: LLMModelItemType, headers: Record<string, str
}, },
model model
); );
const { response, isStreamResponse } = await createChatCompletion({ const { response, isStreamResponse } = await createChatCompletion({
body: requestBody, body: requestBody,
options: { options: {
@@ -144,7 +147,7 @@ const testTTSModel = async (model: TTSModelType, headers: Record<string, string>
const testSTTModel = async (model: STTModelType, headers: Record<string, string>) => { const testSTTModel = async (model: STTModelType, headers: Record<string, string>) => {
const path = isProduction ? '/app/data/test.mp3' : 'data/test.mp3'; const path = isProduction ? '/app/data/test.mp3' : 'data/test.mp3';
const { text } = await aiTranscriptions({ const { text } = await aiTranscriptions({
model: model.model, model,
fileStream: fs.createReadStream(path), fileStream: fs.createReadStream(path),
headers headers
}); });

View File

@@ -43,9 +43,12 @@ export type PostPreviewFilesChunksProps = {
externalFileId?: string; externalFileId?: string;
}; };
export type PreviewChunksResponse = { export type PreviewChunksResponse = {
q: string; chunks: {
a: string; q: string;
}[]; a: string;
}[];
total: number;
};
async function handler( async function handler(
req: ApiRequestProps<PostPreviewFilesChunksProps> req: ApiRequestProps<PostPreviewFilesChunksProps>
@@ -123,13 +126,17 @@ async function handler(
customPdfParse customPdfParse
}); });
return rawText2Chunks({ const chunks = rawText2Chunks({
rawText, rawText,
chunkSize, chunkSize,
maxSize: getLLMMaxChunkSize(getLLMModel(dataset.agentModel)), maxSize: getLLMMaxChunkSize(getLLMModel(dataset.agentModel)),
overlapRatio, overlapRatio,
customReg: chunkSplitter ? [chunkSplitter] : [], customReg: chunkSplitter ? [chunkSplitter] : [],
isQAImport: isQAImport isQAImport: isQAImport
}).slice(0, 10); });
return {
chunks: chunks.slice(0, 10),
total: chunks.length
};
} }
export default NextAPI(handler); export default NextAPI(handler);

View File

@@ -66,7 +66,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
// } // }
const result = await aiTranscriptions({ const result = await aiTranscriptions({
model: getDefaultSTTModel().model, model: getDefaultSTTModel(),
fileStream: fs.createReadStream(file.path) fileStream: fs.createReadStream(file.path)
}); });