mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 04:06:18 +00:00
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:
@@ -3,21 +3,25 @@ import { getAxiosConfig } from '../config';
|
||||
import axios from 'axios';
|
||||
import FormData from 'form-data';
|
||||
import { getSTTModel } from '../model';
|
||||
import { STTModelType } from '@fastgpt/global/core/ai/model.d';
|
||||
|
||||
export const aiTranscriptions = async ({
|
||||
model,
|
||||
model: modelData,
|
||||
fileStream,
|
||||
headers
|
||||
}: {
|
||||
model: string;
|
||||
model: STTModelType;
|
||||
fileStream: fs.ReadStream;
|
||||
headers?: Record<string, string>;
|
||||
}) => {
|
||||
if (!modelData) {
|
||||
return Promise.reject('no model');
|
||||
}
|
||||
|
||||
const data = new FormData();
|
||||
data.append('model', model);
|
||||
data.append('model', modelData.model);
|
||||
data.append('file', fileStream);
|
||||
|
||||
const modelData = getSTTModel(model);
|
||||
const aiAxiosConfig = getAxiosConfig();
|
||||
|
||||
const { data: result } = await axios<{ text: string }>({
|
||||
|
@@ -37,11 +37,12 @@ export async function splitCombinePluginId(id: string) {
|
||||
return { source, pluginId: id };
|
||||
}
|
||||
|
||||
type ChildAppType = SystemPluginTemplateItemType & { teamId?: string };
|
||||
type ChildAppType = SystemPluginTemplateItemType & { teamId?: string; tmbId?: string };
|
||||
|
||||
const getSystemPluginTemplateById = async (
|
||||
pluginId: string,
|
||||
versionId?: string
|
||||
): Promise<SystemPluginTemplateItemType> => {
|
||||
): Promise<ChildAppType> => {
|
||||
const item = getSystemPluginTemplates().find((plugin) => plugin.id === pluginId);
|
||||
if (!item) return Promise.reject(PluginErrEnum.unAuth);
|
||||
|
||||
@@ -67,12 +68,17 @@ const getSystemPluginTemplateById = async (
|
||||
: await getAppLatestVersion(plugin.associatedPluginId, app);
|
||||
if (!version.versionId) return Promise.reject('App version not found');
|
||||
|
||||
plugin.workflow = {
|
||||
nodes: version.nodes,
|
||||
edges: version.edges,
|
||||
chatConfig: version.chatConfig
|
||||
return {
|
||||
...plugin,
|
||||
workflow: {
|
||||
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;
|
||||
};
|
||||
@@ -168,6 +174,7 @@ export async function getChildAppRuntimeById(
|
||||
return {
|
||||
id: String(item._id),
|
||||
teamId: String(item.teamId),
|
||||
tmbId: String(item.tmbId),
|
||||
name: item.name,
|
||||
avatar: item.avatar,
|
||||
intro: item.intro,
|
||||
@@ -187,6 +194,7 @@ export async function getChildAppRuntimeById(
|
||||
pluginOrder: 0
|
||||
};
|
||||
} else {
|
||||
// System
|
||||
return getSystemPluginTemplateById(pluginId, versionId);
|
||||
}
|
||||
})();
|
||||
@@ -194,6 +202,7 @@ export async function getChildAppRuntimeById(
|
||||
return {
|
||||
id: app.id,
|
||||
teamId: app.teamId,
|
||||
tmbId: app.tmbId,
|
||||
name: app.name,
|
||||
avatar: app.avatar,
|
||||
showStatus: app.showStatus,
|
||||
|
@@ -88,9 +88,9 @@ export const dispatchRunPlugin = async (props: RunPluginProps): Promise<RunPlugi
|
||||
: {}),
|
||||
runningAppInfo: {
|
||||
id: String(plugin.id),
|
||||
// 如果是系统插件,则使用当前团队的 teamId 和 tmbId
|
||||
// 如果系统插件有 teamId 和 tmbId,则使用系统插件的 teamId 和 tmbId(管理员指定了插件作为系统插件)
|
||||
teamId: plugin.teamId || runningAppInfo.teamId,
|
||||
tmbId: pluginData?.tmbId || runningAppInfo.tmbId
|
||||
tmbId: plugin.tmbId || runningAppInfo.tmbId
|
||||
},
|
||||
variables: runtimeVariables,
|
||||
query: getPluginRunUserQuery({
|
||||
|
Reference in New Issue
Block a user