Commit e97332a7 by YeYuheng Committed by GitHub

feat: support multimodal LLM inputs (#6967)

* feat: support multimodal LLM inputs

- add model capability config for vision, audio, and video inputs
- wire multimodal flags through simple app, chat agent, and workflow LLM nodes
- normalize uploaded files and file links into image/audio/video request parts
- adapt chat, agent, and toolcall runtime context for multimodal messages
- add capability tags, i18n entries, design docs, and related tests

* perf: code

* test: update agent file prompt assertion

---------

Co-authored-by: archer <545436317@qq.com>
parent 19b18a50
...@@ -5,6 +5,8 @@ description: 'FastGPT V4.15.0-beta3 更新说明' ...@@ -5,6 +5,8 @@ description: 'FastGPT V4.15.0-beta3 更新说明'
## 🚀 新增内容 ## 🚀 新增内容
1. 多模态模型支持音视频输入。
## ⚙️ 优化 ## ⚙️ 优化
## 🐛 修复 ## 🐛 修复
......
...@@ -11,3 +11,7 @@ export const datasetImageCollectionFileType = '.jpg, .jpeg, .png'; ...@@ -11,3 +11,7 @@ export const datasetImageCollectionFileType = '.jpg, .jpeg, .png';
export const imageFileType = export const imageFileType =
'.jpg, .jpeg, .png, .gif, .bmp, .webp, .svg, .tiff, .tif, .ico, .heic, .heif, .avif, .raw, .cr2, .nef, .arw, .dng, .psd, .ai, .eps, .emf, .wmf, .jfif, .exif, .pgm, .ppm, .pbm, .jp2, .j2k, .jpf, .jpx, .jpm, .mj2, .xbm, .pcx'; '.jpg, .jpeg, .png, .gif, .bmp, .webp, .svg, .tiff, .tif, .ico, .heic, .heif, .avif, .raw, .cr2, .nef, .arw, .dng, .psd, .ai, .eps, .emf, .wmf, .jfif, .exif, .pgm, .ppm, .pbm, .jp2, .j2k, .jpf, .jpx, .jpm, .mj2, .xbm, .pcx';
export const audioFileType = '.mp3, .wav, .ogg, .m4a, .amr, .mpga';
export const videoFileType = '.mp4, .mov, .avi, .mpeg, .webm';
import type openai from 'openai'; import type openai from 'openai';
import type { Stream } from 'openai/streaming'; import type { Stream } from 'openai/streaming';
import { audioFileType } from '../../../common/file/constants';
import z from 'zod'; import z from 'zod';
/* 通用类型 */ /* 通用类型 */
...@@ -59,7 +60,20 @@ export const ChatCompletionContentPartInputAudioSchema = z.object({ ...@@ -59,7 +60,20 @@ export const ChatCompletionContentPartInputAudioSchema = z.object({
type: z.literal('input_audio'), type: z.literal('input_audio'),
input_audio: z.object({ input_audio: z.object({
data: z.string(), data: z.string(),
format: z.enum(['wav', 'mp3']) format: z.enum(
audioFileType
.split(',')
.map((item) => item.trim().replace(/^\./, ''))
.filter(Boolean) as [string, ...string[]]
)
}),
key: z.string().optional()
});
// Qwen-Omni compatible video input branch.
export const ChatCompletionContentPartVideoSchema = z.object({
type: z.literal('video_url'),
video_url: z.object({
url: z.string()
}), }),
key: z.string().optional() key: z.string().optional()
}); });
...@@ -78,12 +92,14 @@ export const ChatCompletionContentPartFileTypeSchema = z.object({ ...@@ -78,12 +92,14 @@ export const ChatCompletionContentPartFileTypeSchema = z.object({
type: z.literal('file_url'), type: z.literal('file_url'),
name: z.string().optional(), name: z.string().optional(),
url: z.string(), url: z.string(),
fileType: z.enum(['file', 'audio', 'video']).optional(),
key: z.string().optional() key: z.string().optional()
}); });
export const ChatCompletionContentPartSchema = z.discriminatedUnion('type', [ export const ChatCompletionContentPartSchema = z.discriminatedUnion('type', [
ChatCompletionContentPartTextSchema, ChatCompletionContentPartTextSchema,
ChatCompletionContentPartImageSchema, ChatCompletionContentPartImageSchema,
ChatCompletionContentPartInputAudioSchema, ChatCompletionContentPartInputAudioSchema,
ChatCompletionContentPartVideoSchema,
ChatCompletionContentPartFileSchema, ChatCompletionContentPartFileSchema,
ChatCompletionContentPartFileTypeSchema ChatCompletionContentPartFileTypeSchema
]); ]);
......
...@@ -11,6 +11,9 @@ export const removeDatasetCiteText = (text: string, retainDatasetCite: boolean) ...@@ -11,6 +11,9 @@ export const removeDatasetCiteText = (text: string, retainDatasetCite: boolean)
export const getLLMSupportParams = (llm?: LLMModelItemType) => { export const getLLMSupportParams = (llm?: LLMModelItemType) => {
return { return {
vision: !!llm?.vision, vision: !!llm?.vision,
audio: !!llm?.audio,
video: !!llm?.video,
multimodal: !!(llm?.vision || llm?.audio || llm?.video),
temperature: typeof llm?.maxTemperature === 'number', temperature: typeof llm?.maxTemperature === 'number',
reasoning: !!llm?.reasoning, reasoning: !!llm?.reasoning,
reasoningEffort: !!llm?.reasoningEffort, reasoningEffort: !!llm?.reasoningEffort,
......
...@@ -66,6 +66,8 @@ export const LLMModelItemSchema = PriceTypeSchema.extend(BaseModelItemSchema.sha ...@@ -66,6 +66,8 @@ export const LLMModelItemSchema = PriceTypeSchema.extend(BaseModelItemSchema.sha
censor: z.boolean().optional(), censor: z.boolean().optional(),
vision: z.boolean().optional(), vision: z.boolean().optional(),
audio: z.boolean().optional(),
video: z.boolean().optional(),
reasoning: z.boolean().optional(), reasoning: z.boolean().optional(),
reasoningEffort: z.boolean().optional(), reasoningEffort: z.boolean().optional(),
......
...@@ -31,6 +31,10 @@ export const AppFormEditFormV1TypeSchema = z.object({ ...@@ -31,6 +31,10 @@ export const AppFormEditFormV1TypeSchema = z.object({
[NodeInputKeyEnum.aiChatMaxToken]: z.number().optional(), [NodeInputKeyEnum.aiChatMaxToken]: z.number().optional(),
[NodeInputKeyEnum.aiChatIsResponseText]: z.boolean(), [NodeInputKeyEnum.aiChatIsResponseText]: z.boolean(),
maxHistories: z.int().min(0).max(100), maxHistories: z.int().min(0).max(100),
[NodeInputKeyEnum.aiChatVision]: z.boolean().optional(),
[NodeInputKeyEnum.aiChatAudio]: z.boolean().optional(),
[NodeInputKeyEnum.aiChatVideo]: z.boolean().optional(),
[NodeInputKeyEnum.aiChatExtractFiles]: z.boolean().optional(),
[NodeInputKeyEnum.aiChatReasoning]: z.boolean().optional(), [NodeInputKeyEnum.aiChatReasoning]: z.boolean().optional(),
[NodeInputKeyEnum.aiChatReasoningEffort]: z [NodeInputKeyEnum.aiChatReasoningEffort]: z
.enum(['none', 'minimal', 'low', 'medium', 'high', 'xhigh']) .enum(['none', 'minimal', 'low', 'medium', 'high', 'xhigh'])
......
...@@ -180,6 +180,9 @@ export type SettingAIDataType = { ...@@ -180,6 +180,9 @@ export type SettingAIDataType = {
isResponseAnswerText?: boolean; isResponseAnswerText?: boolean;
maxHistories?: number; maxHistories?: number;
[NodeInputKeyEnum.aiChatVision]?: boolean; // Is open vision mode [NodeInputKeyEnum.aiChatVision]?: boolean; // Is open vision mode
[NodeInputKeyEnum.aiChatAudio]?: boolean; // Is open audio recognition mode
[NodeInputKeyEnum.aiChatVideo]?: boolean; // Is open video recognition mode
[NodeInputKeyEnum.aiChatExtractFiles]?: boolean; // Parse multimodal links from user question
[NodeInputKeyEnum.aiChatReasoning]?: boolean; // Is open reasoning mode [NodeInputKeyEnum.aiChatReasoning]?: boolean; // Is open reasoning mode
[NodeInputKeyEnum.aiChatReasoningEffort]?: ReasoningEffort; [NodeInputKeyEnum.aiChatReasoningEffort]?: ReasoningEffort;
[NodeInputKeyEnum.aiChatTopP]?: number; [NodeInputKeyEnum.aiChatTopP]?: number;
......
...@@ -20,6 +20,28 @@ import type { ...@@ -20,6 +20,28 @@ import type {
} from '../ai/llm/type'; } from '../ai/llm/type';
import { ChatCompletionRequestMessageRoleEnum } from '../../core/ai/constants'; import { ChatCompletionRequestMessageRoleEnum } from '../../core/ai/constants';
type FileUrlChatFileType = ChatFileTypeEnum.file | ChatFileTypeEnum.audio | ChatFileTypeEnum.video;
type FileUrlContentPart = Extract<ChatCompletionContentPart, { type: 'file_url' }>;
type FileUrlContentFileType = NonNullable<FileUrlContentPart['fileType']>;
const fileUrlChatFileTypeSet = new Set<ChatFileTypeEnum>([
ChatFileTypeEnum.file,
ChatFileTypeEnum.audio,
ChatFileTypeEnum.video
]);
export const isFileUrlChatFileType = (type?: ChatFileTypeEnum): type is FileUrlChatFileType =>
!!type && fileUrlChatFileTypeSet.has(type);
const fileUrlType2ChatFileType: Record<FileUrlContentFileType, FileUrlChatFileType> = {
file: ChatFileTypeEnum.file,
audio: ChatFileTypeEnum.audio,
video: ChatFileTypeEnum.video
};
const getFileUrlChatFileType = (fileType?: FileUrlContentFileType) =>
fileUrlType2ChatFileType[fileType || 'file'];
export const GPT2Chat = { export const GPT2Chat = {
[ChatCompletionRequestMessageRoleEnum.System]: ChatRoleEnum.System, [ChatCompletionRequestMessageRoleEnum.System]: ChatRoleEnum.System,
[ChatCompletionRequestMessageRoleEnum.Developer]: ChatRoleEnum.System, [ChatCompletionRequestMessageRoleEnum.Developer]: ChatRoleEnum.System,
...@@ -273,11 +295,12 @@ export const chats2GPTMessages = ({ ...@@ -273,11 +295,12 @@ export const chats2GPTMessages = ({
url: item.file.url url: item.file.url
} }
}; };
} else if (item.file?.type === ChatFileTypeEnum.file) { } else if (isFileUrlChatFileType(item.file?.type)) {
return { return {
type: 'file_url', type: 'file_url',
name: item.file?.name || '', name: item.file?.name || '',
url: item.file.url, url: item.file.url,
fileType: item.file.type,
key: item.file.key key: item.file.key
}; };
} }
...@@ -587,7 +610,7 @@ export const GPTMessages2Chats = ({ ...@@ -587,7 +610,7 @@ export const GPTMessages2Chats = ({
} else if (item.type === 'file_url') { } else if (item.type === 'file_url') {
value.push({ value.push({
file: { file: {
type: ChatFileTypeEnum.file, type: getFileUrlChatFileType(item.fileType),
name: item.name || '', name: item.name || '',
url: item.url, url: item.url,
key: item.key key: item.key
......
...@@ -19,6 +19,8 @@ export const ChatRoleMap = { ...@@ -19,6 +19,8 @@ export const ChatRoleMap = {
export enum ChatFileTypeEnum { export enum ChatFileTypeEnum {
image = 'image', image = 'image',
audio = 'audio',
video = 'video',
file = 'file' file = 'file'
} }
......
...@@ -2,7 +2,7 @@ import { ChatCompletionRequestMessageRoleEnum } from '../../ai/constants'; ...@@ -2,7 +2,7 @@ import { ChatCompletionRequestMessageRoleEnum } from '../../ai/constants';
import type { ChatCompletionContentPart, ChatCompletionMessageParam } from '../../ai/llm/type'; import type { ChatCompletionContentPart, ChatCompletionMessageParam } from '../../ai/llm/type';
import { ChatFileTypeEnum, ChatRoleEnum } from '../constants'; import { ChatFileTypeEnum, ChatRoleEnum } from '../constants';
import type { HelperBotChatItemType } from './type'; import type { HelperBotChatItemType } from './type';
import { simpleUserContentPart } from '../adapt'; import { isFileUrlChatFileType, simpleUserContentPart } from '../adapt';
export const helperChats2GPTMessages = ({ export const helperChats2GPTMessages = ({
messages messages
...@@ -38,11 +38,12 @@ export const helperChats2GPTMessages = ({ ...@@ -38,11 +38,12 @@ export const helperChats2GPTMessages = ({
url: item.file.url url: item.file.url
} }
}; };
} else if (item.file?.type === ChatFileTypeEnum.file) { } else if (isFileUrlChatFileType(item.file?.type)) {
return { return {
type: 'file_url', type: 'file_url',
name: item.file?.name || '', name: item.file?.name || '',
url: item.file.url, url: item.file.url,
fileType: item.file.type,
key: item.file.key key: item.file.key
}; };
} }
......
...@@ -161,6 +161,9 @@ export enum NodeInputKeyEnum { ...@@ -161,6 +161,9 @@ export enum NodeInputKeyEnum {
aiChatQuotePrompt = 'quotePrompt', aiChatQuotePrompt = 'quotePrompt',
aiChatDatasetQuote = 'quoteQA', aiChatDatasetQuote = 'quoteQA',
aiChatVision = 'aiChatVision', aiChatVision = 'aiChatVision',
aiChatAudio = 'aiChatAudio',
aiChatVideo = 'aiChatVideo',
aiChatExtractFiles = 'aiChatExtractFiles',
stringQuoteText = 'stringQuoteText', stringQuoteText = 'stringQuoteText',
aiChatReasoning = 'aiChatReasoning', aiChatReasoning = 'aiChatReasoning',
aiChatReasoningEffort = 'aiChatReasoningEffort', aiChatReasoningEffort = 'aiChatReasoningEffort',
......
...@@ -390,6 +390,9 @@ export type AIChatNodeProps = { ...@@ -390,6 +390,9 @@ export type AIChatNodeProps = {
[NodeInputKeyEnum.aiChatMaxToken]?: number; [NodeInputKeyEnum.aiChatMaxToken]?: number;
[NodeInputKeyEnum.aiChatIsResponseText]: boolean; [NodeInputKeyEnum.aiChatIsResponseText]: boolean;
[NodeInputKeyEnum.aiChatVision]?: boolean; [NodeInputKeyEnum.aiChatVision]?: boolean;
[NodeInputKeyEnum.aiChatAudio]?: boolean;
[NodeInputKeyEnum.aiChatVideo]?: boolean;
[NodeInputKeyEnum.aiChatExtractFiles]?: boolean;
[NodeInputKeyEnum.aiChatReasoning]?: boolean; [NodeInputKeyEnum.aiChatReasoning]?: boolean;
[NodeInputKeyEnum.aiChatReasoningEffort]?: ReasoningEffort; [NodeInputKeyEnum.aiChatReasoningEffort]?: ReasoningEffort;
[NodeInputKeyEnum.aiChatTopP]?: number; [NodeInputKeyEnum.aiChatTopP]?: number;
......
...@@ -65,6 +65,27 @@ export const AgentNode: FlowNodeTemplateType = { ...@@ -65,6 +65,27 @@ export const AgentNode: FlowNodeTemplateType = {
value: true value: true
}, },
{ {
key: NodeInputKeyEnum.aiChatAudio,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: false
},
{
key: NodeInputKeyEnum.aiChatVideo,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: false
},
{
key: NodeInputKeyEnum.aiChatExtractFiles,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: true
},
{
key: NodeInputKeyEnum.aiChatReasoning, key: NodeInputKeyEnum.aiChatReasoning,
renderTypeList: [FlowNodeInputTypeEnum.hidden], renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '', label: '',
......
...@@ -92,6 +92,27 @@ export const AiChatModule: FlowNodeTemplateType = { ...@@ -92,6 +92,27 @@ export const AiChatModule: FlowNodeTemplateType = {
value: true value: true
}, },
{ {
key: NodeInputKeyEnum.aiChatAudio,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: false
},
{
key: NodeInputKeyEnum.aiChatVideo,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: false
},
{
key: NodeInputKeyEnum.aiChatExtractFiles,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: true
},
{
key: NodeInputKeyEnum.aiChatReasoning, key: NodeInputKeyEnum.aiChatReasoning,
renderTypeList: [FlowNodeInputTypeEnum.hidden], renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '', label: '',
......
...@@ -65,6 +65,27 @@ export const ToolCallNode: FlowNodeTemplateType = { ...@@ -65,6 +65,27 @@ export const ToolCallNode: FlowNodeTemplateType = {
value: true value: true
}, },
{ {
key: NodeInputKeyEnum.aiChatAudio,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: false
},
{
key: NodeInputKeyEnum.aiChatVideo,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: false
},
{
key: NodeInputKeyEnum.aiChatExtractFiles,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: true
},
{
key: NodeInputKeyEnum.aiChatReasoning, key: NodeInputKeyEnum.aiChatReasoning,
renderTypeList: [FlowNodeInputTypeEnum.hidden], renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '', label: '',
......
...@@ -41,13 +41,17 @@ describe('ChatRoleMap', () => { ...@@ -41,13 +41,17 @@ describe('ChatRoleMap', () => {
describe('ChatFileTypeEnum', () => { describe('ChatFileTypeEnum', () => {
it('should have correct file type values', () => { it('should have correct file type values', () => {
expect(ChatFileTypeEnum.image).toBe('image'); expect(ChatFileTypeEnum.image).toBe('image');
expect(ChatFileTypeEnum.audio).toBe('audio');
expect(ChatFileTypeEnum.video).toBe('video');
expect(ChatFileTypeEnum.file).toBe('file'); expect(ChatFileTypeEnum.file).toBe('file');
}); });
it('should have all expected file types', () => { it('should have all expected file types', () => {
const types = Object.values(ChatFileTypeEnum); const types = Object.values(ChatFileTypeEnum);
expect(types).toHaveLength(2); expect(types).toHaveLength(4);
expect(types).toContain('image'); expect(types).toContain('image');
expect(types).toContain('audio');
expect(types).toContain('video');
expect(types).toContain('file'); expect(types).toContain('file');
}); });
}); });
......
...@@ -104,6 +104,9 @@ export type AgentLoopRuntime = { ...@@ -104,6 +104,9 @@ export type AgentLoopRuntime = {
userKey?: CreateLLMResponseProps['userKey']; userKey?: CreateLLMResponseProps['userKey'];
stream?: boolean; stream?: boolean;
useVision?: boolean; useVision?: boolean;
useAudio?: boolean;
useVideo?: boolean;
extractFiles?: boolean;
maxRunAgentTimes?: number; maxRunAgentTimes?: number;
batchToolSize?: number; batchToolSize?: number;
maxStopGateRejections?: number; maxStopGateRejections?: number;
......
...@@ -179,6 +179,9 @@ export const runUnifiedAgentLoop = async ({ ...@@ -179,6 +179,9 @@ export const runUnifiedAgentLoop = async ({
reasoning_effort: runtime.reasoningEffort, reasoning_effort: runtime.reasoningEffort,
stream: runtime.stream ?? true, stream: runtime.stream ?? true,
useVision: runtime.useVision, useVision: runtime.useVision,
useAudio: runtime.useAudio,
useVideo: runtime.useVideo,
extractFiles: runtime.extractFiles,
messages, messages,
tools: getToolsForUnifiedLoop({ tools: getToolsForUnifiedLoop({
catalog: runtime.toolCatalog catalog: runtime.toolCatalog
......
...@@ -37,13 +37,16 @@ export const createLLMResponse = async <T extends ChatCompletionCreateParams>( ...@@ -37,13 +37,16 @@ export const createLLMResponse = async <T extends ChatCompletionCreateParams>(
const requestId = createLLMRequestId(); const requestId = createLLMRequestId();
const { throwError = true, body, custonHeaders, userKey, maxContinuations = 1 } = args; const { throwError = true, body, custonHeaders, userKey, maxContinuations = 1 } = args;
const { messages, useVision, tools, toolCallMode } = body; const { messages, useVision, useAudio, useVideo, extractFiles, tools, toolCallMode } = body;
const model = getLLMModel(body.model); const model = getLLMModel(body.model);
// 先把 messages 中的文件/图片等 FastGPT 扩展结构加载成模型可直接消费的消息。 // 先把 messages 中的文件/图片等 FastGPT 扩展结构加载成模型可直接消费的消息。
const requestMessages = await loadRequestMessages({ const requestMessages = await loadRequestMessages({
messages, messages,
useVision: useVision && model.vision, useVision: useVision && model.vision,
useAudio: useAudio && model.audio,
useVideo: useVideo && model.video,
extractFiles,
supportReason: model.reasoning supportReason: model.reasoning
}); });
const rewriteMessages = (() => { const rewriteMessages = (() => {
......
...@@ -25,6 +25,9 @@ export const llmCompletionsBodyFormat = async <T extends ChatCompletionCreatePar ...@@ -25,6 +25,9 @@ export const llmCompletionsBodyFormat = async <T extends ChatCompletionCreatePar
// 这些字段只影响 FastGPT 自身逻辑,不能透传给模型供应商。 // 这些字段只影响 FastGPT 自身逻辑,不能透传给模型供应商。
delete body.retainDatasetCite; delete body.retainDatasetCite;
delete body.useVision; delete body.useVision;
delete body.useAudio;
delete body.useVideo;
delete body.extractFiles;
delete body.requestOrigin; delete body.requestOrigin;
const modelData = getLLMModel(body.model); const modelData = getLLMModel(body.model);
......
...@@ -49,6 +49,9 @@ export type LLMRequestBodyType<T> = Omit< ...@@ -49,6 +49,9 @@ export type LLMRequestBodyType<T> = Omit<
retainDatasetCite?: boolean; retainDatasetCite?: boolean;
toolCallMode?: 'toolChoice' | 'prompt'; toolCallMode?: 'toolChoice' | 'prompt';
useVision?: boolean; useVision?: boolean;
useAudio?: boolean;
useVideo?: boolean;
extractFiles?: boolean;
requestOrigin?: string; requestOrigin?: string;
}; };
......
...@@ -7,6 +7,63 @@ export const createLLMRequestId = () => { ...@@ -7,6 +7,63 @@ export const createLLMRequestId = () => {
return getNanoid(12); return getNanoid(12);
}; };
const base64OmittedPlaceholder = '[base64 omitted]';
const dataUrlBase64Regex = /data:([^,]*;base64,)([A-Za-z0-9+/=_-]{32,})/g;
const fullBase64Regex = /^[A-Za-z0-9+/=_-]+$/;
const base64LikeKeySet = new Set(['base64', 'data']);
const isBase64LikeString = (value: string) => {
const text = value.trim();
return text.length >= 256 && fullBase64Regex.test(text);
};
const sanitizeString = (value: string, key?: string) => {
const sanitizedDataUrl = value.replace(
dataUrlBase64Regex,
(_match, prefix: string) => `data:${prefix}${base64OmittedPlaceholder}`
);
if (base64LikeKeySet.has(key?.toLowerCase() ?? '') && isBase64LikeString(sanitizedDataUrl)) {
return base64OmittedPlaceholder;
}
return isBase64LikeString(sanitizedDataUrl) ? base64OmittedPlaceholder : sanitizedDataUrl;
};
/**
* 清洗 LLM 请求记录快照中的 base64 内容,避免大文件或图片音频原文落库。
* 只用于记录入库前的副本,不参与真实模型请求、token 统计或响应解析。
*/
export const sanitizeLLMRequestRecordPayload = <T>(payload: T, key?: string): T => {
if (typeof payload === 'string') {
return sanitizeString(payload, key) as T;
}
if (!payload || typeof payload !== 'object') {
return payload;
}
if (payload instanceof Date) {
return payload;
}
if (Buffer.isBuffer(payload)) {
return base64OmittedPlaceholder as T;
}
if (Array.isArray(payload)) {
return payload.map((item) => sanitizeLLMRequestRecordPayload(item)) as T;
}
return Object.fromEntries(
Object.entries(payload).map(([entryKey, entryValue]) => [
entryKey,
sanitizeLLMRequestRecordPayload(entryValue, entryKey)
])
) as T;
};
/** /**
* 保存 LLM 请求追踪记录(异步,不阻塞主流程) * 保存 LLM 请求追踪记录(异步,不阻塞主流程)
* @param params - 包含 requestId, body, response 的对象 * @param params - 包含 requestId, body, response 的对象
...@@ -19,8 +76,8 @@ export const saveLLMRequestRecord = async (params: { ...@@ -19,8 +76,8 @@ export const saveLLMRequestRecord = async (params: {
try { try {
await MongoLLMRequestRecord.create({ await MongoLLMRequestRecord.create({
requestId: params.requestId, requestId: params.requestId,
body: params.body, body: sanitizeLLMRequestRecordPayload(params.body),
response: params.response response: sanitizeLLMRequestRecordPayload(params.response)
}); });
} catch (error) { } catch (error) {
// 记录错误但不影响主流程 // 记录错误但不影响主流程
......
import { imageFileType } from '@fastgpt/global/common/file/constants'; import { audioFileType, imageFileType, videoFileType } from '@fastgpt/global/common/file/constants';
import { ChatFileTypeEnum } from '@fastgpt/global/core/chat/constants'; import { ChatFileTypeEnum } from '@fastgpt/global/core/chat/constants';
import type { ChatFileStoreValue } from '@fastgpt/global/core/chat/type'; import type { ChatFileStoreValue } from '@fastgpt/global/core/chat/type';
import path from 'path'; import path from 'path';
...@@ -10,8 +10,18 @@ export type RawChatFileValue = { ...@@ -10,8 +10,18 @@ export type RawChatFileValue = {
type?: ChatFileTypeEnum; type?: ChatFileTypeEnum;
}; };
/**
* 前端或历史数据里的文件对象可能携带预览态、上传态等额外字段。
* 这里允许 object 是为了让 `ChatFileValueInput` 表达“可清洗输入”,实际落库前会被裁剪。
*/
type ChatFileInputFieldValue = string | number | boolean | object | null | undefined; type ChatFileInputFieldValue = string | number | boolean | object | null | undefined;
/**
* 文件变量的外部输入形态。
*
* 业务上只关心 key/url/name/type,但历史数据、插件表单和前端上传组件可能带入额外字段。
* 后续统一通过 `parseRawChatFileValue` 白名单提取,避免把临时状态或渲染字段写入 chat variables。
*/
export type ChatFileValueInput = { export type ChatFileValueInput = {
key?: string; key?: string;
url?: string; url?: string;
...@@ -20,33 +30,21 @@ export type ChatFileValueInput = { ...@@ -20,33 +30,21 @@ export type ChatFileValueInput = {
[key: string]: ChatFileInputFieldValue; [key: string]: ChatFileInputFieldValue;
}; };
/**
* 工作流运行时的 file 变量形态。
*
* string 表示节点运行期直接可访问的 URL;对象表示从前端/API/历史变量传入的文件描述。
* 持久化时不会直接保存运行时 URL,而是尽量还原成 `ChatFileStoreValue`。
*/
export type ChatFileRuntimeValueItem = string | RawChatFileValue; export type ChatFileRuntimeValueItem = string | RawChatFileValue;
export type ChatFileRuntimeValue = ChatFileRuntimeValueItem[]; export type ChatFileRuntimeValue = ChatFileRuntimeValueItem[];
/** 根据文件名扩展名判断是否按图片类型处理。 */ /**
const isImageFilename = (filename?: string) => { * 判断值是否是可解析的文件对象,数组和空值不参与文件存储清洗。
if (!filename) return false; *
return imageFileType.includes(path.extname(filename).toLowerCase()); * 只要包含 key、url 或明确的文件 type,就认为它可能是历史/前端传入的文件对象。
}; * 真正可落库的最小字段会在 normalize 阶段再次校验,保证这里不会误写无效对象。
*/
/** 从文件名推断聊天文件类型,无法识别时统一兜底为普通文件。 */
const inferChatFileType = (filename?: string): ChatFileTypeEnum =>
isImageFilename(filename) ? ChatFileTypeEnum.image : ChatFileTypeEnum.file;
/** 从 S3 object key 中提取稳定文件名。 */
const inferChatFileNameFromKey = (key: string) => path.basename(key) || 'file';
/** 从外部 URL pathname 中提取文件名,非法 URL 则保留原始字符串。 */
const inferChatFileNameFromUrl = (url: string) => {
try {
const urlObj = new URL(url);
return path.basename(decodeURIComponent(urlObj.pathname)) || url;
} catch {
return url;
}
};
/** 判断值是否是可解析的文件对象,数组和空值不参与文件存储清洗。 */
const isChatFileValueInput = (value: unknown): value is ChatFileValueInput => const isChatFileValueInput = (value: unknown): value is ChatFileValueInput =>
!!value && !!value &&
typeof value === 'object' && typeof value === 'object' &&
...@@ -55,22 +53,37 @@ const isChatFileValueInput = (value: unknown): value is ChatFileValueInput => ...@@ -55,22 +53,37 @@ const isChatFileValueInput = (value: unknown): value is ChatFileValueInput =>
(typeof (value as ChatFileValueInput).key === 'string' || (typeof (value as ChatFileValueInput).key === 'string' ||
typeof (value as ChatFileValueInput).url === 'string' || typeof (value as ChatFileValueInput).url === 'string' ||
(value as ChatFileValueInput).type === ChatFileTypeEnum.image || (value as ChatFileValueInput).type === ChatFileTypeEnum.image ||
(value as ChatFileValueInput).type === ChatFileTypeEnum.audio ||
(value as ChatFileValueInput).type === ChatFileTypeEnum.video ||
(value as ChatFileValueInput).type === ChatFileTypeEnum.file); (value as ChatFileValueInput).type === ChatFileTypeEnum.file);
/** 从前端/历史文件对象中只读取文件存储需要的字段。 */ /**
export const parseRawChatFileValue = (file: ChatFileValueInput): RawChatFileValue => { * 从前端/历史文件对象中只读取文件存储需要的字段。
*
* 这是文件变量的第一层清洗:只保留 key/url/name/type,丢弃上传进度、预览地址、
* 前端组件状态等临时字段。type 只接受聊天文件枚举,其他值交给后续扩展名推断。
*/
const parseRawChatFileValue = (file: ChatFileValueInput): RawChatFileValue => {
return { return {
key: typeof file.key === 'string' ? file.key : undefined, key: typeof file.key === 'string' ? file.key : undefined,
url: typeof file.url === 'string' ? file.url : undefined, url: typeof file.url === 'string' ? file.url : undefined,
name: typeof file.name === 'string' ? file.name : undefined, name: typeof file.name === 'string' ? file.name : undefined,
type: type:
file.type === ChatFileTypeEnum.image || file.type === ChatFileTypeEnum.file file.type === ChatFileTypeEnum.image ||
file.type === ChatFileTypeEnum.audio ||
file.type === ChatFileTypeEnum.video ||
file.type === ChatFileTypeEnum.file
? file.type ? file.type
: undefined : undefined
}; };
}; };
/** 校验工作流文件运行值必须是数组,并保留 string URL 或可识别文件对象。 */ /**
* 校验工作流文件运行值必须是数组,并保留 string URL 或可识别文件对象。
*
* 工作流节点约定 file 变量运行态是数组,数组项可以是 URL 字符串或文件对象。
* 不可识别的对象会被过滤;非数组直接抛错,让变量类型错误尽早暴露给调用方。
*/
export const assertChatFileRuntimeValue = ( export const assertChatFileRuntimeValue = (
value: ChatFileRuntimeValueItem[] value: ChatFileRuntimeValueItem[]
): ChatFileRuntimeValue => { ): ChatFileRuntimeValue => {
...@@ -85,12 +98,54 @@ export const assertChatFileRuntimeValue = ( ...@@ -85,12 +98,54 @@ export const assertChatFileRuntimeValue = (
.filter((item): item is ChatFileRuntimeValueItem => Boolean(item)); .filter((item): item is ChatFileRuntimeValueItem => Boolean(item));
}; };
/** 归一化单个文件存储值,确保 key/url 二选一且不会把 data URL 落库。 */ /**
* 归一化单个文件存储值,确保 key/url 二选一且不会把 data URL 落库。
*
* 存储态只支持两类文件:
* - `{ key, name, type }`:FastGPT 私有桶文件,运行时会重新签发临时预览 URL。
* - `{ url, name, type }`:外部可访问 URL,运行时直接复用 URL。
*
* 如果同时存在 key 和 url,优先保存 key,因为 key 可以保持私有桶权限、TTL 和回收语义;
* data URL 只适合作为短期运行态内容,体积大且不可追踪,所以这里直接过滤。
*/
export const normalizeChatFileStoreValue = ( export const normalizeChatFileStoreValue = (
file: RawChatFileValue file: RawChatFileValue
): ChatFileStoreValue | undefined => { ): ChatFileStoreValue | undefined => {
/** 从文件名推断聊天文件类型,无法识别时统一兜底为普通文件。 */
const inferChatFileType = (filename: string): ChatFileTypeEnum => {
const extname = path.extname(filename).toLowerCase();
if (!extname) return ChatFileTypeEnum.file;
if (imageFileType.includes(extname)) return ChatFileTypeEnum.image;
if (audioFileType.includes(extname)) return ChatFileTypeEnum.audio;
if (videoFileType.includes(extname)) return ChatFileTypeEnum.video;
return ChatFileTypeEnum.file;
};
/**
* 从 S3 object key 中提取稳定文件名。
* key 是私有桶里的对象路径,落库时保留 key,展示名只用于 UI 和类型兜底推断。
*/
const inferChatFileNameFromKey = (key: string) => path.basename(key) || 'file';
/**
* 从外部 URL pathname 中提取文件名,非法 URL 则保留原始字符串。
*
* 外链 URL 可能是用户/API 直接传入的完整地址;如果不能按标准 URL 解析,仍保留原值,
* 避免因为名称推断失败导致整个文件变量被丢弃。
*/
const inferChatFileNameFromUrl = (url: string) => {
try {
const urlObj = new URL(url);
return path.basename(decodeURIComponent(urlObj.pathname)) || url;
} catch {
return url;
}
};
const key = file.key || undefined; const key = file.key || undefined;
const rawUrl = file.url || undefined; const rawUrl = file.url || undefined;
// data URL 可能来自多模态节点或前端预览,不能作为长期变量值写入数据库。
const url = rawUrl && !rawUrl.startsWith('data:') ? rawUrl : undefined; const url = rawUrl && !rawUrl.startsWith('data:') ? rawUrl : undefined;
if (!key && !url) return; if (!key && !url) return;
...@@ -103,21 +158,27 @@ export const normalizeChatFileStoreValue = ( ...@@ -103,21 +158,27 @@ export const normalizeChatFileStoreValue = (
return { return {
key, key,
name, name,
type: rawType || inferChatFileType(name || key) // 用户显式传入的 type 优先;缺省时按展示名/对象 key 的扩展名推断。
};
}
if (url) {
const name = rawName || inferChatFileNameFromUrl(url);
return {
url,
name,
type: rawType || inferChatFileType(name) type: rawType || inferChatFileType(name)
}; };
} }
const storeUrl = url as string;
const name = rawName || inferChatFileNameFromUrl(storeUrl);
return {
url: storeUrl,
name,
type: rawType || inferChatFileType(name)
};
}; };
/** 批量归一化文件存储值,过滤非法项和前端渲染字段。 */ /**
* 批量归一化文件存储值,过滤非法项和前端渲染字段。
*
* 聊天保存、变量初始化等入口都可以复用这个函数,把宽松输入收敛成数据库允许的
* `ChatFileStoreValue[]`。默认对非法整体输入返回空数组,兼容历史数据;需要在 API
* 或工作流边界强校验时可通过 `throwOnInvalid` 抛出明确错误。
*/
export const normalizeChatFileStoreValues = ( export const normalizeChatFileStoreValues = (
value: ChatFileValueInput[], value: ChatFileValueInput[],
options?: { throwOnInvalid?: boolean } options?: { throwOnInvalid?: boolean }
......
...@@ -154,6 +154,9 @@ export const createWorkflowAgentLoopRuntime = ({ ...@@ -154,6 +154,9 @@ export const createWorkflowAgentLoopRuntime = ({
userKey: context.externalProvider.openaiAccount, userKey: context.externalProvider.openaiAccount,
stream: context.stream, stream: context.stream,
useVision: context.params.aiChatVision, useVision: context.params.aiChatVision,
useAudio: context.params.aiChatAudio,
useVideo: context.params.aiChatVideo,
extractFiles: context.params.aiChatExtractFiles,
checkIsStopping: context.checkIsStopping, checkIsStopping: context.checkIsStopping,
toolCatalog, toolCatalog,
executeTool: async ({ call }) => { executeTool: async ({ call }) => {
......
...@@ -127,6 +127,9 @@ export function parseAgentInputFiles({ ...@@ -127,6 +127,9 @@ export function parseAgentInputFiles({
.filter(Boolean) as AgentInputFile[]; .filter(Boolean) as AgentInputFile[];
} }
const filterAgentDocumentFiles = (files: AgentInputFile[]) =>
files.filter((file) => file.type === ChatFileTypeEnum.file);
/** /**
* 解析本轮用户输入文件。 * 解析本轮用户输入文件。
* *
...@@ -148,14 +151,16 @@ export function buildCurrentAgentInputFiles({ ...@@ -148,14 +151,16 @@ export function buildCurrentAgentInputFiles({
); );
const currentQueryFilesByUrl = new Map(queryFiles.map((file) => [file.url, file])); const currentQueryFilesByUrl = new Map(queryFiles.map((file) => [file.url, file]));
return parseAgentInputFiles({ return filterAgentDocumentFiles(
files: currentInputFiles.map( parseAgentInputFiles({
(url) => currentQueryFilesByUrl.get(url) || { type: ChatFileTypeEnum.file, url } files: currentInputFiles.map(
), (url) => currentQueryFilesByUrl.get(url) || { type: ChatFileTypeEnum.file, url }
prefixId: currentDataId || getNanoid(), ),
requestOrigin, prefixId: currentDataId || getNanoid(),
maxFiles requestOrigin,
}); maxFiles
})
);
} }
/** /**
...@@ -208,21 +213,17 @@ export const loadAgentDatasetContext = async ( ...@@ -208,21 +213,17 @@ export const loadAgentDatasetContext = async (
/* Prompt */ /* Prompt */
export const buildAgentInputFilesPrompt = (files: AgentInputFile[] = []) => { export const buildAgentInputFilesPrompt = (files: AgentInputFile[] = []) => {
if (files.length === 0) return ''; const documentFiles = filterAgentDocumentFiles(files);
if (documentFiles.length === 0) return '';
const getReadableAgentFileType = (type: `${ChatFileTypeEnum}`) => {
return type === ChatFileTypeEnum.file ? 'document' : 'image';
};
return `## 文件 return `## 文件
用户本次对话上传的的文件, 可通过 ${SubAppIds.readFiles} 读取文件内容: 用户本次对话上传的的文件, 可通过 ${SubAppIds.readFiles} 读取文件内容:
${files ${documentFiles
.map( .map(
(file) => `<file> (file) => `<file>
<id>${escapeXml(file.id)}</id> <id>${escapeXml(file.id)}</id>
<name>${escapeXml(file.name)}</name> <name>${escapeXml(file.name)}</name>
<type>${escapeXml(getReadableAgentFileType(file.type))}</type>
</file>` </file>`
) )
.join('\n')}`; .join('\n')}`;
...@@ -383,12 +384,14 @@ export const useUserContext = async ({ ...@@ -383,12 +384,14 @@ export const useUserContext = async ({
const { files } = chatValue2RuntimePrompt(message.value); const { files } = chatValue2RuntimePrompt(message.value);
const formatFiles = parseAgentInputFiles({ const formatFiles = filterAgentDocumentFiles(
files, parseAgentInputFiles({
prefixId: getMessagePrefixId(message, index), files,
requestOrigin, prefixId: getMessagePrefixId(message, index),
maxFiles requestOrigin,
}); maxFiles
})
);
registerFiles(formatFiles); registerFiles(formatFiles);
if (formatFiles.length === 0) return message; if (formatFiles.length === 0) return message;
......
...@@ -22,6 +22,7 @@ import type { AppFormEditFormType } from '@fastgpt/global/core/app/formEdit/type ...@@ -22,6 +22,7 @@ import type { AppFormEditFormType } from '@fastgpt/global/core/app/formEdit/type
import { getLogger, LogCategories } from '../../../../../common/logger'; import { getLogger, LogCategories } from '../../../../../common/logger';
import { serviceEnv } from '../../../../../env'; import { serviceEnv } from '../../../../../env';
import { dispatchPiAgent } from './piAgent'; import { dispatchPiAgent } from './piAgent';
import { getLLMModel } from '../../../../ai/model';
import { runUnifiedAgentLoop, type PlanAskPayload } from '../../../../ai/llm/agentLoop'; import { runUnifiedAgentLoop, type PlanAskPayload } from '../../../../ai/llm/agentLoop';
import { import {
buildWorkflowAgentLoopMemories, buildWorkflowAgentLoopMemories,
...@@ -39,6 +40,9 @@ export type DispatchAgentModuleProps = ModuleDispatchProps<{ ...@@ -39,6 +40,9 @@ export type DispatchAgentModuleProps = ModuleDispatchProps<{
[NodeInputKeyEnum.userChatInput]: string; [NodeInputKeyEnum.userChatInput]: string;
[NodeInputKeyEnum.aiChatVision]?: boolean; [NodeInputKeyEnum.aiChatVision]?: boolean;
[NodeInputKeyEnum.aiChatAudio]?: boolean;
[NodeInputKeyEnum.aiChatVideo]?: boolean;
[NodeInputKeyEnum.aiChatExtractFiles]?: boolean;
[NodeInputKeyEnum.aiChatReasoning]?: boolean; [NodeInputKeyEnum.aiChatReasoning]?: boolean;
[NodeInputKeyEnum.aiChatReasoningEffort]?: ReasoningEffort; [NodeInputKeyEnum.aiChatReasoningEffort]?: ReasoningEffort;
[NodeInputKeyEnum.fileUrlList]?: string[]; [NodeInputKeyEnum.fileUrlList]?: string[];
...@@ -117,9 +121,21 @@ export const dispatchRunAgent = async (props: DispatchAgentModuleProps): Promise ...@@ -117,9 +121,21 @@ export const dispatchRunAgent = async (props: DispatchAgentModuleProps): Promise
editSkillId, editSkillId,
agent_datasetParams: datasetParams, agent_datasetParams: datasetParams,
useAgentSandbox = false, useAgentSandbox = false,
model,
aiChatReasoning aiChatReasoning
} }
} = props; } = props;
const agentModel = getLLMModel(model);
props.params.aiChatVision = !!(props.params.aiChatVision && agentModel.vision);
props.params.aiChatAudio = !!(props.params.aiChatAudio && agentModel.audio);
props.params.aiChatVideo = !!(props.params.aiChatVideo && agentModel.video);
if (props.params.aiChatExtractFiles !== undefined) {
props.params.aiChatExtractFiles = !!(
props.params.aiChatExtractFiles &&
(props.params.aiChatVision || props.params.aiChatAudio || props.params.aiChatVideo)
);
}
const skillIds = editSkillId ? [editSkillId] : selectedSkills.map(({ skillId }) => skillId); const skillIds = editSkillId ? [editSkillId] : selectedSkills.map(({ skillId }) => skillId);
// 初始化对话框输入的文件 // 初始化对话框输入的文件
......
...@@ -89,11 +89,16 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp ...@@ -89,11 +89,16 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
quoteQA: rawQuoteQA, quoteQA: rawQuoteQA,
aiChatVision: rawAiChatVision, aiChatVision: rawAiChatVision,
aiChatAudio: rawAiChatAudio,
aiChatVideo: rawAiChatVideo,
aiChatExtractFiles,
fileUrlList: rawFileLinks // node quote file links fileUrlList: rawFileLinks // node quote file links
} }
} = props; } = props;
let quoteQA = rawQuoteQA; let quoteQA = rawQuoteQA;
let aiChatVision = rawAiChatVision; let aiChatVision = rawAiChatVision;
let aiChatAudio = rawAiChatAudio;
let aiChatVideo = rawAiChatVideo;
let fileLinks = rawFileLinks; let fileLinks = rawFileLinks;
let userChatInput = rawUserChatInput; let userChatInput = rawUserChatInput;
...@@ -106,6 +111,8 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp ...@@ -106,6 +111,8 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
try { try {
aiChatVision = modelConstantsData.vision && aiChatVision; aiChatVision = modelConstantsData.vision && aiChatVision;
aiChatAudio = modelConstantsData.audio && aiChatAudio;
aiChatVideo = modelConstantsData.video && aiChatVideo;
// Check fileLinks is reference variable // Check fileLinks is reference variable
const fileUrlInput = inputs.find((item) => item.key === NodeInputKeyEnum.fileUrlList); const fileUrlInput = inputs.find((item) => item.key === NodeInputKeyEnum.fileUrlList);
if (!fileUrlInput || !fileUrlInput.value || fileUrlInput.value.length === 0) { if (!fileUrlInput || !fileUrlInput.value || fileUrlInput.value.length === 0) {
...@@ -195,6 +202,9 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp ...@@ -195,6 +202,9 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
}, },
retainDatasetCite, retainDatasetCite,
useVision: aiChatVision, useVision: aiChatVision,
useAudio: aiChatAudio,
useVideo: aiChatVideo,
extractFiles: aiChatExtractFiles,
requestOrigin requestOrigin
}, },
userKey: externalProvider.openaiAccount, userKey: externalProvider.openaiAccount,
......
...@@ -36,6 +36,8 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise< ...@@ -36,6 +36,8 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise<
history = 6, history = 6,
fileUrlList: rawFileLinks, fileUrlList: rawFileLinks,
aiChatVision, aiChatVision,
aiChatAudio,
aiChatVideo,
aiChatReasoning, aiChatReasoning,
isResponseAnswerText = true, isResponseAnswerText = true,
useAgentSandbox useAgentSandbox
...@@ -55,6 +57,8 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise< ...@@ -55,6 +57,8 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise<
try { try {
const toolModel = getLLMModel(model); const toolModel = getLLMModel(model);
const useVision = aiChatVision && toolModel.vision; const useVision = aiChatVision && toolModel.vision;
const useAudio = aiChatAudio && toolModel.audio;
const useVideo = aiChatVideo && toolModel.video;
const chatHistories = getHistories(history, histories); const chatHistories = getHistories(history, histories);
const fileUrlInput = inputs.find((item) => item.key === NodeInputKeyEnum.fileUrlList); const fileUrlInput = inputs.find((item) => item.key === NodeInputKeyEnum.fileUrlList);
const fileLinks = const fileLinks =
...@@ -63,6 +67,8 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise< ...@@ -63,6 +67,8 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise<
: rawFileLinks; : rawFileLinks;
props.params.aiChatVision = aiChatVision && toolModel.vision; props.params.aiChatVision = aiChatVision && toolModel.vision;
props.params.aiChatAudio = useAudio;
props.params.aiChatVideo = useVideo;
props.params.aiChatReasoning = aiChatReasoning && toolModel.reasoning; props.params.aiChatReasoning = aiChatReasoning && toolModel.reasoning;
props.params.fileUrlList = fileLinks; props.params.fileUrlList = fileLinks;
props.params.useAgentSandbox = useSandbox; props.params.useAgentSandbox = useSandbox;
......
...@@ -52,6 +52,9 @@ export const runToolCall = async (props: DispatchToolModuleProps): Promise<Respo ...@@ -52,6 +52,9 @@ export const runToolCall = async (props: DispatchToolModuleProps): Promise<Respo
temperature, temperature,
maxToken, maxToken,
aiChatVision, aiChatVision,
aiChatAudio,
aiChatVideo,
aiChatExtractFiles,
aiChatTopP, aiChatTopP,
aiChatStopSign, aiChatStopSign,
aiChatResponseFormat, aiChatResponseFormat,
...@@ -133,7 +136,10 @@ export const runToolCall = async (props: DispatchToolModuleProps): Promise<Respo ...@@ -133,7 +136,10 @@ export const runToolCall = async (props: DispatchToolModuleProps): Promise<Respo
}, },
requestOrigin, requestOrigin,
retainDatasetCite, retainDatasetCite,
useVision: aiChatVision useVision: aiChatVision,
useAudio: aiChatAudio,
useVideo: aiChatVideo,
extractFiles: aiChatExtractFiles
}, },
childrenInteractiveParams, childrenInteractiveParams,
userKey: externalProvider.openaiAccount, userKey: externalProvider.openaiAccount,
......
...@@ -21,6 +21,9 @@ export type DispatchToolModuleProps = ModuleDispatchProps<{ ...@@ -21,6 +21,9 @@ export type DispatchToolModuleProps = ModuleDispatchProps<{
[NodeInputKeyEnum.aiChatMaxToken]: number; [NodeInputKeyEnum.aiChatMaxToken]: number;
[NodeInputKeyEnum.aiChatIsResponseText]?: boolean; [NodeInputKeyEnum.aiChatIsResponseText]?: boolean;
[NodeInputKeyEnum.aiChatVision]?: boolean; [NodeInputKeyEnum.aiChatVision]?: boolean;
[NodeInputKeyEnum.aiChatAudio]?: boolean;
[NodeInputKeyEnum.aiChatVideo]?: boolean;
[NodeInputKeyEnum.aiChatExtractFiles]?: boolean;
[NodeInputKeyEnum.aiChatReasoning]?: boolean; [NodeInputKeyEnum.aiChatReasoning]?: boolean;
[NodeInputKeyEnum.aiChatReasoningEffort]?: ReasoningEffort; [NodeInputKeyEnum.aiChatReasoningEffort]?: ReasoningEffort;
[NodeInputKeyEnum.aiChatTopP]?: number; [NodeInputKeyEnum.aiChatTopP]?: number;
......
import { imageFileType } from '@fastgpt/global/common/file/constants'; import { audioFileType, imageFileType, videoFileType } from '@fastgpt/global/common/file/constants';
import { ChatFileTypeEnum } from '@fastgpt/global/core/chat/constants'; import { ChatFileTypeEnum } from '@fastgpt/global/core/chat/constants';
import type { UserChatItemFileItemType } from '@fastgpt/global/core/chat/type'; import type { UserChatItemFileItemType } from '@fastgpt/global/core/chat/type';
...@@ -89,13 +89,26 @@ export const parseUrlToFileType = (url: string): UserChatItemFileItemType | unde ...@@ -89,13 +89,26 @@ export const parseUrlToFileType = (url: string): UserChatItemFileItemType | unde
const extension = filename?.split('.').pop()?.toLowerCase() || ''; const extension = filename?.split('.').pop()?.toLowerCase() || '';
if (extension && imageFileType.includes(extension)) { if (extension && imageFileType.includes(extension)) {
// Default to file type for non-extension files
return { return {
type: ChatFileTypeEnum.image, type: ChatFileTypeEnum.image,
name: filename ? decodeURIComponent(filename) : url, name: filename ? decodeURIComponent(filename) : url,
url url
}; };
} }
if (extension && audioFileType.includes(extension)) {
return {
type: ChatFileTypeEnum.audio,
name: filename ? decodeURIComponent(filename) : url,
url
};
}
if (extension && videoFileType.includes(extension)) {
return {
type: ChatFileTypeEnum.video,
name: filename ? decodeURIComponent(filename) : url,
url
};
}
// If it's a document type, return as file, otherwise treat as image // If it's a document type, return as file, otherwise treat as image
return { return {
type: ChatFileTypeEnum.file, type: ChatFileTypeEnum.file,
......
...@@ -207,7 +207,7 @@ export const serviceEnv = createEnv({ ...@@ -207,7 +207,7 @@ export const serviceEnv = createEnv({
.optional() .optional()
.meta({ description: '自定义跨域;不配置时默认允许所有跨域(逗号分割)' }), .meta({ description: '自定义跨域;不配置时默认允许所有跨域(逗号分割)' }),
MULTIPLE_DATA_TO_BASE64: BoolSchema.default(true).meta({ MULTIPLE_DATA_TO_BASE64: BoolSchema.default(true).meta({
description: '是否强制将图片转成 base64 传递给模型' description: '是否强制将图片、音频、视频转成 base64 传递给模型'
}), }),
//==================== Beta features ==================== //==================== Beta features ====================
......
...@@ -6,6 +6,8 @@ import type { ChatCompletionMessageParam } from '@fastgpt/global/core/ai/llm/typ ...@@ -6,6 +6,8 @@ import type { ChatCompletionMessageParam } from '@fastgpt/global/core/ai/llm/typ
import { ChatCompletionRequestMessageRoleEnum } from '@fastgpt/global/core/ai/constants'; import { ChatCompletionRequestMessageRoleEnum } from '@fastgpt/global/core/ai/constants';
import { describe, expect, it, vi, beforeEach } from 'vitest'; import { describe, expect, it, vi, beforeEach } from 'vitest';
const mockCreateGetChatFileURL = vi.hoisted(() => vi.fn());
// Mock external dependencies // Mock external dependencies
vi.mock('@fastgpt/service/common/string/tiktoken/index', () => { vi.mock('@fastgpt/service/common/string/tiktoken/index', () => {
const countGptMessagesTokens = vi.fn(); const countGptMessagesTokens = vi.fn();
...@@ -30,10 +32,17 @@ vi.mock('@fastgpt/service/common/system/log', () => ({ ...@@ -30,10 +32,17 @@ vi.mock('@fastgpt/service/common/system/log', () => ({
vi.mock('@fastgpt/service/common/api/axios', () => ({ vi.mock('@fastgpt/service/common/api/axios', () => ({
axios: { axios: {
head: vi.fn() head: vi.fn(),
get: vi.fn()
} }
})); }));
vi.mock('@fastgpt/service/common/s3/sources/chat', () => ({
getS3ChatSource: () => ({
createGetChatFileURL: mockCreateGetChatFileURL
})
}));
import { countGptMessagesTokens } from '@fastgpt/service/common/string/tiktoken/index'; import { countGptMessagesTokens } from '@fastgpt/service/common/string/tiktoken/index';
import { getImageBase64 } from '@fastgpt/service/common/file/image/utils'; import { getImageBase64 } from '@fastgpt/service/common/file/image/utils';
import { serviceEnv } from '@fastgpt/service/env'; import { serviceEnv } from '@fastgpt/service/env';
...@@ -42,6 +51,7 @@ import { axios } from '@fastgpt/service/common/api/axios'; ...@@ -42,6 +51,7 @@ import { axios } from '@fastgpt/service/common/api/axios';
const mockCountGptMessagesTokens = vi.mocked(countGptMessagesTokens); const mockCountGptMessagesTokens = vi.mocked(countGptMessagesTokens);
const mockGetImageBase64 = vi.mocked(getImageBase64); const mockGetImageBase64 = vi.mocked(getImageBase64);
const mockAxiosHead = vi.mocked(axios.head); const mockAxiosHead = vi.mocked(axios.head);
const mockAxiosGet = vi.mocked(axios.get);
const originalMultipleDataToBase64 = serviceEnv.MULTIPLE_DATA_TO_BASE64; const originalMultipleDataToBase64 = serviceEnv.MULTIPLE_DATA_TO_BASE64;
describe('filterGPTMessageByMaxContext function tests', () => { describe('filterGPTMessageByMaxContext function tests', () => {
...@@ -531,6 +541,185 @@ describe('loadRequestMessages function tests', () => { ...@@ -531,6 +541,185 @@ describe('loadRequestMessages function tests', () => {
expect(result[0].content).toBe('Look at https://example.com/image.png'); expect(result[0].content).toBe('Look at https://example.com/image.png');
}); });
it('should extract audio and video links when enabled', async () => {
serviceEnv.MULTIPLE_DATA_TO_BASE64 = false;
const messages: ChatCompletionMessageParam[] = [
{
role: ChatCompletionRequestMessageRoleEnum.User,
content:
'Check https://example.com/audio.mp3, https://example.com/voice.ogg and https://example.com/video.mp4?download=1'
}
];
const result = await loadRequestMessages({
messages,
useAudio: true,
useVideo: true,
extractFiles: true
});
expect(result).toHaveLength(1);
expect(Array.isArray(result[0].content)).toBe(true);
const content = result[0].content as any[];
expect(content).toEqual(
expect.arrayContaining([
expect.objectContaining({
type: 'input_audio',
input_audio: {
data: 'https://example.com/audio.mp3',
format: 'mp3'
}
}),
expect.objectContaining({
type: 'input_audio',
input_audio: {
data: 'https://example.com/voice.ogg',
format: 'ogg'
}
}),
expect.objectContaining({
type: 'video_url',
video_url: {
url: 'https://example.com/video.mp4?download=1'
}
}),
expect.objectContaining({ type: 'text' })
])
);
expect(content.some((item: any) => item.type === 'file_url')).toBe(false);
expect(content.some((item: any) => item.type === 'file')).toBe(false);
expect(mockAxiosGet).not.toHaveBeenCalled();
});
it('should convert extracted audio and video links when MULTIPLE_DATA_TO_BASE64 is enabled', async () => {
serviceEnv.MULTIPLE_DATA_TO_BASE64 = true;
mockAxiosGet.mockResolvedValue({
data: Buffer.from('media bytes')
});
const audioUrl =
'http://localhost:9000/fastgpt-private/chat/fastgpt_intro.wav?X-Amz-Signature=test';
const videoUrl = 'http://127.0.0.1:9000/fastgpt-private/chat/demo.mp4';
const messages: ChatCompletionMessageParam[] = [
{
role: ChatCompletionRequestMessageRoleEnum.User,
content: `Check ${audioUrl} and ${videoUrl}`
}
];
const result = await loadRequestMessages({
messages,
useAudio: true,
useVideo: true,
extractFiles: true
});
expect(result).toHaveLength(1);
const content = result[0].content as any[];
expect(content).toEqual(
expect.arrayContaining([
expect.objectContaining({
type: 'input_audio',
input_audio: {
data: `data:;base64,${Buffer.from('media bytes').toString('base64')}`,
format: 'wav'
}
}),
expect.objectContaining({
type: 'video_url',
video_url: {
url: `data:;base64,${Buffer.from('media bytes').toString('base64')}`
}
})
])
);
expect(mockAxiosGet).toHaveBeenCalledWith(audioUrl, {
responseType: 'arraybuffer',
timeout: 10000
});
expect(mockAxiosGet).toHaveBeenCalledWith(videoUrl, {
responseType: 'arraybuffer',
timeout: 10000
});
});
it('should normalize internal audio and video file_url to base64 content parts', async () => {
mockAxiosGet.mockResolvedValue({
data: Buffer.from('media bytes')
});
mockCreateGetChatFileURL
.mockResolvedValueOnce({ url: '/chat/audio.mp3' })
.mockResolvedValueOnce({ url: '/chat/video.mp4' });
const messages: ChatCompletionMessageParam[] = [
{
role: ChatCompletionRequestMessageRoleEnum.User,
content: [
{
type: 'file_url',
name: 'audio.mp3',
url: 'http://localhost:9000/preview/audio.mp3',
fileType: 'audio',
key: 'chat/audio.mp3'
},
{
type: 'file_url',
name: 'video.mp4',
url: 'http://localhost:9000/preview/video.mp4',
fileType: 'video',
key: 'chat/video.mp4'
},
{
type: 'text',
text: 'Analyze these files'
}
]
}
];
const result = await loadRequestMessages({
messages,
useAudio: true,
useVideo: true
});
expect(result).toHaveLength(1);
const content = result[0].content as any[];
expect(content).toEqual(
expect.arrayContaining([
expect.objectContaining({
type: 'input_audio',
input_audio: {
data: `data:;base64,${Buffer.from('media bytes').toString('base64')}`,
format: 'mp3'
}
}),
expect.objectContaining({
type: 'video_url',
video_url: {
url: `data:;base64,${Buffer.from('media bytes').toString('base64')}`
}
}),
expect.objectContaining({ type: 'text', text: 'Analyze these files' })
])
);
expect(content.some((item: any) => item.type === 'file_url')).toBe(false);
});
it('should preserve legacy vision extraction when extractFiles is omitted', async () => {
const messages: ChatCompletionMessageParam[] = [
{
role: ChatCompletionRequestMessageRoleEnum.User,
content: 'Look at https://example.com/image.png'
}
];
const result = await loadRequestMessages({ messages, useVision: true });
expect(result).toHaveLength(1);
const content = result[0].content as any[];
expect(content.some((item: any) => item.type === 'image_url')).toBe(true);
});
it('should not extract images from very long text (>500 chars)', async () => { it('should not extract images from very long text (>500 chars)', async () => {
const longText = 'A'.repeat(600) + ' https://example.com/image.png'; const longText = 'A'.repeat(600) + ' https://example.com/image.png';
const messages: ChatCompletionMessageParam[] = [ const messages: ChatCompletionMessageParam[] = [
......
import { describe, expect, it } from 'vitest';
import { sanitizeLLMRequestRecordPayload } from '@fastgpt/service/core/ai/record/controller';
const createBase64 = (length = 320) => 'a'.repeat(length);
describe('sanitizeLLMRequestRecordPayload', () => {
it('redacts base64 data urls without changing surrounding request structure', () => {
const payload = {
model: 'gpt-4o',
messages: [
{
role: 'user',
content: [
{ type: 'text', text: 'describe this image' },
{
type: 'image_url',
image_url: {
url: `data:image/png;base64,${createBase64()}`
}
}
]
}
]
};
const result = sanitizeLLMRequestRecordPayload(payload);
expect(result).toEqual({
model: 'gpt-4o',
messages: [
{
role: 'user',
content: [
{ type: 'text', text: 'describe this image' },
{
type: 'image_url',
image_url: {
url: 'data:image/png;base64,[base64 omitted]'
}
}
]
}
]
});
expect(payload.messages[0].content[1].image_url.url).toContain(createBase64());
});
it('redacts raw base64 data fields and keeps normal text', () => {
const payload = {
input_audio: {
format: 'wav',
data: createBase64()
},
text: 'plain text should stay'
};
expect(sanitizeLLMRequestRecordPayload(payload)).toEqual({
input_audio: {
format: 'wav',
data: '[base64 omitted]'
},
text: 'plain text should stay'
});
});
it('redacts base64 embedded in a longer string', () => {
const payload = {
markdown: `![image](data:image/jpeg;base64,${createBase64()})`
};
expect(sanitizeLLMRequestRecordPayload(payload)).toEqual({
markdown: '![image](data:image/jpeg;base64,[base64 omitted])'
});
});
});
import { describe, expect, it } from 'vitest';
import { ChatFileTypeEnum } from '@fastgpt/global/core/chat/constants';
import {
assertChatFileRuntimeValue,
normalizeChatFileStoreValue,
normalizeChatFileStoreValues
} from '../../../core/chat/fileStoreValue';
describe('normalizeChatFileStoreValue', () => {
it('按 S3 key 提取文件名并推断图片类型', () => {
expect(
normalizeChatFileStoreValue({
key: 'chat/files/2026/PHOTO.JPG'
})
).toEqual({
key: 'chat/files/2026/PHOTO.JPG',
name: 'PHOTO.JPG',
type: ChatFileTypeEnum.image
});
});
it('优先保留显式 type,不用扩展名覆盖用户传入的类型', () => {
expect(
normalizeChatFileStoreValue({
key: 'chat/files/photo.png',
name: 'photo.png',
type: ChatFileTypeEnum.file
})
).toEqual({
key: 'chat/files/photo.png',
name: 'photo.png',
type: ChatFileTypeEnum.file
});
});
it('同时存在 key 和 url 时优先落库 key,避免保存临时预览 url', () => {
expect(
normalizeChatFileStoreValue({
key: 'chat/files/audio.mp3',
url: 'https://preview.example.com/audio.mp3?token=temp'
})
).toEqual({
key: 'chat/files/audio.mp3',
name: 'audio.mp3',
type: ChatFileTypeEnum.audio
});
});
it('S3 key 解析不出 basename 时使用 file 作为稳定展示名', () => {
expect(
normalizeChatFileStoreValue({
key: '/'
})
).toEqual({
key: '/',
name: 'file',
type: ChatFileTypeEnum.file
});
});
it('从外链 URL pathname 解码文件名并推断视频类型', () => {
expect(
normalizeChatFileStoreValue({
url: 'https://example.com/files/%E6%B5%8B%E8%AF%95.MP4?token=1'
})
).toEqual({
url: 'https://example.com/files/%E6%B5%8B%E8%AF%95.MP4?token=1',
name: '测试.MP4',
type: ChatFileTypeEnum.video
});
});
it('非法 URL 仍保留原始字符串作为文件名,避免名称推断失败丢文件', () => {
expect(
normalizeChatFileStoreValue({
url: 'not a standard url.wav'
})
).toEqual({
url: 'not a standard url.wav',
name: 'not a standard url.wav',
type: ChatFileTypeEnum.audio
});
});
it('无法识别扩展名时兜底为普通文件类型', () => {
expect(
normalizeChatFileStoreValue({
url: 'https://example.com/files/archive.unknown'
})
).toEqual({
url: 'https://example.com/files/archive.unknown',
name: 'archive.unknown',
type: ChatFileTypeEnum.file
});
});
it('外链 URL 没有 pathname 文件名时使用完整 URL 作为展示名', () => {
expect(
normalizeChatFileStoreValue({
url: 'https://example.com/'
})
).toEqual({
url: 'https://example.com/',
name: 'https://example.com/',
type: ChatFileTypeEnum.file
});
});
it('过滤没有 key 的 data URL,避免把临时大内容写入变量存储', () => {
expect(
normalizeChatFileStoreValue({
url: 'data:image/png;base64,abc'
})
).toBeUndefined();
});
it('缺少 key 和有效 url 时返回 undefined', () => {
expect(normalizeChatFileStoreValue({ name: 'empty.pdf' })).toBeUndefined();
});
});
describe('assertChatFileRuntimeValue', () => {
it('非数组运行态直接抛错,暴露 file 变量类型错误', () => {
expect(() => assertChatFileRuntimeValue('https://example.com/a.png' as any)).toThrow(
'File variable value must be an array'
);
});
it('保留 URL 字符串和可识别文件对象,并裁剪对象上的前端临时字段', () => {
expect(
assertChatFileRuntimeValue([
'https://example.com/a.png',
{
key: 'chat/files/b.pdf',
name: 'b.pdf',
type: ChatFileTypeEnum.file,
uploadProgress: 100
} as any,
{ previewUrl: 'blob:http://local-preview' } as any,
'',
null as any
])
).toEqual([
'https://example.com/a.png',
{
key: 'chat/files/b.pdf',
name: 'b.pdf',
type: ChatFileTypeEnum.file
}
]);
});
});
describe('normalizeChatFileStoreValues', () => {
it('批量清洗前端/历史输入,只保留可落库文件值', () => {
expect(
normalizeChatFileStoreValues([
{
key: 'chat/files/doc.pdf',
url: 'https://preview.example.com/doc.pdf',
name: 'doc.pdf',
type: ChatFileTypeEnum.file,
previewUrl: 'blob:http://local-preview'
},
{
url: 'data:image/png;base64,abc',
name: 'inline.png',
type: ChatFileTypeEnum.image
},
{ previewUrl: 'blob:http://local-only' } as any,
{
url: 'https://example.com/sound.m4a'
}
])
).toEqual([
{
key: 'chat/files/doc.pdf',
name: 'doc.pdf',
type: ChatFileTypeEnum.file
},
{
url: 'https://example.com/sound.m4a',
name: 'sound.m4a',
type: ChatFileTypeEnum.audio
}
]);
});
it('默认兼容历史非法整体输入,强校验模式下抛错', () => {
expect(normalizeChatFileStoreValues(undefined as any)).toEqual([]);
expect(() => normalizeChatFileStoreValues(undefined as any, { throwOnInvalid: true })).toThrow(
'File variable value must be an array'
);
});
});
...@@ -111,7 +111,7 @@ const getUserContextMessagesForTest = async ({ ...@@ -111,7 +111,7 @@ const getUserContextMessagesForTest = async ({
}; };
describe('buildAgentInputFilesPrompt', () => { describe('buildAgentInputFilesPrompt', () => {
it('generates file XML block with stable ids', () => { it('generates file XML block for document files only', () => {
const result = buildAgentInputFilesPrompt([ const result = buildAgentInputFilesPrompt([
{ {
id: 'current-0', id: 'current-0',
...@@ -124,14 +124,30 @@ describe('buildAgentInputFilesPrompt', () => { ...@@ -124,14 +124,30 @@ describe('buildAgentInputFilesPrompt', () => {
name: 'chart.png', name: 'chart.png',
type: ChatFileTypeEnum.image, type: ChatFileTypeEnum.image,
url: '/chart.png' url: '/chart.png'
},
{
id: 'current-2',
name: 'voice.mp3',
type: ChatFileTypeEnum.audio,
url: '/voice.mp3'
},
{
id: 'current-3',
name: 'demo.mp4',
type: ChatFileTypeEnum.video,
url: '/demo.mp4'
} }
]); ]);
expect(result).toContain('## 文件'); expect(result).toContain('## 文件');
expect(result).toContain('<id>current-0</id>'); expect(result).toContain('<id>current-0</id>');
expect(result).toContain('<type>document</type>'); expect(result).toContain('<name>guide.pdf</name>');
expect(result).toContain('<id>current-1</id>'); expect(result).not.toContain('<id>current-1</id>');
expect(result).toContain('<type>image</type>'); expect(result).not.toContain('<id>current-2</id>');
expect(result).not.toContain('<id>current-3</id>');
expect(result).not.toContain('<type>image</type>');
expect(result).not.toContain('<type>audio</type>');
expect(result).not.toContain('<type>video</type>');
}); });
it('escapes XML fields in file metadata', () => { it('escapes XML fields in file metadata', () => {
...@@ -367,11 +383,19 @@ describe('useUserContext', () => { ...@@ -367,11 +383,19 @@ describe('useUserContext', () => {
expect(currentText).toContain('## 背景信息'); expect(currentText).toContain('## 背景信息');
expect(currentText).toContain('当前 sandbox 工作目录: /workspace'); expect(currentText).toContain('当前 sandbox 工作目录: /workspace');
expect(currentText).toContain('<id>current_chat_item-0</id>'); expect(currentText).toContain('<id>current_chat_item-0</id>');
expect(currentText).toContain('<id>current_chat_item-1</id>'); expect(currentText).not.toContain('<id>current_chat_item-1</id>');
expect(currentText).toContain('## 知识库'); expect(currentText).toContain('## 知识库');
expect(currentText).toContain('<description>后端读取到的知识库介绍</description>'); expect(currentText).toContain('<description>后端读取到的知识库介绍</description>');
expect(currentText).toContain('2026-05-14 10:00:00 Thursday'); expect(currentText).toContain('2026-05-14 10:00:00 Thursday');
expect(currentText).toContain('当前问题'); expect(currentText).toContain('当前问题');
expect(result.currentFiles).toEqual([
{
id: 'current_chat_item-0',
name: 'current.pdf',
type: ChatFileTypeEnum.file,
url: '/current.pdf'
}
]);
} }
); );
}); });
...@@ -683,12 +707,14 @@ describe('useUserContext', () => { ...@@ -683,12 +707,14 @@ describe('useUserContext', () => {
); );
}); });
it('filters invalid urls, keeps data images in reminder, and excludes images from read_files map', async () => { it('filters invalid urls and excludes image/audio/video files from agent context', async () => {
const dataImage = 'data:image/png;base64,AAAA'; const dataImage = 'data:image/png;base64,AAAA';
await runWithContextAsync( await runWithContextAsync(
{ {
queryUrlTypeMap: { queryUrlTypeMap: {
'/doc.pdf': ChatFileTypeEnum.file '/doc.pdf': ChatFileTypeEnum.file,
'/voice.mp3': ChatFileTypeEnum.audio,
'/demo.mp4': ChatFileTypeEnum.video
}, },
mcpClientMemory: {} mcpClientMemory: {}
}, },
...@@ -696,7 +722,14 @@ describe('useUserContext', () => { ...@@ -696,7 +722,14 @@ describe('useUserContext', () => {
const result = await getUserContextMessagesForTest({ const result = await getUserContextMessagesForTest({
history: 6, history: 6,
histories: [], histories: [],
currentFiles: ['not-a-url', 'data:text/plain;base64,AAAA', dataImage, '/doc.pdf'], currentFiles: [
'not-a-url',
'data:text/plain;base64,AAAA',
dataImage,
'/doc.pdf',
'/voice.mp3',
'/demo.mp4'
],
currentUserInput: '分析这些文件', currentUserInput: '分析这些文件',
currentDataId: 'current_ai', currentDataId: 'current_ai',
tmbId: 'tmb_1', tmbId: 'tmb_1',
...@@ -707,12 +740,24 @@ describe('useUserContext', () => { ...@@ -707,12 +740,24 @@ describe('useUserContext', () => {
expect(result.filesMap).toEqual({ expect(result.filesMap).toEqual({
'current_ai-2': '/doc.pdf' 'current_ai-2': '/doc.pdf'
}); });
expect(result.currentFiles).toEqual([
{
id: 'current_ai-2',
name: 'doc.pdf',
type: ChatFileTypeEnum.file,
url: '/doc.pdf'
}
]);
const { text } = chatValue2RuntimePrompt(result.currentUserMessage.value); const { text } = chatValue2RuntimePrompt(result.currentUserMessage.value);
expect(text).not.toContain('<id>current_ai-0</id>'); expect(text).not.toContain('<id>current_ai-0</id>');
expect(text).toContain('<id>current_ai-1</id>'); expect(text).not.toContain('<id>current_ai-1</id>');
expect(text).toContain('<type>image</type>');
expect(text).toContain('<id>current_ai-2</id>'); expect(text).toContain('<id>current_ai-2</id>');
expect(text).not.toContain('<id>current_ai-3</id>');
expect(text).not.toContain('<id>current_ai-4</id>');
expect(text).not.toContain('<type>image</type>');
expect(text).not.toContain('<type>audio</type>');
expect(text).not.toContain('<type>video</type>');
expect(text).not.toContain('not-a-url'); expect(text).not.toContain('not-a-url');
expect(text).not.toContain('data:text/plain'); expect(text).not.toContain('data:text/plain');
} }
......
...@@ -395,6 +395,28 @@ describe('parseUrlToFileType', () => { ...@@ -395,6 +395,28 @@ describe('parseUrlToFileType', () => {
expect(result?.name).toBe('file name.jpg'); expect(result?.name).toBe('file name.jpg');
}); });
it('should detect audio URL by extension', () => {
const url = 'https://example.com/chat-audio.mp3';
const result = parseUrlToFileType(url);
expect(result).toEqual({
type: ChatFileTypeEnum.audio,
name: 'chat-audio.mp3',
url
});
});
it('should detect video URL by extension', () => {
const url = 'https://example.com/chat-video.mp4';
const result = parseUrlToFileType(url);
expect(result).toEqual({
type: ChatFileTypeEnum.video,
name: 'chat-video.mp4',
url
});
});
it('should handle URL with multiple dots in filename', () => { it('should handle URL with multiple dots in filename', () => {
const url = 'https://example.com/my.file.name.png'; const url = 'https://example.com/my.file.name.png';
const result = parseUrlToFileType(url); const result = parseUrlToFileType(url);
......
...@@ -22,6 +22,7 @@ import MyDivider from '../MyDivider'; ...@@ -22,6 +22,7 @@ import MyDivider from '../MyDivider';
import { shadowLight } from '../../../styles/theme'; import { shadowLight } from '../../../styles/theme';
import { useMemoEnhance } from '../../../hooks/useMemoEnhance'; import { useMemoEnhance } from '../../../hooks/useMemoEnhance';
import MyLoading from '../MyLoading'; import MyLoading from '../MyLoading';
import { selectSizeStyleMap, type MySelectSize } from './styles';
const menuItemStyles: MenuItemProps = { const menuItemStyles: MenuItemProps = {
borderRadius: 'sm', borderRadius: 'sm',
...@@ -36,6 +37,12 @@ const menuItemStyles: MenuItemProps = { ...@@ -36,6 +37,12 @@ const menuItemStyles: MenuItemProps = {
} }
}; };
const selectedTagStyle: FlexProps = {
bg: 'white',
border: 'base',
color: 'myGray.900'
};
export type SelectProps<T = any> = { export type SelectProps<T = any> = {
list: { list: {
icon?: string; icon?: string;
...@@ -61,9 +68,10 @@ export type SelectProps<T = any> = { ...@@ -61,9 +68,10 @@ export type SelectProps<T = any> = {
onOpenFunc?: () => void; onOpenFunc?: () => void;
size?: MySelectSize;
tagStyle?: FlexProps; tagStyle?: FlexProps;
menuBottomSlot?: React.ReactNode; menuBottomSlot?: React.ReactNode;
} & Omit<ButtonProps, 'onSelect'>; } & Omit<ButtonProps, 'onSelect' | 'size'>;
type SelectedItemType<T> = { type SelectedItemType<T> = {
icon?: string; icon?: string;
...@@ -91,6 +99,7 @@ const MultipleSelect = <T = any,>({ ...@@ -91,6 +99,7 @@ const MultipleSelect = <T = any,>({
onOpenFunc, onOpenFunc,
size = 'md',
tagStyle, tagStyle,
menuBottomSlot, menuBottomSlot,
isLoading, isLoading,
...@@ -98,6 +107,7 @@ const MultipleSelect = <T = any,>({ ...@@ -98,6 +107,7 @@ const MultipleSelect = <T = any,>({
}: SelectProps<T>) => { }: SelectProps<T>) => {
const SearchInputRef = useRef<HTMLInputElement>(null); const SearchInputRef = useRef<HTMLInputElement>(null);
const tagsContainerRef = useRef<HTMLDivElement>(null); const tagsContainerRef = useRef<HTMLDivElement>(null);
void itemWrap;
const { t } = useTranslation(); const { t } = useTranslation();
const { isOpen, onOpen: originalOnOpen, onClose } = useDisclosure(); const { isOpen, onOpen: originalOnOpen, onClose } = useDisclosure();
...@@ -122,6 +132,22 @@ const MultipleSelect = <T = any,>({ ...@@ -122,6 +132,22 @@ const MultipleSelect = <T = any,>({
return listItem || { value: val, label: String(val) }; return listItem || { value: val, label: String(val) };
}); });
}, [formatValue, list]); }, [formatValue, list]);
const tagWidth = tagStyle?.w;
const canInferSelectAll = !ScrollData && (isSelectAll !== undefined || !!setIsSelectAll);
const isFullSelected = useMemo(() => {
if (list.length === 0 || formatValue.length !== list.length) return false;
return list.every((item) => formatValue.includes(item.value));
}, [formatValue, list]);
const isAllSelected = !!isSelectAll || (canInferSelectAll && isFullSelected);
const openedMenuButtonStyle: Pick<ButtonProps, 'bg' | 'borderColor' | 'boxShadow'> =
isOpen && !isDisabled
? {
boxShadow: shadowLight,
borderColor: 'primary.600 !important',
bg: 'white'
}
: {};
const handleKeyDown = useCallback( const handleKeyDown = useCallback(
(e: React.KeyboardEvent<HTMLInputElement>) => { (e: React.KeyboardEvent<HTMLInputElement>) => {
...@@ -141,26 +167,31 @@ const MultipleSelect = <T = any,>({ ...@@ -141,26 +167,31 @@ const MultipleSelect = <T = any,>({
const onclickItem = useCallback( const onclickItem = useCallback(
(val: T) => { (val: T) => {
if (isSelectAll) { if (isAllSelected) {
onSelect(list.map((item) => item.value).filter((i) => i !== val)); onSelect(list.map((item) => item.value).filter((i) => i !== val));
setIsSelectAll?.(false); setIsSelectAll?.(false);
return; return;
} }
if (formatValue.includes(val)) { const nextValue = formatValue.includes(val)
onSelect(formatValue.filter((i) => i !== val)); ? formatValue.filter((i) => i !== val)
} else { : [...formatValue, val];
onSelect([...formatValue, val]); onSelect(nextValue);
} setIsSelectAll?.(
!ScrollData &&
list.length > 0 &&
nextValue.length === list.length &&
list.every((item) => nextValue.includes(item.value))
);
}, },
[isSelectAll, formatValue, onSelect, list, setIsSelectAll] [isAllSelected, formatValue, onSelect, setIsSelectAll, ScrollData, list]
); );
const onSelectAll = useCallback(() => { const onSelectAll = useCallback(() => {
onSelect(isSelectAll ? [] : list.map((item) => item.value)); onSelect(isAllSelected ? [] : list.map((item) => item.value));
setIsSelectAll?.((state) => !state); setIsSelectAll?.(!isAllSelected);
}, [isSelectAll, onSelect, list, setIsSelectAll]); }, [isAllSelected, onSelect, list, setIsSelectAll]);
// 动态长度计算器 - 计算一行能展示多少个tag,剩余用+n表示 // 动态长度计算器 - 计算一行能展示多少个tag,剩余用+n表示
const calculateLayout = useCallback(() => { const calculateLayout = useCallback(() => {
...@@ -188,8 +219,8 @@ const MultipleSelect = <T = any,>({ ...@@ -188,8 +219,8 @@ const MultipleSelect = <T = any,>({
// 创建临时元素来测量每个tag的实际宽度 // 创建临时元素来测量每个tag的实际宽度
const measureTagWidth = (item: any): number => { const measureTagWidth = (item: any): number => {
// 如果有tagStyle.w,优先使用 // 如果有tagStyle.w,优先使用
if (tagStyle?.w) { if (tagWidth) {
return typeof tagStyle.w === 'number' ? tagStyle.w : parseInt(String(tagStyle.w)) || 60; return typeof tagWidth === 'number' ? tagWidth : parseInt(String(tagWidth)) || 60;
} }
// 否则根据文本长度估算(更精确) // 否则根据文本长度估算(更精确)
...@@ -239,20 +270,18 @@ const MultipleSelect = <T = any,>({ ...@@ -239,20 +270,18 @@ const MultipleSelect = <T = any,>({
setVisibleItems(selectedItems.slice(0, visibleCount)); setVisibleItems(selectedItems.slice(0, visibleCount));
setOverflowItems(selectedItems.slice(visibleCount)); setOverflowItems(selectedItems.slice(visibleCount));
}, [closeable, formLabel, selectedItems, tagStyle?.w]); }, [closeable, formLabel, selectedItems, tagWidth]);
// 动态监听容器宽度变化并重新计算布局 // 动态监听容器宽度变化并重新计算布局
useEffect(() => { useEffect(() => {
if (!tagsContainerRef.current) return; if (!tagsContainerRef.current) return;
// 创建 ResizeObserver 监听容器宽度变化 // 创建 ResizeObserver 监听容器宽度变化
const resizeObserver = new ResizeObserver((entries) => { const resizeObserver = new ResizeObserver(() => {
for (const entry of entries) { // 当容器宽度发生变化时,触发重新计算
// 当容器宽度发生变化时,触发重新计算 requestAnimationFrame(() => {
requestAnimationFrame(() => { calculateLayout();
calculateLayout(); });
});
}
}); });
// 开始监听容器 // 开始监听容器
...@@ -280,17 +309,10 @@ const MultipleSelect = <T = any,>({ ...@@ -280,17 +309,10 @@ const MultipleSelect = <T = any,>({
return ( return (
<> <>
{list.map((item, i) => { {list.map((item, i) => {
const isSelected = isSelectAll || formatValue.includes(item.value); const isSelected = isAllSelected || formatValue.includes(item.value);
return ( return (
<MenuItem <MenuItem
key={i} key={i}
{...(isSelected
? {
color: 'primary.600'
}
: {
color: 'myGray.900'
})}
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
...@@ -300,6 +322,7 @@ const MultipleSelect = <T = any,>({ ...@@ -300,6 +322,7 @@ const MultipleSelect = <T = any,>({
fontSize={'sm'} fontSize={'sm'}
gap={2} gap={2}
{...menuItemStyles} {...menuItemStyles}
color={isSelected ? 'primary.600' : 'myGray.900'}
> >
<Checkbox isChecked={isSelected} /> <Checkbox isChecked={isSelected} />
{item.icon && <MyAvatar src={item.icon} w={'1rem'} borderRadius={'0'} />} {item.icon && <MyAvatar src={item.icon} w={'1rem'} borderRadius={'0'} />}
...@@ -309,7 +332,7 @@ const MultipleSelect = <T = any,>({ ...@@ -309,7 +332,7 @@ const MultipleSelect = <T = any,>({
})} })}
</> </>
); );
}, [list, isSelectAll, formatValue, onclickItem]); }, [list, isAllSelected, formatValue, onclickItem]);
return ( return (
<Box h={'100%'} w={'100%'}> <Box h={'100%'} w={'100%'}>
...@@ -326,8 +349,9 @@ const MultipleSelect = <T = any,>({ ...@@ -326,8 +349,9 @@ const MultipleSelect = <T = any,>({
as={Flex} as={Flex}
px={3} px={3}
alignItems={'center'} alignItems={'center'}
borderRadius={'md'} {...selectSizeStyleMap[size]}
border={'sm'} border={'1px solid'}
borderColor={'borderColor.low'}
userSelect={'none'} userSelect={'none'}
cursor={isDisabled ? 'not-allowed' : 'pointer'} cursor={isDisabled ? 'not-allowed' : 'pointer'}
_active={{ _active={{
...@@ -338,13 +362,7 @@ const MultipleSelect = <T = any,>({ ...@@ -338,13 +362,7 @@ const MultipleSelect = <T = any,>({
}} }}
opacity={isDisabled ? 0.6 : 1} opacity={isDisabled ? 0.6 : 1}
{...props} {...props}
{...(isOpen && !isDisabled {...openedMenuButtonStyle}
? {
boxShadow: shadowLight,
borderColor: 'primary.600 !important',
bg: 'white'
}
: {})}
> >
<Flex alignItems={'center'} w={'100%'} h={'100%'} py={1.5}> <Flex alignItems={'center'} w={'100%'} h={'100%'} py={1.5}>
{formLabel && ( {formLabel && (
...@@ -369,7 +387,7 @@ const MultipleSelect = <T = any,>({ ...@@ -369,7 +387,7 @@ const MultipleSelect = <T = any,>({
alignItems={'center'} alignItems={'center'}
> >
{(!isOpen || !canInput) && {(!isOpen || !canInput) &&
(isSelectAll ? ( (isAllSelected ? (
<Box fontSize={formLabelFontSize} color={'myGray.900'}> <Box fontSize={formLabelFontSize} color={'myGray.900'}>
{t('common:All')} {t('common:All')}
</Box> </Box>
...@@ -382,10 +400,11 @@ const MultipleSelect = <T = any,>({ ...@@ -382,10 +400,11 @@ const MultipleSelect = <T = any,>({
bg={'primary.100'} bg={'primary.100'}
color={'primary.700'} color={'primary.700'}
type={'fill'} type={'fill'}
borderRadius={'lg'} borderRadius={'sm'}
px={2} px={2}
py={0.5} py={0.5}
flexShrink={0} flexShrink={0}
{...selectedTagStyle}
{...tagStyle} {...tagStyle}
> >
{item.label} {item.label}
...@@ -460,7 +479,6 @@ const MultipleSelect = <T = any,>({ ...@@ -460,7 +479,6 @@ const MultipleSelect = <T = any,>({
{setIsSelectAll && ( {setIsSelectAll && (
<> <>
<MenuItem <MenuItem
color={isSelectAll ? 'primary.600' : 'myGray.900'}
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
...@@ -471,8 +489,9 @@ const MultipleSelect = <T = any,>({ ...@@ -471,8 +489,9 @@ const MultipleSelect = <T = any,>({
gap={2} gap={2}
mb={1} mb={1}
{...menuItemStyles} {...menuItemStyles}
color={isAllSelected ? 'primary.600' : 'myGray.900'}
> >
<Checkbox isChecked={isSelectAll} /> <Checkbox isChecked={isAllSelected} />
<Box flex={'1 0 0'}>{t('common:All')}</Box> <Box flex={'1 0 0'}>{t('common:All')}</Box>
</MenuItem> </MenuItem>
......
import type { FlexProps } from '@chakra-ui/react';
export type MySelectSize = 'sm' | 'md' | 'lg';
export const selectSizeStyleMap: Record<MySelectSize, Pick<FlexProps, 'h' | 'borderRadius'>> = {
sm: {
h: 8,
borderRadius: 'sm'
},
md: {
h: 9,
borderRadius: 'sm'
},
lg: {
h: 10,
borderRadius: 'md'
}
};
{ {
"active_model": "Available models",
"api_key": "API key", "api_key": "API key",
"bills_and_invoices": "Bills",
"custom_domain": "Custom Domain",
"confirm_logout": "Confirm to log out?",
"language": "Language and time zone",
"logout": "Sign out",
"model_provider": "Model Provider",
"notifications": "Notify",
"personal_information": "Personal",
"promotion_records": "Promotions",
"team": "Team",
"third_party": "Third Party",
"usage_records": "Usage",
"app_registration_count": "App registration count", "app_registration_count": "App registration count",
"audit_log_store_duration": "Audit log storage duration", "audit_log_store_duration": "Audit log storage duration",
"bill_detail": "Bill details", "bill_detail": "Bill details",
"bills_and_invoices": "Bills",
"channel": "Channel",
"chat_history_store_duration": "Chat history storage duration", "chat_history_store_duration": "Chat history storage duration",
"config_model": "Model configuration",
"confirm_logout": "Confirm to log out?",
"create_model": "Add new model",
"custom_config_details": "Custom configuration details", "custom_config_details": "Custom configuration details",
"custom_domain": "Custom Domain",
"day": "day", "day": "day",
"default_model_config": "Default model configuration",
"extra_ai_points": "AI points calculation standard", "extra_ai_points": "AI points calculation standard",
"extra_dataset_size": "Additional knowledge base capacity", "extra_dataset_size": "Additional knowledge base capacity",
"generation_time": "Generation time", "generation_time": "Generation time",
"has_invoice": "Whether the invoice has been issued", "has_invoice": "Whether the invoice has been issued",
"hour": "hour", "hour": "hour",
"language": "Language and time zone",
"logout": "Sign out",
"max_app_amount": "Max app amount", "max_app_amount": "Max app amount",
"max_dataset_amount": "Max dataset amount", "max_dataset_amount": "Max dataset amount",
"max_dataset_size": "Max dataset size", "max_dataset_size": "Max dataset size",
"max_team_member": "Max team members", "max_team_member": "Max team members",
"model.action": "Action",
"model.active": "Active",
"model.alias": "Alias",
"model.alias_tip": "The name of the model displayed in the system is convenient for users to understand.",
"model.basic_config_section": "Basic config",
"model.censor": "Censor check",
"model.censor_tip": "If sensitive verification is required, turn on this switch",
"model.charsPointsPrice": "Chars Price",
"model.charsPointsPrice_tip": "Combine the model input and output for Token billing. If the language model is configured with input and output billing separately, the input and output will be calculated separately.",
"model.dataset_process": "Dataset file parse",
"model.defaultConfig": "Additional Body parameters",
"model.defaultConfig_tip": "Each request will carry this additional Body parameter.",
"model.default_config": "Body extra fields",
"model.default_config_tip": "When initiating a conversation request, merge this configuration. \nFor example:\n\"\"\"\n{\n \"temperature\": 1,\n \"max_tokens\": null\n}\n\"\"\"",
"model.rerank_default_config_tip": "Merge this config when sending rerank requests. \nFor example:\n\"\"\"\n{\n \"topn\": 5\n}\n\"\"\"",
"model.default_model": "Default model",
"model.default_system_chat_prompt": "Default prompt",
"model.default_system_chat_prompt_tip": "When the model talks, it will carry this default prompt word.",
"model.default_token": "Default tokens",
"model.default_token_tip": "The length of the default text block of the index model must be less than the maximum length above",
"model.delete_model_confirm": "Confirm to delete this model?",
"model.edit_model": "Model parameter editing",
"model.feature_config_section": "Feature config",
"model.function_call": "Function Call",
"model.function_call_tip": "If the model supports function calling, turn on this switch. \nTool calls have higher priority.",
"model.input_price_tip": "Language model input price. If this item is configured, the model comprehensive price will be invalid.",
"model.json_config": "File config",
"model.json_config_confirm": "Confirm to use this configuration for override?",
"model.json_config_tip": "Configure the model through the configuration file. After clicking Confirm, the entered configuration will be used for full coverage. Please ensure that the configuration file is entered correctly. \nIt is recommended to copy the current configuration file for backup before operation.",
"model.max_quote": "KB max quote",
"model.max_temperature": "Max temperature",
"model.model_id": "Model ID",
"model.model_id_tip": "The unique identifier of the model, that is, the value of the actual request to the service provider model, needs to correspond to the model in the OneAPI channel.",
"model.normalization": "Normalization processing",
"model.normalization_tip": "If the Embedding API does not normalize vector values, the switch can be enabled and the system will normalize.\n\nUnnormalized APIs, which are represented by the vector search score greater than 1.",
"model.output_price_tip": "The language model output price. If this item is configured, the model comprehensive price will be invalid.",
"model.param_name": "Parameter name",
"model.params_config_section": "Parameter config",
"model.price_config_section": "Price config",
"model.price_tier": "Tier",
"model.price_tier_max_required": "All tiers except the last one need an upper bound",
"model.price_tier_open_ended": "Default is positive infinity",
"model.price_tier_prev_range_required": "Complete the previous tier upper bound first",
"model.price_tier_price_required": "Each price tier needs at least an input or output price",
"model.price_tier_range_invalid": "Invalid price tier range. Please make sure upper bounds keep increasing",
"model.price_tiers": "Price tiers",
"model.price_tiers_tip": "Match a tier by input token range, then bill input and output tokens with that tier's prices. Each next range starts after the previous upper bound. Leave the last upper bound empty to mean and above.",
"model.reasoning": "Model supports thinking",
"model.reasoning_tip": "For example, Deepseek-reasoner can output the thinking process.",
"model.reasoning_effort": "Support thinking config",
"model.request_auth": "Custom key",
"model.request_auth_tip": "When making a request to a custom request address, carry the request header: Authorization: Bearer xxx to make the request.",
"model.request_url": "Custom url",
"model.request_url_tip": "If this value is filled in, a request will be made directly to this address without going through the configuration of the model channel.\n\nThe interface needs to follow OpenAI’s API format and fill in the complete request address, for example:\n\nLLM: {{host}}/v1/chat/completions\nEmbedding: {{host}}/v1/embeddings\nSTT: {{host}}/v1/audio/transcriptions\nTTS: {{host}}/v1/audio/speech\nRerank: {{host}}/v1/rerank",
"model.response_format": "Response format",
"model.response_format_placeholder": "Custom parameters",
"model.show_stop_sign": "Display stop sequence parameters",
"model.show_top_p": "Show Top-p parameters",
"model.test_mode": "Mark as test model",
"model.test_mode_tip": "When enabled, the model will have a Beta logo added when selected.",
"model.test_model": "Model testing",
"model.tool_choice": "Tool choice",
"model.tool_choice_tag": "ToolCall",
"model.tool_choice_tip": "If the model supports tool calling, turn on this switch",
"model.used_in_classify": "Used for problem classification",
"model.used_in_extract_fields": "for text extraction",
"model.used_in_tool_call": "Used for tool call nodes",
"model.vision": "Vision model",
"model.vision_tag": "Vision",
"model.vision_tip": "If the model supports image recognition, turn on this switch.",
"model.embedding_vision_tip": "Enable this when the embedding model can accept image input for image vector indexing and image search.",
"model.voices": "voice role",
"model.voices_tip": "Configure multiple through an array, for example:\n\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]",
"model_provider": "Model Provider",
"month": "month", "month": "month",
"no": "no",
"notifications": "Notify",
"order_number": "Order number", "order_number": "Order number",
"order_type": "Order type", "order_type": "Order type",
"payment_method": "Payment method", "payment_method": "Payment method",
"personal_information": "Personal",
"promotion_records": "Promotions",
"requests_per_minute": "Requests per minute", "requests_per_minute": "Requests per minute",
"reset_default": "Restore default",
"status": "state", "status": "state",
"subscription_mode_month": "Duration", "subscription_mode_month": "Duration",
"subscription_package": "Subscription package", "subscription_package": "Subscription package",
"subscription_period": "Subscription cycle", "subscription_period": "Subscription cycle",
"support_wallet_amount": "Amount", "support_wallet_amount": "Amount",
"team": "Team",
"third_party": "Third Party",
"ticket_response_time": "Ticket response time", "ticket_response_time": "Ticket response time",
"upgrade_plan": "Upgrade plan",
"usage_records": "Usage",
"website_sync_per_dataset": "Website sync per dataset", "website_sync_per_dataset": "Website sync per dataset",
"yes": "yes", "yes": "yes",
"yuan": "¥{{amount}}" "no": "no",
"yuan": "¥{{amount}}",
"bill.not_need_invoice": "Balance payment, invoice not available"
} }
...@@ -36,5 +36,10 @@ ...@@ -36,5 +36,10 @@
"total_amount": "lump sum", "total_amount": "lump sum",
"type": "type", "type": "type",
"unit_code": "unified credit code", "unit_code": "unified credit code",
"wecom_not_pay_tip": "Not paid, payment address will be redirected soon" "wecom_not_pay_tip": "Not paid, payment address will be redirected soon",
"status": "state",
"support_wallet_amount": "Amount",
"yes": "yes",
"no": "no",
"yuan": "¥{{amount}}"
} }
...@@ -18,5 +18,6 @@ ...@@ -18,5 +18,6 @@
"registration_hint": "Please prepare your own domain and complete the ICP filing through <bold>{{provider}}</bold>, then fill in the domain in the input box below", "registration_hint": "Please prepare your own domain and complete the ICP filing through <bold>{{provider}}</bold>, then fill in the domain in the input box below",
"status.active": "Active", "status.active": "Active",
"status.inactive": "Inactive", "status.inactive": "Inactive",
"upgrade_to_use_custom_domain": "Current plan does not support custom domains, please upgrade first" "upgrade_to_use_custom_domain": "Current plan does not support custom domains, please upgrade first",
"upgrade_plan": "Upgrade plan"
} }
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
"aipoint_usage": "AI points", "aipoint_usage": "AI points",
"all": "All", "all": "All",
"api_key": "API key", "api_key": "API key",
"audio": "Audio recognition",
"audio_tip": "Turn this on if the model supports audio recognition.",
"avg_response_time": "Average call duration (seconds)", "avg_response_time": "Average call duration (seconds)",
"avg_ttfb": "Average first word duration (seconds)", "avg_ttfb": "Average first word duration (seconds)",
"base_url": "Base url", "base_url": "Base url",
...@@ -83,5 +85,86 @@ ...@@ -83,5 +85,86 @@
"vlm_model": "Vlm", "vlm_model": "Vlm",
"vlm_model_tip": "Automatically labels images in documents and generates text descriptions to assist text retrieval", "vlm_model_tip": "Automatically labels images in documents and generates text descriptions to assist text retrieval",
"volunme_of_failed_calls": "Error amount", "volunme_of_failed_calls": "Error amount",
"waiting_test": "Waiting for testing" "video": "Video recognition",
"video_tip": "Turn this on if the model supports video recognition.",
"waiting_test": "Waiting for testing",
"active_model": "Available models",
"channel": "Channel",
"config_model": "Model configuration",
"create_model": "Add new model",
"default_model_config": "Default model configuration",
"reset_default": "Restore default",
"model.action": "Action",
"model.active": "Active",
"model.alias": "Alias",
"model.alias_tip": "The name of the model displayed in the system is convenient for users to understand.",
"model.basic_config_section": "Basic config",
"model.censor": "Censor check",
"model.censor_tip": "If sensitive verification is required, turn on this switch",
"model.charsPointsPrice": "Chars Price",
"model.charsPointsPrice_tip": "Combine the model input and output for Token billing. If the language model is configured with input and output billing separately, the input and output will be calculated separately.",
"model.dataset_process": "Dataset file parse",
"model.defaultConfig": "Additional Body parameters",
"model.defaultConfig_tip": "Each request will carry this additional Body parameter.",
"model.default_config": "Body extra fields",
"model.default_config_tip": "When initiating a conversation request, merge this configuration. \nFor example:\n\"\"\"\n{\n \"temperature\": 1,\n \"max_tokens\": null\n}\n\"\"\"",
"model.rerank_default_config_tip": "Merge this config when sending rerank requests. \nFor example:\n\"\"\"\n{\n \"topn\": 5\n}\n\"\"\"",
"model.default_model": "Default model",
"model.default_system_chat_prompt": "Default prompt",
"model.default_system_chat_prompt_tip": "When the model talks, it will carry this default prompt word.",
"model.default_token": "Default tokens",
"model.default_token_tip": "The length of the default text block of the index model must be less than the maximum length above",
"model.delete_model_confirm": "Confirm to delete this model?",
"model.edit_model": "Model parameter editing",
"model.feature_config_section": "Feature config",
"model.function_call": "Function Call",
"model.function_call_tip": "If the model supports function calling, turn on this switch. \nTool calls have higher priority.",
"model.input_price_tip": "Language model input price. If this item is configured, the model comprehensive price will be invalid.",
"model.json_config": "File config",
"model.json_config_confirm": "Confirm to use this configuration for override?",
"model.json_config_tip": "Configure the model through the configuration file. After clicking Confirm, the entered configuration will be used for full coverage. Please ensure that the configuration file is entered correctly. \nIt is recommended to copy the current configuration file for backup before operation.",
"model.max_quote": "KB max quote",
"model.max_temperature": "Max temperature",
"model.model_id": "Model ID",
"model.model_id_tip": "The unique identifier of the model, that is, the value of the actual request to the service provider model, needs to correspond to the model in the OneAPI channel.",
"model.normalization": "Normalization processing",
"model.normalization_tip": "If the Embedding API does not normalize vector values, the switch can be enabled and the system will normalize.\n\nUnnormalized APIs, which are represented by the vector search score greater than 1.",
"model.output_price_tip": "The language model output price. If this item is configured, the model comprehensive price will be invalid.",
"model.param_name": "Parameter name",
"model.params_config_section": "Parameter config",
"model.price_config_section": "Price config",
"model.price_tier": "Tier",
"model.price_tier_max_required": "All tiers except the last one need an upper bound",
"model.price_tier_open_ended": "Default is positive infinity",
"model.price_tier_prev_range_required": "Complete the previous tier upper bound first",
"model.price_tier_price_required": "Each price tier needs at least an input or output price",
"model.price_tier_range_invalid": "Invalid price tier range. Please make sure upper bounds keep increasing",
"model.price_tiers": "Price tiers",
"model.price_tiers_tip": "Match a tier by input token range, then bill input and output tokens with that tier's prices. Each next range starts after the previous upper bound. Leave the last upper bound empty to mean and above.",
"model.reasoning": "Model supports thinking",
"model.reasoning_tip": "For example, Deepseek-reasoner can output the thinking process.",
"model.reasoning_effort": "Support thinking config",
"model.request_auth": "Custom key",
"model.request_auth_tip": "When making a request to a custom request address, carry the request header: Authorization: Bearer xxx to make the request.",
"model.request_url": "Custom url",
"model.request_url_tip": "If this value is filled in, a request will be made directly to this address without going through the configuration of the model channel.\n\nThe interface needs to follow OpenAI’s API format and fill in the complete request address, for example:\n\nLLM: {{host}}/v1/chat/completions\nEmbedding: {{host}}/v1/embeddings\nSTT: {{host}}/v1/audio/transcriptions\nTTS: {{host}}/v1/audio/speech\nRerank: {{host}}/v1/rerank",
"model.response_format": "Response format",
"model.response_format_placeholder": "Custom parameters",
"model.show_stop_sign": "Display stop sequence parameters",
"model.show_top_p": "Show Top-p parameters",
"model.test_mode": "Mark as test model",
"model.test_mode_tip": "When enabled, the model will have a Beta logo added when selected.",
"model.test_model": "Model testing",
"model.tool_choice": "Tool choice",
"model.tool_choice_tag": "ToolCall",
"model.tool_choice_tip": "If the model supports tool calling, turn on this switch",
"model.used_in_classify": "Used for problem classification",
"model.used_in_extract_fields": "for text extraction",
"model.used_in_tool_call": "Used for tool call nodes",
"model.vision": "Vision model",
"model.vision_tag": "Vision",
"model.vision_tip": "If the model supports image recognition, turn on this switch.",
"model.embedding_vision_tip": "Enable this when the embedding model can accept image input for image vector indexing and image search.",
"model.voices": "voice role",
"model.voices_tip": "Configure multiple through an array, for example:\n\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]"
} }
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
"Tool_description": "Tool description", "Tool_description": "Tool description",
"Tool_name": "Tool name", "Tool_name": "Tool name",
"ai_point_price": "Billing", "ai_point_price": "Billing",
"ai_setting_advanced_config": "Advanced settings",
"ai_setting_basic_config": "Basic settings", "ai_setting_basic_config": "Basic settings",
"ai_setting_reasoning_config": "Reasoning settings", "ai_setting_reasoning_config": "Reasoning settings",
"ai_setting_reasoning_config_tip": "Some models do not fully support every reasoning option. If you see an error, try a different reasoning option or use the default.", "ai_setting_reasoning_config_tip": "Some models do not fully support every reasoning option. If you see an error, try a different reasoning option or use the default.",
...@@ -170,8 +171,17 @@ ...@@ -170,8 +171,17 @@
"json_schema_tip": "Example:\n{\n \"name\": \"test\",\n \"description\":\"测试\",\n \"schema\": {\n \"type\":\"object\",\n \"properties\": {\n \"test\": {\n \"type\": \"string\",\n \"description\": \"Text field\"\n }\n },\n \"required\": [\n \"test\"\n ]\n }\n}", "json_schema_tip": "Example:\n{\n \"name\": \"test\",\n \"description\":\"测试\",\n \"schema\": {\n \"type\":\"object\",\n \"properties\": {\n \"test\": {\n \"type\": \"string\",\n \"description\": \"Text field\"\n }\n },\n \"required\": [\n \"test\"\n ]\n }\n}",
"keep_the_latest": "Keep the latest", "keep_the_latest": "Keep the latest",
"llm_not_support_vision": "This model does not support image recognition", "llm_not_support_vision": "This model does not support image recognition",
"llm_use_vision": "Vision", "llm_not_support_multimodal": "This model does not support multimodal recognition",
"llm_use_vision_tip": "After clicking on the model selection, you can see whether the model supports image recognition and the ability to control whether to start image recognition. \nAfter starting image recognition, the model will read the image content in the file link, and if the user question is less than 500 words, it will automatically parse the image in the user question.", "llm_use_multimodal": "Multimodal recognition",
"llm_multimodal_select_placeholder": "Select multimodal capabilities",
"llm_multimodal_image": "Image",
"llm_multimodal_audio": "Audio",
"llm_multimodal_video": "Video",
"extract_chat_files": "Extract chat files",
"extract_chat_files_tip": "When enabled, if the user question is shorter than 500 characters, multimodal files linked in the question are parsed and sent to the model for recognition.",
"llm_use_vision": "Image recognition",
"llm_use_audio": "Audio recognition",
"llm_use_video": "Video recognition",
"local_upload": "Local upload", "local_upload": "Local upload",
"log_detail": "Log details", "log_detail": "Log details",
"logs_all_records": "All Records", "logs_all_records": "All Records",
......
...@@ -246,6 +246,11 @@ ...@@ -246,6 +246,11 @@
"core.ai.model.doc_index_and_dialog": "Document Index & Dialog Index", "core.ai.model.doc_index_and_dialog": "Document Index & Dialog Index",
"core.ai.model.multimodal": "Multimodal", "core.ai.model.multimodal": "Multimodal",
"core.ai.model.multimodal_tip": "Multimodal embedding models can generate vectors for images.", "core.ai.model.multimodal_tip": "Multimodal embedding models can generate vectors for images.",
"core.ai.model.capability_audio": "audio",
"core.ai.model.capability_image": "image",
"core.ai.model.capability_video": "video",
"core.ai.model.multimodal_support_tip": "Supports {{modalities}}",
"core.ai.model.reasoning_tag": "Reasoning",
"core.app.Api request": "API Request", "core.app.Api request": "API Request",
"core.app.Api request desc": "Connect to existing systems via API", "core.app.Api request desc": "Connect to existing systems via API",
"core.app.App intro": "App Introduction", "core.app.App intro": "App Introduction",
......
{ {
"bill.buy_plan": "Purchase Plan", "bill.buy_plan": "Purchase Plan",
"bill.not_need_invoice": "Balance payment, invoice not available",
"bill.renew_plan": "Renew Plan", "bill.renew_plan": "Renew Plan",
"bill.standard_valid_tip": "Plan Usage Rules: Higher-level plans will be used first. Unused plans will be activated later.", "bill.standard_valid_tip": "Plan Usage Rules: Higher-level plans will be used first. Unused plans will be activated later.",
"manage_team": "Manage team", "manage_team": "Manage team",
......
{ {
"active_model": "可用模型",
"api_key": "API 密钥", "api_key": "API 密钥",
"bills_and_invoices": "账单与发票",
"custom_domain": "自定义域名",
"confirm_logout": "确认退出登录?",
"language": "语言与时区",
"logout": "登出",
"model_provider": "模型提供商",
"notifications": "通知",
"personal_information": "个人信息",
"promotion_records": "促销记录",
"team": "团队管理",
"third_party": "第三方账号",
"usage_records": "使用记录",
"app_registration_count": "应用备案数", "app_registration_count": "应用备案数",
"audit_log_store_duration": "团队操作日志记录时长", "audit_log_store_duration": "团队操作日志记录时长",
"bill_detail": "账单详情", "bill_detail": "账单详情",
"bills_and_invoices": "账单与发票",
"channel": "模型渠道",
"chat_history_store_duration": "对话记录保留时长", "chat_history_store_duration": "对话记录保留时长",
"config_model": "模型配置",
"confirm_logout": "确认退出登录?",
"create_model": "新增模型",
"custom_config_details": "定制配置详情", "custom_config_details": "定制配置详情",
"custom_domain": "自定义域名",
"day": "天", "day": "天",
"default_model_config": "默认模型配置",
"extra_ai_points": "额外 AI 积分", "extra_ai_points": "额外 AI 积分",
"extra_dataset_size": "额外知识库容量", "extra_dataset_size": "额外知识库容量",
"generation_time": "生成时间", "generation_time": "生成时间",
"has_invoice": "是否已开票", "has_invoice": "是否已开票",
"hour": "小时", "hour": "小时",
"language": "语言与时区",
"logout": "登出",
"max_app_amount": "Agent 上限", "max_app_amount": "Agent 上限",
"max_dataset_amount": "知识库上限", "max_dataset_amount": "知识库上限",
"max_dataset_size": "知识库索引上限", "max_dataset_size": "知识库索引上限",
"max_team_member": "团队成员上限", "max_team_member": "团队成员上限",
"model.action": "操作",
"model.active": "启用",
"model.alias": "别名",
"model.alias_tip": "模型在系统中展示的名字,方便用户理解",
"model.basic_config_section": "基本配置",
"model.censor": "启用敏感校验",
"model.censor_tip": "如果需要进行敏感校验,则开启该开关",
"model.charsPointsPrice": "模型综合价格",
"model.charsPointsPrice_tip": "将模型输入和输出合并起来进行 Token 计费,语言模型如果单独配置了输入和输出计费,则按输入和输出分别计算",
"model.dataset_process": "用于知识库文件处理",
"model.defaultConfig": "额外 Body 参数",
"model.defaultConfig_tip": "每次请求时候,都会携带该额外 Body 参数",
"model.default_config": "Body 额外字段",
"model.default_config_tip": "发起对话请求时候,合并该配置。例如:\n\"\"\"\n{\n \"temperature\": 1,\n \"max_tokens\": null\n}\n\"\"\"",
"model.rerank_default_config_tip": "发起重排请求时候,合并该配置。例如:\n\"\"\"\n{\n \"topn\": 5\n}\n\"\"\"",
"model.default_model": "默认模型",
"model.default_system_chat_prompt": "默认提示词",
"model.default_system_chat_prompt_tip": "模型对话时,都会携带该默认提示词",
"model.default_token": "默认分块长度",
"model.default_token_tip": "索引模型默认文本分块的长度,必须小于最大上文",
"model.delete_model_confirm": "确认删除该模型?",
"model.edit_model": "模型参数编辑",
"model.feature_config_section": "功能配置",
"model.function_call": "支持函数调用",
"model.function_call_tip": "如果模型支持函数调用,则开启该开关。工具调用优先级更高。",
"model.input_price_tip": "语言模型输入价格,如果配置了该项,则模型综合价格会失效",
"model.json_config": "配置文件",
"model.json_config_confirm": "确认使用该配置进行覆盖?",
"model.json_config_tip": "通过配置文件配置模型,点击确认后,会使用输入的配置进行全量覆盖,请确保配置文件输入正确。建议操作前,复制当前配置文件进行备份。",
"model.max_quote": "知识库最大引用",
"model.max_temperature": "最大温度",
"model.model_id": "模型ID",
"model.model_id_tip": "模型的唯一标识,也就是实际请求到服务商model 的值,需要与 OneAPI 渠道中的模型对应。",
"model.normalization": "归一化处理",
"model.normalization_tip": "如果Embedding API 未对向量值进行归一化,可以启用该开关,系统会进行归一化处理。\n未归一化的 API,表现为向量检索得分会大于 1。",
"model.output_price_tip": "语言模型输出价格,如果配置了该项,则模型综合价格会失效",
"model.param_name": "参数名",
"model.params_config_section": "参数配置",
"model.price_config_section": "价格配置",
"model.price_tier": "梯度",
"model.price_tier_max_required": "除最后一个梯度外,都需要填写区间上限",
"model.price_tier_open_ended": "默认正无穷",
"model.price_tier_prev_range_required": "请先补全上一梯度的区间上限",
"model.price_tier_price_required": "每个价格梯度都需要至少配置一个输入价或输出价",
"model.price_tier_range_invalid": "价格梯度区间设置有误,请检查区间上限是否递增",
"model.price_tiers": "模型价格梯度",
"model.price_tiers_tip": "按输入 Token 所在区间匹配一个梯度,再使用该梯度的输入价格和输出价格分别计费。区间起点自动按上一梯度递增,最后一个梯度上限留空表示及以上。",
"model.reasoning": "模型支持思考",
"model.reasoning_tip": "例如 Deepseek-reasoner,可以输出思考过程。",
"model.reasoning_effort": "支持思考配置",
"model.request_auth": "自定义请求 Key",
"model.request_auth_tip": "向自定义请求地址发起请求时候,携带请求头:Authorization: Bearer xxx 进行请求",
"model.request_url": "自定义请求地址",
"model.request_url_tip": "如果填写该值,则会直接向该地址发起请求,不经过模型渠道的配置。\n接口需要遵循 OpenAI 的 API格式,并填写完整请求地址,例如:\nLLM: {{host}}/v1/chat/completions\nEmbedding: {{host}}/v1/embeddings\nSTT: {{host}}/v1/audio/transcriptions\nTTS: {{host}}/v1/audio/speech\nRerank: {{host}}/v1/rerank",
"model.response_format": "响应格式",
"model.response_format_placeholder": "自定义参数",
"model.show_stop_sign": "展示停止序列参数",
"model.show_top_p": "展示 Top-p 参数",
"model.test_mode": "标记为测试模型",
"model.test_mode_tip": "开启后,该模型在选择时候,将会增加 Beta 标志。",
"model.test_model": "模型测试",
"model.tool_choice": "支持工具调用",
"model.tool_choice_tag": "工具调用",
"model.tool_choice_tip": "如果该模型支持工具调用,则开启该开关",
"model.used_in_classify": "用于问题分类",
"model.used_in_extract_fields": "用于文本提取",
"model.used_in_tool_call": "用于工具调用节点",
"model.vision": "支持图片识别",
"model.vision_tag": "视觉",
"model.vision_tip": "如果模型支持图片识别,则打开该开关。",
"model.embedding_vision_tip": "开启后该索引模型可接收图片输入,并用于图片向量索引和图搜图。",
"model.voices": "声音角色",
"model.voices_tip": "通过一个数组配置多个,例如:\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]",
"model_provider": "模型提供商",
"month": "月", "month": "月",
"no": "否",
"notifications": "通知",
"order_number": "订单号", "order_number": "订单号",
"order_type": "订单类型", "order_type": "订单类型",
"payment_method": "支付方式", "payment_method": "支付方式",
"personal_information": "个人信息",
"promotion_records": "促销记录",
"requests_per_minute": "QPM", "requests_per_minute": "QPM",
"reset_default": "恢复默认",
"status": "状态", "status": "状态",
"subscription_mode_month": "时长", "subscription_mode_month": "时长",
"subscription_package": "订阅套餐", "subscription_package": "订阅套餐",
"subscription_period": "订阅周期", "subscription_period": "订阅周期",
"support_wallet_amount": "金额", "support_wallet_amount": "金额",
"team": "团队管理",
"third_party": "第三方账号",
"ticket_response_time": "工单支持响应时间", "ticket_response_time": "工单支持响应时间",
"upgrade_plan": "升级套餐",
"usage_records": "使用记录",
"website_sync_per_dataset": "站点同步最大页数", "website_sync_per_dataset": "站点同步最大页数",
"yes": "是", "yes": "是",
"yuan": "{{amount}}元" "no": "否",
"yuan": "{{amount}}元",
"bill.not_need_invoice": "余额支付,无法开票"
} }
...@@ -36,5 +36,10 @@ ...@@ -36,5 +36,10 @@
"total_amount": "总金额", "total_amount": "总金额",
"type": "类型", "type": "类型",
"unit_code": "统一信用代码", "unit_code": "统一信用代码",
"wecom_not_pay_tip": "未支付,即将跳转支付地址" "wecom_not_pay_tip": "未支付,即将跳转支付地址",
"status": "状态",
"support_wallet_amount": "金额",
"yes": "是",
"no": "否",
"yuan": "{{amount}}元"
} }
...@@ -18,5 +18,6 @@ ...@@ -18,5 +18,6 @@
"registration_hint": "请自备域名并通过 <bold>{{provider}}</bold> 完成备案后,将域名填入下方输入框中", "registration_hint": "请自备域名并通过 <bold>{{provider}}</bold> 完成备案后,将域名填入下方输入框中",
"status.active": "已生效", "status.active": "已生效",
"status.inactive": "未生效", "status.inactive": "未生效",
"upgrade_to_use_custom_domain": "当前套餐不支持自定义域名,请先升级" "upgrade_to_use_custom_domain": "当前套餐不支持自定义域名,请先升级",
"upgrade_plan": "升级套餐"
} }
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
"aipoint_usage": "积分消耗", "aipoint_usage": "积分消耗",
"all": "全部", "all": "全部",
"api_key": "API 密钥", "api_key": "API 密钥",
"audio": "支持音频识别",
"audio_tip": "如果模型支持音频识别,则打开该开关。",
"avg_response_time": "平均调用时长(秒)", "avg_response_time": "平均调用时长(秒)",
"avg_ttfb": "平均首字时长(秒)", "avg_ttfb": "平均首字时长(秒)",
"base_url": "代理地址", "base_url": "代理地址",
...@@ -83,5 +85,86 @@ ...@@ -83,5 +85,86 @@
"vlm_model": "图片理解模型", "vlm_model": "图片理解模型",
"vlm_model_tip": "自动标注文档里的图片并生成文本描述,辅助文本检索", "vlm_model_tip": "自动标注文档里的图片并生成文本描述,辅助文本检索",
"volunme_of_failed_calls": "调用失败量", "volunme_of_failed_calls": "调用失败量",
"waiting_test": "等待测试" "video": "支持视频识别",
"video_tip": "如果模型支持视频识别,则打开该开关。",
"waiting_test": "等待测试",
"active_model": "可用模型",
"channel": "模型渠道",
"config_model": "模型配置",
"create_model": "新增模型",
"default_model_config": "默认模型配置",
"reset_default": "恢复默认",
"model.action": "操作",
"model.active": "启用",
"model.alias": "别名",
"model.alias_tip": "模型在系统中展示的名字,方便用户理解",
"model.basic_config_section": "基本配置",
"model.censor": "启用敏感校验",
"model.censor_tip": "如果需要进行敏感校验,则开启该开关",
"model.charsPointsPrice": "模型综合价格",
"model.charsPointsPrice_tip": "将模型输入和输出合并起来进行 Token 计费,语言模型如果单独配置了输入和输出计费,则按输入和输出分别计算",
"model.dataset_process": "用于知识库文件处理",
"model.defaultConfig": "额外 Body 参数",
"model.defaultConfig_tip": "每次请求时候,都会携带该额外 Body 参数",
"model.default_config": "Body 额外字段",
"model.default_config_tip": "发起对话请求时候,合并该配置。例如:\n\"\"\"\n{\n \"temperature\": 1,\n \"max_tokens\": null\n}\n\"\"\"",
"model.rerank_default_config_tip": "发起重排请求时候,合并该配置。例如:\n\"\"\"\n{\n \"topn\": 5\n}\n\"\"\"",
"model.default_model": "默认模型",
"model.default_system_chat_prompt": "默认提示词",
"model.default_system_chat_prompt_tip": "模型对话时,都会携带该默认提示词",
"model.default_token": "默认分块长度",
"model.default_token_tip": "索引模型默认文本分块的长度,必须小于最大上文",
"model.delete_model_confirm": "确认删除该模型?",
"model.edit_model": "模型参数编辑",
"model.feature_config_section": "功能配置",
"model.function_call": "支持函数调用",
"model.function_call_tip": "如果模型支持函数调用,则开启该开关。工具调用优先级更高。",
"model.input_price_tip": "语言模型输入价格,如果配置了该项,则模型综合价格会失效",
"model.json_config": "配置文件",
"model.json_config_confirm": "确认使用该配置进行覆盖?",
"model.json_config_tip": "通过配置文件配置模型,点击确认后,会使用输入的配置进行全量覆盖,请确保配置文件输入正确。建议操作前,复制当前配置文件进行备份。",
"model.max_quote": "知识库最大引用",
"model.max_temperature": "最大温度",
"model.model_id": "模型ID",
"model.model_id_tip": "模型的唯一标识,也就是实际请求到服务商model 的值,需要与 OneAPI 渠道中的模型对应。",
"model.normalization": "归一化处理",
"model.normalization_tip": "如果Embedding API 未对向量值进行归一化,可以启用该开关,系统会进行归一化处理。\n未归一化的 API,表现为向量检索得分会大于 1。",
"model.output_price_tip": "语言模型输出价格,如果配置了该项,则模型综合价格会失效",
"model.param_name": "参数名",
"model.params_config_section": "参数配置",
"model.price_config_section": "价格配置",
"model.price_tier": "梯度",
"model.price_tier_max_required": "除最后一个梯度外,都需要填写区间上限",
"model.price_tier_open_ended": "默认正无穷",
"model.price_tier_prev_range_required": "请先补全上一梯度的区间上限",
"model.price_tier_price_required": "每个价格梯度都需要至少配置一个输入价或输出价",
"model.price_tier_range_invalid": "价格梯度区间设置有误,请检查区间上限是否递增",
"model.price_tiers": "模型价格梯度",
"model.price_tiers_tip": "按输入 Token 所在区间匹配一个梯度,再使用该梯度的输入价格和输出价格分别计费。区间起点自动按上一梯度递增,最后一个梯度上限留空表示及以上。",
"model.reasoning": "模型支持思考",
"model.reasoning_tip": "例如 Deepseek-reasoner,可以输出思考过程。",
"model.reasoning_effort": "支持思考配置",
"model.request_auth": "自定义请求 Key",
"model.request_auth_tip": "向自定义请求地址发起请求时候,携带请求头:Authorization: Bearer xxx 进行请求",
"model.request_url": "自定义请求地址",
"model.request_url_tip": "如果填写该值,则会直接向该地址发起请求,不经过模型渠道的配置。\n接口需要遵循 OpenAI 的 API格式,并填写完整请求地址,例如:\nLLM: {{host}}/v1/chat/completions\nEmbedding: {{host}}/v1/embeddings\nSTT: {{host}}/v1/audio/transcriptions\nTTS: {{host}}/v1/audio/speech\nRerank: {{host}}/v1/rerank",
"model.response_format": "响应格式",
"model.response_format_placeholder": "自定义参数",
"model.show_stop_sign": "展示停止序列参数",
"model.show_top_p": "展示 Top-p 参数",
"model.test_mode": "标记为测试模型",
"model.test_mode_tip": "开启后,该模型在选择时候,将会增加 Beta 标志。",
"model.test_model": "模型测试",
"model.tool_choice": "支持工具调用",
"model.tool_choice_tag": "工具调用",
"model.tool_choice_tip": "如果该模型支持工具调用,则开启该开关",
"model.used_in_classify": "用于问题分类",
"model.used_in_extract_fields": "用于文本提取",
"model.used_in_tool_call": "用于工具调用节点",
"model.vision": "支持图片识别",
"model.vision_tag": "视觉",
"model.vision_tip": "如果模型支持图片识别,则打开该开关。",
"model.embedding_vision_tip": "开启后该索引模型可接收图片输入,并用于图片向量索引和图搜图。",
"model.voices": "声音角色",
"model.voices_tip": "通过一个数组配置多个,例如:\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]"
} }
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
"Tool_description": "工具描述", "Tool_description": "工具描述",
"Tool_name": "工具名称", "Tool_name": "工具名称",
"ai_point_price": "AI积分计费", "ai_point_price": "AI积分计费",
"ai_setting_advanced_config": "高级配置",
"ai_setting_basic_config": "基础配置", "ai_setting_basic_config": "基础配置",
"ai_setting_reasoning_config": "思考配置", "ai_setting_reasoning_config": "思考配置",
"ai_setting_reasoning_config_tip": "部分模型未完全适配所有思考配置,如提示报错,请尝试切换其他思考配置选项或使用默认选项。", "ai_setting_reasoning_config_tip": "部分模型未完全适配所有思考配置,如提示报错,请尝试切换其他思考配置选项或使用默认选项。",
...@@ -170,8 +171,17 @@ ...@@ -170,8 +171,17 @@
"json_schema_tip": "示例:\n{\n \"name\": \"test\",\n \"description\":\"测试\",\n \"schema\": {\n \"type\":\"object\",\n \"properties\": {\n \"test\": {\n \"type\": \"string\",\n \"description\": \"Text field\"\n }\n },\n \"required\": [\n \"test\"\n ]\n }\n}", "json_schema_tip": "示例:\n{\n \"name\": \"test\",\n \"description\":\"测试\",\n \"schema\": {\n \"type\":\"object\",\n \"properties\": {\n \"test\": {\n \"type\": \"string\",\n \"description\": \"Text field\"\n }\n },\n \"required\": [\n \"test\"\n ]\n }\n}",
"keep_the_latest": "保持最新版本", "keep_the_latest": "保持最新版本",
"llm_not_support_vision": "该模型不支持图片识别", "llm_not_support_vision": "该模型不支持图片识别",
"llm_not_support_multimodal": "该模型不支持多模态识别",
"llm_use_multimodal": "多模态识别",
"llm_multimodal_select_placeholder": "请选择多模态能力",
"llm_multimodal_image": "图片",
"llm_multimodal_audio": "音频",
"llm_multimodal_video": "视频",
"extract_chat_files": "提取对话文件",
"extract_chat_files_tip": "开启后,当用户问题少于 500 字,将读取并解析用户问题中以链接形式存在的多模态文件,并发送给模型识别。",
"llm_use_vision": "图片识别", "llm_use_vision": "图片识别",
"llm_use_vision_tip": "点击模型选择后,可以看到模型是否支持图片识别以及控制是否启动图片识别的能力。启动图片识别后,模型会读取文件链接里图片内容,并且如果用户问题少于 500 字,会自动解析用户问题中的图片。", "llm_use_audio": "音频识别",
"llm_use_video": "视频识别",
"local_upload": "本地上传", "local_upload": "本地上传",
"log_detail": "日志详情", "log_detail": "日志详情",
"logs_all_records": "全部记录", "logs_all_records": "全部记录",
......
...@@ -246,6 +246,11 @@ ...@@ -246,6 +246,11 @@
"core.ai.model.doc_index_and_dialog": "文档索引 & 对话索引", "core.ai.model.doc_index_and_dialog": "文档索引 & 对话索引",
"core.ai.model.multimodal": "多模态", "core.ai.model.multimodal": "多模态",
"core.ai.model.multimodal_tip": "多模态索引模型可以给图片生成向量。", "core.ai.model.multimodal_tip": "多模态索引模型可以给图片生成向量。",
"core.ai.model.capability_audio": "音频",
"core.ai.model.capability_image": "图片",
"core.ai.model.capability_video": "视频",
"core.ai.model.multimodal_support_tip": "支持{{modalities}}能力",
"core.ai.model.reasoning_tag": "思考",
"core.app.Api request": "API 访问", "core.app.Api request": "API 访问",
"core.app.Api request desc": "通过 API 接入已有系统", "core.app.Api request desc": "通过 API 接入已有系统",
"core.app.App intro": "应用介绍", "core.app.App intro": "应用介绍",
......
{ {
"bill.buy_plan": "购买套餐", "bill.buy_plan": "购买套餐",
"bill.not_need_invoice": "余额支付,无法开票",
"bill.renew_plan": "续费套餐", "bill.renew_plan": "续费套餐",
"bill.standard_valid_tip": "套餐使用规则:系统优先使用更高级的套餐,原未用完的套餐将延后生效", "bill.standard_valid_tip": "套餐使用规则:系统优先使用更高级的套餐,原未用完的套餐将延后生效",
"manage_team": "管理团队", "manage_team": "管理团队",
......
{ {
"active_model": "可用模型",
"api_key": "API 金鑰", "api_key": "API 金鑰",
"bills_and_invoices": "帳單與發票",
"custom_domain": "自訂域名",
"confirm_logout": "確認登出?",
"language": "語言與時區",
"logout": "登出",
"model_provider": "模型提供者",
"notifications": "通知",
"personal_information": "個人資訊",
"promotion_records": "促銷記錄",
"team": "團隊管理",
"third_party": "第三方帳號",
"usage_records": "使用記錄",
"app_registration_count": "應用備案數", "app_registration_count": "應用備案數",
"audit_log_store_duration": "團隊操作日誌記錄時長", "audit_log_store_duration": "團隊操作日誌記錄時長",
"bill_detail": "帳單詳細資訊", "bill_detail": "帳單詳細資訊",
"bills_and_invoices": "帳單與發票",
"channel": "模型管道",
"chat_history_store_duration": "對話記錄保留時長", "chat_history_store_duration": "對話記錄保留時長",
"config_model": "模型設定",
"confirm_logout": "確認登出?",
"create_model": "新增模型",
"custom_config_details": "定制配置詳情", "custom_config_details": "定制配置詳情",
"custom_domain": "自訂域名",
"day": "天", "day": "天",
"default_model_config": "預設模型設定",
"extra_ai_points": "AI 積分運算標準", "extra_ai_points": "AI 積分運算標準",
"extra_dataset_size": "額外知識庫容量", "extra_dataset_size": "額外知識庫容量",
"generation_time": "生成時間", "generation_time": "生成時間",
"has_invoice": "是否已開票", "has_invoice": "是否已開票",
"hour": "小時", "hour": "小時",
"language": "語言與時區",
"logout": "登出",
"max_app_amount": "Agent 上限", "max_app_amount": "Agent 上限",
"max_dataset_amount": "知識庫上限", "max_dataset_amount": "知識庫上限",
"max_dataset_size": "知識庫索引上限", "max_dataset_size": "知識庫索引上限",
"max_team_member": "團隊成員上限", "max_team_member": "團隊成員上限",
"model.action": "操作",
"model.active": "啟用",
"model.alias": "別名",
"model.alias_tip": "模型在系統中展示的名字,方便使用者理解",
"model.basic_config_section": "基本配置",
"model.censor": "啟用敏感校驗",
"model.censor_tip": "如果需要進行敏感校驗,則開啟該開關",
"model.charsPointsPrice": "模型綜合價格",
"model.charsPointsPrice_tip": "將模型輸入和輸出合併起來進行 Token 計費,語言模型如果單獨設定了輸入和輸出計費,則按輸入和輸出分別計算",
"model.dataset_process": "用於知識庫文件處理",
"model.defaultConfig": "額外 Body 參數",
"model.defaultConfig_tip": "每次請求時候,都會攜帶該額外 Body 參數",
"model.default_config": "Body 額外欄位",
"model.default_config_tip": "發起對話請求時候,合併該設定。例如:\n\"\"\"\n{\n \"temperature\": 1,\n \"max_tokens\": null\n}\n\"\"\"",
"model.rerank_default_config_tip": "發起重排請求時候,合併該設定。例如:\n\"\"\"\n{\n \"topn\": 5\n}\n\"\"\"",
"model.default_model": "預設模型",
"model.default_system_chat_prompt": "預設提示詞",
"model.default_system_chat_prompt_tip": "模型對話時,都會攜帶該預設提示詞",
"model.default_token": "預設分塊長度",
"model.default_token_tip": "索引模型預設文字分塊的長度,必須小於最大上文",
"model.delete_model_confirm": "確認刪除該模型?",
"model.edit_model": "模型參數編輯",
"model.feature_config_section": "功能配置",
"model.function_call": "支援函式呼叫",
"model.function_call_tip": "如果模型支援函式呼叫,則開啟該開關。\n工具呼叫優先權更高。",
"model.input_price_tip": "語言模型輸入價格,如果設定了該項,則模型綜合價格會失效",
"model.json_config": "設定檔",
"model.json_config_confirm": "確認使用該設定進行覆蓋?",
"model.json_config_tip": "透過設定檔設定模型,點選確認後,會使用輸入的設定進行全量覆蓋,請確保設定檔輸入正確。\n建議操作前,複製目前設定檔進行備份。",
"model.max_quote": "知識庫最大引用",
"model.max_temperature": "最大溫度",
"model.model_id": "模型 ID",
"model.model_id_tip": "模型的唯一標識,也就是實際請求到服務商 model 的值,需要與 OneAPI 管道中的模型對應。",
"model.normalization": "歸一化處理",
"model.normalization_tip": "如果 Embedding API 未對向量值進行歸一化,可以啟用該開關,系統會進行歸一化處理。\n未歸一化的 API,表現為向量檢索得分會大於 1。",
"model.output_price_tip": "語言模型輸出價格,如果設定了該項,則模型綜合價格會失效",
"model.param_name": "參數名稱",
"model.params_config_section": "參數配置",
"model.price_config_section": "價格配置",
"model.price_tier": "梯度",
"model.price_tier_max_required": "除了最後一個梯度,其餘都需要填寫區間上限",
"model.price_tier_open_ended": "預設無窮",
"model.price_tier_prev_range_required": "請先補齊上一梯度的區間上限",
"model.price_tier_price_required": "每個價格梯度都需要至少設定一個輸入價或輸出價",
"model.price_tier_range_invalid": "價格梯度區間設定有誤,請確認區間上限有持續遞增",
"model.price_tiers": "模型價格梯度",
"model.price_tiers_tip": "依輸入 Token 所在區間匹配一個梯度,再使用該梯度的輸入價格和輸出價格分別計費。區間起點會依上一梯度自動遞增,最後一個梯度上限留空表示及以上。",
"model.reasoning": "模型支援思考",
"model.reasoning_tip": "例如 Deepseek-reasoner,可以輸出思考過程。",
"model.reasoning_effort": "支援思考配置",
"model.request_auth": "自訂請求 Key",
"model.request_auth_tip": "向自訂請求地址發起請求時候,攜帶請求頭:Authorization: Bearer xxx 進行請求",
"model.request_url": "自訂請求地址",
"model.request_url_tip": "如果填寫該值,則會直接向該地址發起請求,不經過模型渠道的配置。\n\n接口需要遵循 OpenAI 的 API格式,並填寫完整請求地址,例如:\nLLM: {{host}}/v1/chat/completions\nEmbedding: {{host}}/v1/embeddings\nSTT: {{host}}/v1/audio/transcriptions\nTTS: {{host}}/v1/audio/speech\nRerank: {{host}}/v1/rerank",
"model.response_format": "響應格式",
"model.response_format_placeholder": "自訂參數",
"model.show_stop_sign": "展示停止序列參數",
"model.show_top_p": "展示 Top-p 參數",
"model.test_mode": "標記為測試模型",
"model.test_mode_tip": "開啟後,該模型在選擇時候,將會增加 Beta 標誌。",
"model.test_model": "模型測試",
"model.tool_choice": "支援工具呼叫",
"model.tool_choice_tag": "工具呼叫",
"model.tool_choice_tip": "如果該模型支援工具呼叫,則開啟該開關",
"model.used_in_classify": "用於問題分類",
"model.used_in_extract_fields": "用於文字擷取",
"model.used_in_tool_call": "用於工具呼叫節點",
"model.vision": "支援圖片識別",
"model.vision_tag": "視覺",
"model.vision_tip": "如果模型支援圖片識別,則開啟該開關。",
"model.embedding_vision_tip": "開啟後該索引模型可接收圖片輸入,並用於圖片向量索引和圖搜圖。",
"model.voices": "聲音角色",
"model.voices_tip": "透過一個陣列設定多個,例如:\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]",
"model_provider": "模型提供者",
"month": "月", "month": "月",
"no": "否",
"notifications": "通知",
"order_number": "訂單編號", "order_number": "訂單編號",
"order_type": "訂單類型", "order_type": "訂單類型",
"payment_method": "支付方式", "payment_method": "支付方式",
"personal_information": "個人資訊",
"promotion_records": "促銷記錄",
"requests_per_minute": "QPM", "requests_per_minute": "QPM",
"reset_default": "恢復預設",
"status": "狀態", "status": "狀態",
"subscription_mode_month": "時長", "subscription_mode_month": "時長",
"subscription_package": "訂閱套餐", "subscription_package": "訂閱套餐",
"subscription_period": "訂閱週期", "subscription_period": "訂閱週期",
"support_wallet_amount": "金額", "support_wallet_amount": "金額",
"team": "團隊管理",
"third_party": "第三方帳號",
"ticket_response_time": "工單支援響應時間", "ticket_response_time": "工單支援響應時間",
"upgrade_plan": "升級套餐",
"usage_records": "使用記錄",
"website_sync_per_dataset": "站點同步最大頁數", "website_sync_per_dataset": "站點同步最大頁數",
"yes": "是", "yes": "是",
"yuan": "{{amount}}元" "no": "否",
"yuan": "{{amount}}元",
"bill.not_need_invoice": "餘額支付無法開立發票"
} }
...@@ -36,5 +36,10 @@ ...@@ -36,5 +36,10 @@
"total_amount": "總金額", "total_amount": "總金額",
"type": "類型", "type": "類型",
"unit_code": "統一信用代碼", "unit_code": "統一信用代碼",
"wecom_not_pay_tip": "未支付,即將跳轉支付地址" "wecom_not_pay_tip": "未支付,即將跳轉支付地址",
"status": "狀態",
"support_wallet_amount": "金額",
"yes": "是",
"no": "否",
"yuan": "{{amount}}元"
} }
...@@ -18,5 +18,6 @@ ...@@ -18,5 +18,6 @@
"registration_hint": "請自備域名並透過 <bold>{{provider}}</bold> 完成備案後,將域名填入下方輸入框中", "registration_hint": "請自備域名並透過 <bold>{{provider}}</bold> 完成備案後,將域名填入下方輸入框中",
"status.active": "已生效", "status.active": "已生效",
"status.inactive": "未生效", "status.inactive": "未生效",
"upgrade_to_use_custom_domain": "目前套餐不支援自訂域名,請先升級" "upgrade_to_use_custom_domain": "目前套餐不支援自訂域名,請先升級",
"upgrade_plan": "升級套餐"
} }
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
"aipoint_usage": "積分消耗", "aipoint_usage": "積分消耗",
"all": "全部", "all": "全部",
"api_key": "API 金鑰", "api_key": "API 金鑰",
"audio": "支援音頻識別",
"audio_tip": "如果模型支援音頻識別,則開啟該開關。",
"avg_response_time": "平均調用時長(秒)", "avg_response_time": "平均調用時長(秒)",
"avg_ttfb": "平均首字時長(秒)", "avg_ttfb": "平均首字時長(秒)",
"base_url": "代理地址", "base_url": "代理地址",
...@@ -83,5 +85,86 @@ ...@@ -83,5 +85,86 @@
"vlm_model": "圖片理解模型", "vlm_model": "圖片理解模型",
"vlm_model_tip": "自動標註文件裡的圖片並生成文字描述,輔助文字檢索", "vlm_model_tip": "自動標註文件裡的圖片並生成文字描述,輔助文字檢索",
"volunme_of_failed_calls": "調用失敗量", "volunme_of_failed_calls": "調用失敗量",
"waiting_test": "等待測試" "video": "支援視頻識別",
"video_tip": "如果模型支援視頻識別,則開啟該開關。",
"waiting_test": "等待測試",
"active_model": "可用模型",
"channel": "模型管道",
"config_model": "模型設定",
"create_model": "新增模型",
"default_model_config": "預設模型設定",
"reset_default": "恢復預設",
"model.action": "操作",
"model.active": "啟用",
"model.alias": "別名",
"model.alias_tip": "模型在系統中展示的名字,方便使用者理解",
"model.basic_config_section": "基本配置",
"model.censor": "啟用敏感校驗",
"model.censor_tip": "如果需要進行敏感校驗,則開啟該開關",
"model.charsPointsPrice": "模型綜合價格",
"model.charsPointsPrice_tip": "將模型輸入和輸出合併起來進行 Token 計費,語言模型如果單獨設定了輸入和輸出計費,則按輸入和輸出分別計算",
"model.dataset_process": "用於知識庫文件處理",
"model.defaultConfig": "額外 Body 參數",
"model.defaultConfig_tip": "每次請求時候,都會攜帶該額外 Body 參數",
"model.default_config": "Body 額外欄位",
"model.default_config_tip": "發起對話請求時候,合併該設定。例如:\n\"\"\"\n{\n \"temperature\": 1,\n \"max_tokens\": null\n}\n\"\"\"",
"model.rerank_default_config_tip": "發起重排請求時候,合併該設定。例如:\n\"\"\"\n{\n \"topn\": 5\n}\n\"\"\"",
"model.default_model": "預設模型",
"model.default_system_chat_prompt": "預設提示詞",
"model.default_system_chat_prompt_tip": "模型對話時,都會攜帶該預設提示詞",
"model.default_token": "預設分塊長度",
"model.default_token_tip": "索引模型預設文字分塊的長度,必須小於最大上文",
"model.delete_model_confirm": "確認刪除該模型?",
"model.edit_model": "模型參數編輯",
"model.feature_config_section": "功能配置",
"model.function_call": "支援函式呼叫",
"model.function_call_tip": "如果模型支援函式呼叫,則開啟該開關。\n工具呼叫優先權更高。",
"model.input_price_tip": "語言模型輸入價格,如果設定了該項,則模型綜合價格會失效",
"model.json_config": "設定檔",
"model.json_config_confirm": "確認使用該設定進行覆蓋?",
"model.json_config_tip": "透過設定檔設定模型,點選確認後,會使用輸入的設定進行全量覆蓋,請確保設定檔輸入正確。\n建議操作前,複製目前設定檔進行備份。",
"model.max_quote": "知識庫最大引用",
"model.max_temperature": "最大溫度",
"model.model_id": "模型 ID",
"model.model_id_tip": "模型的唯一標識,也就是實際請求到服務商 model 的值,需要與 OneAPI 管道中的模型對應。",
"model.normalization": "歸一化處理",
"model.normalization_tip": "如果 Embedding API 未對向量值進行歸一化,可以啟用該開關,系統會進行歸一化處理。\n未歸一化的 API,表現為向量檢索得分會大於 1。",
"model.output_price_tip": "語言模型輸出價格,如果設定了該項,則模型綜合價格會失效",
"model.param_name": "參數名稱",
"model.params_config_section": "參數配置",
"model.price_config_section": "價格配置",
"model.price_tier": "梯度",
"model.price_tier_max_required": "除了最後一個梯度,其餘都需要填寫區間上限",
"model.price_tier_open_ended": "預設無窮",
"model.price_tier_prev_range_required": "請先補齊上一梯度的區間上限",
"model.price_tier_price_required": "每個價格梯度都需要至少設定一個輸入價或輸出價",
"model.price_tier_range_invalid": "價格梯度區間設定有誤,請確認區間上限有持續遞增",
"model.price_tiers": "模型價格梯度",
"model.price_tiers_tip": "依輸入 Token 所在區間匹配一個梯度,再使用該梯度的輸入價格和輸出價格分別計費。區間起點會依上一梯度自動遞增,最後一個梯度上限留空表示及以上。",
"model.reasoning": "模型支援思考",
"model.reasoning_tip": "例如 Deepseek-reasoner,可以輸出思考過程。",
"model.reasoning_effort": "支援思考配置",
"model.request_auth": "自訂請求 Key",
"model.request_auth_tip": "向自訂請求地址發起請求時候,攜帶請求頭:Authorization: Bearer xxx 進行請求",
"model.request_url": "自訂請求地址",
"model.request_url_tip": "如果填寫該值,則會直接向該地址發起請求,不經過模型渠道的配置。\n\n接口需要遵循 OpenAI 的 API格式,並填寫完整請求地址,例如:\nLLM: {{host}}/v1/chat/completions\nEmbedding: {{host}}/v1/embeddings\nSTT: {{host}}/v1/audio/transcriptions\nTTS: {{host}}/v1/audio/speech\nRerank: {{host}}/v1/rerank",
"model.response_format": "響應格式",
"model.response_format_placeholder": "自訂參數",
"model.show_stop_sign": "展示停止序列參數",
"model.show_top_p": "展示 Top-p 參數",
"model.test_mode": "標記為測試模型",
"model.test_mode_tip": "開啟後,該模型在選擇時候,將會增加 Beta 標誌。",
"model.test_model": "模型測試",
"model.tool_choice": "支援工具呼叫",
"model.tool_choice_tag": "工具呼叫",
"model.tool_choice_tip": "如果該模型支援工具呼叫,則開啟該開關",
"model.used_in_classify": "用於問題分類",
"model.used_in_extract_fields": "用於文字擷取",
"model.used_in_tool_call": "用於工具呼叫節點",
"model.vision": "支援圖片識別",
"model.vision_tag": "視覺",
"model.vision_tip": "如果模型支援圖片識別,則開啟該開關。",
"model.embedding_vision_tip": "開啟後該索引模型可接收圖片輸入,並用於圖片向量索引和圖搜圖。",
"model.voices": "聲音角色",
"model.voices_tip": "透過一個陣列設定多個,例如:\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]"
} }
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
"Tool_description": "工具描述", "Tool_description": "工具描述",
"Tool_name": "工具名稱", "Tool_name": "工具名稱",
"ai_point_price": "AI 積分計費", "ai_point_price": "AI 積分計費",
"ai_setting_advanced_config": "進階設定",
"ai_setting_basic_config": "基礎設定", "ai_setting_basic_config": "基礎設定",
"ai_setting_reasoning_config": "思考設定", "ai_setting_reasoning_config": "思考設定",
"ai_setting_reasoning_config_tip": "部分模型未完全適配所有思考設定,如提示報錯,請嘗試切換其他思考設定選項或使用預設選項。", "ai_setting_reasoning_config_tip": "部分模型未完全適配所有思考設定,如提示報錯,請嘗試切換其他思考設定選項或使用預設選項。",
...@@ -165,8 +166,17 @@ ...@@ -165,8 +166,17 @@
"json_schema_tip": "示例:\n{\n \"name\": \"test\",\n \"description\":\"測試\",\n \"schema\": {\n \"type\":\"object\",\n \"properties\": {\n \"test\": {\n \"type\": \"string\",\n \"description\": \"Text field\"\n }\n },\n \"required\": [\n \"test\"\n ]\n }\n}", "json_schema_tip": "示例:\n{\n \"name\": \"test\",\n \"description\":\"測試\",\n \"schema\": {\n \"type\":\"object\",\n \"properties\": {\n \"test\": {\n \"type\": \"string\",\n \"description\": \"Text field\"\n }\n },\n \"required\": [\n \"test\"\n ]\n }\n}",
"keep_the_latest": "保持最新版本", "keep_the_latest": "保持最新版本",
"llm_not_support_vision": "這個模型不支援圖片辨識", "llm_not_support_vision": "這個模型不支援圖片辨識",
"llm_not_support_multimodal": "這個模型不支援多模態識別",
"llm_use_multimodal": "多模態識別",
"llm_multimodal_select_placeholder": "請選擇多模態能力",
"llm_multimodal_image": "圖片",
"llm_multimodal_audio": "音頻",
"llm_multimodal_video": "視頻",
"extract_chat_files": "提取對話文件",
"extract_chat_files_tip": "開啟後,當使用者問題少於 500 字,將讀取並解析使用者問題中以連結形式存在的多模態文件,並發送給模型識別。",
"llm_use_vision": "圖片辨識", "llm_use_vision": "圖片辨識",
"llm_use_vision_tip": "點選模型選擇後,可以看到模型是否支援圖片辨識以及控制是否啟用圖片辨識的功能。啟用圖片辨識後,模型會讀取檔案連結中的圖片內容,並且如果使用者問題少於 500 字,會自動解析使用者問題中的圖片。", "llm_use_audio": "音頻辨識",
"llm_use_video": "視頻辨識",
"local_upload": "本地上傳", "local_upload": "本地上傳",
"log_detail": "日誌詳情", "log_detail": "日誌詳情",
"logs_all_records": "全部記錄", "logs_all_records": "全部記錄",
......
...@@ -243,6 +243,11 @@ ...@@ -243,6 +243,11 @@
"core.ai.model.doc_index_and_dialog": "文件索引與對話索引", "core.ai.model.doc_index_and_dialog": "文件索引與對話索引",
"core.ai.model.multimodal": "多模態", "core.ai.model.multimodal": "多模態",
"core.ai.model.multimodal_tip": "多模態索引模型可以給圖片生成向量。", "core.ai.model.multimodal_tip": "多模態索引模型可以給圖片生成向量。",
"core.ai.model.capability_audio": "音頻",
"core.ai.model.capability_image": "圖片",
"core.ai.model.capability_video": "視頻",
"core.ai.model.multimodal_support_tip": "支援{{modalities}}能力",
"core.ai.model.reasoning_tag": "思考",
"core.app.Api request": "API 存取", "core.app.Api request": "API 存取",
"core.app.Api request desc": "通過 API 接入已有系統", "core.app.Api request desc": "通過 API 接入已有系統",
"core.app.App intro": "應用程式介紹", "core.app.App intro": "應用程式介紹",
......
{ {
"bill.buy_plan": "購買方案", "bill.buy_plan": "購買方案",
"bill.not_need_invoice": "餘額支付無法開立發票",
"bill.renew_plan": "續訂方案", "bill.renew_plan": "續訂方案",
"bill.standard_valid_tip": "方案使用規則:系統會優先使用較高等級的方案,原未使用完的方案將延後生效", "bill.standard_valid_tip": "方案使用規則:系統會優先使用較高等級的方案,原未使用完的方案將延後生效",
"manage_team": "管理團隊", "manage_team": "管理團隊",
......
import { Box, Flex, type FlexProps } from '@chakra-ui/react';
import MyTag from '@fastgpt/web/components/common/Tag';
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
import { useTranslation } from 'next-i18next';
import React from 'react';
type Props = FlexProps & {
contextToken?: number;
showVision?: boolean;
showVideo?: boolean;
showAudio?: boolean;
showReasoning?: boolean;
};
const baseCapabilityTagStyles = {
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
flexShrink: 0,
px: '11px',
py: '1px',
borderWidth: '1px',
borderStyle: 'solid',
borderRadius: '6px',
fontSize: '12px',
lineHeight: '16px',
fontWeight: 400,
letterSpacing: '0.048px',
whiteSpace: 'nowrap'
} as const;
const ModelCapabilityTags = ({
contextToken,
showVision,
showVideo,
showAudio,
showReasoning,
...props
}: Props) => {
const { t, i18n } = useTranslation();
const multimodalCapabilities: string[] = [];
if (showVision) multimodalCapabilities.push(t('common:core.ai.model.capability_image'));
if (showVideo) multimodalCapabilities.push(t('common:core.ai.model.capability_video'));
if (showAudio) multimodalCapabilities.push(t('common:core.ai.model.capability_audio'));
const showMultimodal = multimodalCapabilities.length > 0;
const multimodalTooltip = t('common:core.ai.model.multimodal_support_tip', {
modalities: multimodalCapabilities.join(i18n.language === 'en' ? ', ' : '、')
});
if (!contextToken && !showMultimodal && !showReasoning) return null;
return (
<Flex display={'inline-flex'} alignItems={'center'} gap={'8px'} flexWrap={'nowrap'} {...props}>
{!!contextToken && (
<MyTag type="borderFill" colorSchema="blue" py={0.5}>
{Math.floor(contextToken / 1000)}k
</MyTag>
)}
{showMultimodal && (
<MyTooltip
label={multimodalTooltip}
shouldWrapChildren={false}
bg={'white'}
color={'#24282C'}
px={'12px'}
py={'8px'}
borderRadius={'6px'}
fontSize={'12px'}
lineHeight={1.5}
fontWeight={400}
whiteSpace={'nowrap'}
boxShadow={
'0px 2px 4px 0px rgba(161, 167, 179, 0.25), 0px 0px 1px 0px rgba(121, 141, 159, 0.25)'
}
>
<Box
{...baseCapabilityTagStyles}
bg={'#F0FBFF'}
borderColor={'#BCE7FF'}
color={'#005B9C'}
cursor={'pointer'}
>
{t('common:core.ai.model.multimodal')}
</Box>
</MyTooltip>
)}
{showReasoning && (
<Box {...baseCapabilityTagStyles} bg={'#F7F7F7'} borderColor={'#E8EBF0'} color={'#404040'}>
{t('common:core.ai.model.reasoning_tag')}
</Box>
)}
</Flex>
);
};
export default React.memo(ModelCapabilityTags);
...@@ -15,7 +15,7 @@ import { ...@@ -15,7 +15,7 @@ import {
Checkbox Checkbox
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import React, { useMemo, useRef, useState } from 'react'; import React, { useMemo, useState } from 'react';
import MySelect from '@fastgpt/web/components/common/MySelect'; import MySelect from '@fastgpt/web/components/common/MySelect';
import { modelTypeList, ModelTypeEnum } from '@fastgpt/global/core/ai/constants'; import { modelTypeList, ModelTypeEnum } from '@fastgpt/global/core/ai/constants';
import SearchInput from '@fastgpt/web/components/common/Input/SearchInput'; import SearchInput from '@fastgpt/web/components/common/Input/SearchInput';
...@@ -32,6 +32,7 @@ import { useUserStore } from '@/web/support/user/useUserStore'; ...@@ -32,6 +32,7 @@ import { useUserStore } from '@/web/support/user/useUserStore';
import { LazyCollaboratorProvider } from '@/components/support/permission/MemberManager/context'; import { LazyCollaboratorProvider } from '@/components/support/permission/MemberManager/context';
import PriceTiersLabel from '../PriceTiersLabel'; import PriceTiersLabel from '../PriceTiersLabel';
import TestModeBetaTag from '../TestModeBetaTag'; import TestModeBetaTag from '../TestModeBetaTag';
import ModelCapabilityTags from '../ModelCapabilityTags';
const MyModal = dynamic(() => import('@fastgpt/web/components/common/MyModal')); const MyModal = dynamic(() => import('@fastgpt/web/components/common/MyModal'));
...@@ -39,26 +40,35 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean } ...@@ -39,26 +40,35 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean }
const { t, i18n } = useTranslation(); const { t, i18n } = useTranslation();
const { getModelProviders, getModelProvider } = useSystemStore(); const { getModelProviders, getModelProvider } = useSystemStore();
const { userInfo } = useUserStore(); const { userInfo } = useUserStore();
const modelPermissionConfigHint = permissionConfig
? t('account_model:model_permission_config_hint')
: '';
const [provider, setProvider] = useState<string | ''>(''); const [provider, setProvider] = useState<string | ''>('');
const providerList = useRef<{ label: any; value: string | '' }[]>([ const providerList = useMemo<{ label: React.ReactNode; value: string | '' }[]>(
{ label: t('common:All'), value: '' }, () => [
...(getModelProviders(i18n.language).map((item) => ({ { label: t('common:All'), value: '' },
label: ( ...getModelProviders(i18n.language).map((item) => ({
<HStack> label: (
<Avatar src={item.avatar} w={'1rem'} /> <HStack>
<Box>{item.name}</Box> <Avatar src={item.avatar} w={'1rem'} />
</HStack> <Box>{item.name}</Box>
), </HStack>
value: item.id ),
})) as any) value: item.id
]); }))
],
[getModelProviders, i18n.language, t]
);
const [modelType, setModelType] = useState<ModelTypeEnum | ''>(''); const [modelType, setModelType] = useState<ModelTypeEnum | ''>('');
const selectModelTypeList = useRef<{ label: string; value: ModelTypeEnum | '' }[]>([ const selectModelTypeList = useMemo<{ label: string; value: ModelTypeEnum | '' }[]>(
{ label: t('common:All'), value: '' }, () => [
...modelTypeList.map((item) => ({ label: t(item.label), value: item.value })) { label: t('common:All'), value: '' },
]); ...modelTypeList.map((item) => ({ label: t(item.label), value: item.value }))
],
[t]
);
const [search, setSearch] = useState(''); const [search, setSearch] = useState('');
...@@ -155,6 +165,13 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean } ...@@ -155,6 +165,13 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean }
model: item.model, model: item.model,
name: item.name, name: item.name,
testMode: item.testMode, testMode: item.testMode,
contextToken:
'maxContext' in item ? item.maxContext : 'maxToken' in item ? item.maxToken : undefined,
vision: 'vision' in item ? item.vision : undefined,
audio: 'audio' in item ? item.audio : undefined,
video: 'video' in item ? item.video : undefined,
reasoning: 'reasoning' in item ? item.reasoning : undefined,
toolChoice: 'toolChoice' in item ? item.toolChoice : undefined,
avatar: provider.avatar, avatar: provider.avatar,
providerId: provider.id, providerId: provider.id,
providerName: provider.name, providerName: provider.name,
...@@ -199,10 +216,8 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean } ...@@ -199,10 +216,8 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean }
...reRankModelList ...reRankModelList
].map((model) => model.provider); ].map((model) => model.provider);
return providerList.current.filter( return providerList.filter((item) => allProviderIds.includes(item.value) || item.value === '');
(item) => allProviderIds.includes(item.value) || item.value === '' }, [ttsModelList, llmModelList, embeddingModelList, sttModelList, reRankModelList, providerList]);
);
}, [ttsModelList, llmModelList, embeddingModelList, sttModelList, reRankModelList]);
const { const {
selectedItems, selectedItems,
...@@ -255,7 +270,7 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean } ...@@ -255,7 +270,7 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean }
bg={'myGray.50'} bg={'myGray.50'}
value={modelType} value={modelType}
onChange={setModelType} onChange={setModelType}
list={selectModelTypeList.current} list={selectModelTypeList}
/> />
</Box> </Box>
</Flex> </Flex>
...@@ -309,7 +324,7 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean } ...@@ -309,7 +324,7 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean }
<Checkbox <Checkbox
mr={1} mr={1}
isChecked={isSelected(item)} isChecked={isSelected(item)}
onChange={(e) => toggleSelect(item)} onChange={() => toggleSelect(item)}
></Checkbox> ></Checkbox>
)} )}
<Avatar src={item.avatar} w={'1.2rem'} /> <Avatar src={item.avatar} w={'1.2rem'} />
...@@ -320,6 +335,14 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean } ...@@ -320,6 +335,14 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean }
{item.testMode && <TestModeBetaTag />} {item.testMode && <TestModeBetaTag />}
</Flex> </Flex>
</HStack> </HStack>
<ModelCapabilityTags
mt={2}
contextToken={item.contextToken}
showVision={!!item.vision}
showVideo={!!item.video}
showAudio={!!item.audio}
showReasoning={!!item.reasoning}
/>
</Td> </Td>
<Td> <Td>
<MyTag colorSchema={item.tagColor as any}>{item.typeLabel}</MyTag> <MyTag colorSchema={item.tagColor as any}>{item.typeLabel}</MyTag>
...@@ -328,7 +351,7 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean } ...@@ -328,7 +351,7 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean }
{permissionConfig && userInfo?.team.permission.hasManagePer && ( {permissionConfig && userInfo?.team.permission.hasManagePer && (
<Td fontSize={'sm'}> <Td fontSize={'sm'}>
<LazyCollaboratorProvider <LazyCollaboratorProvider
selectedHint={t('account_model:model_permission_config_hint')} selectedHint={modelPermissionConfigHint}
defaultRole={ReadRoleVal} defaultRole={ReadRoleVal}
onGetCollaboratorList={() => getModelCollaborators(item.model)} onGetCollaboratorList={() => getModelCollaborators(item.model)}
onUpdateCollaborators={({ collaborators }) => onUpdateCollaborators={({ collaborators }) =>
...@@ -364,7 +387,7 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean } ...@@ -364,7 +387,7 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean }
}} }}
Controler={ Controler={
<LazyCollaboratorProvider <LazyCollaboratorProvider
selectedHint={t('account_model:model_permission_config_hint')} selectedHint={modelPermissionConfigHint}
defaultRole={ReadRoleVal} defaultRole={ReadRoleVal}
onGetCollaboratorList={() => onGetCollaboratorList={() =>
Promise.resolve({ Promise.resolve({
......
...@@ -18,15 +18,10 @@ const FilesBlock = ({ files }: { files: UserInputFileItemType[] }) => { ...@@ -18,15 +18,10 @@ const FilesBlock = ({ files }: { files: UserInputFileItemType[] }) => {
list: ['1fr', 'repeat(2, 1fr)', 'repeat(3, 1fr)'] list: ['1fr', 'repeat(2, 1fr)', 'repeat(3, 1fr)']
}); });
// sort files, file->image // sort files, document/audio/video->image
const sortFiles = useMemo(() => { const sortFiles = useMemo(() => {
return clone(files).sort((a, b) => { return clone(files).sort((a, b) => {
if (a.type === ChatFileTypeEnum.image && b.type === ChatFileTypeEnum.file) { return Number(a.type === ChatFileTypeEnum.image) - Number(b.type === ChatFileTypeEnum.image);
return 1;
} else if (a.type === ChatFileTypeEnum.file && b.type === ChatFileTypeEnum.image) {
return -1;
}
return 0;
}); });
}, [files]); }, [files]);
...@@ -53,7 +48,7 @@ const FilesBlock = ({ files }: { files: UserInputFileItemType[] }) => { ...@@ -53,7 +48,7 @@ const FilesBlock = ({ files }: { files: UserInputFileItemType[] }) => {
{sortFiles.map(({ id, type, name, url, icon }, i) => ( {sortFiles.map(({ id, type, name, url, icon }, i) => (
<Box key={i} bg={'white'} borderRadius={'md'} overflow="hidden"> <Box key={i} bg={'white'} borderRadius={'md'} overflow="hidden">
{type === 'image' && <MdImage src={url} minH={'100px'} my={0} />} {type === 'image' && <MdImage src={url} minH={'100px'} my={0} />}
{type === 'file' && ( {type !== 'image' && (
<Flex <Flex
p={2} p={2}
w={'100%'} w={'100%'}
......
...@@ -17,6 +17,7 @@ import { type OutLinkChatAuthProps } from '@fastgpt/global/support/permission/ch ...@@ -17,6 +17,7 @@ import { type OutLinkChatAuthProps } from '@fastgpt/global/support/permission/ch
import { getUploadChatFilePresignedUrl } from '@/web/common/file/api'; import { getUploadChatFilePresignedUrl } from '@/web/common/file/api';
import { getUploadFileType } from '@fastgpt/global/core/app/constants'; import { getUploadFileType } from '@fastgpt/global/core/app/constants';
import { putFileToS3 } from '@fastgpt/web/common/file/utils'; import { putFileToS3 } from '@fastgpt/web/common/file/utils';
import { getUploadChatFileType } from '../utils';
type UseFileUploadOptions = { type UseFileUploadOptions = {
fileSelectConfig: AppFileSelectConfigType; fileSelectConfig: AppFileSelectConfigType;
...@@ -130,14 +131,15 @@ export const useFileUpload = (props: UseFileUploadOptions) => { ...@@ -130,14 +131,15 @@ export const useFileUpload = (props: UseFileUploadOptions) => {
filterFilesByMaxSize.map( filterFilesByMaxSize.map(
(file) => (file) =>
new Promise<UserInputFileItemType>((resolve, reject) => { new Promise<UserInputFileItemType>((resolve, reject) => {
if (file.type.includes('image')) { const chatFileType = getUploadChatFileType(file);
if (chatFileType === ChatFileTypeEnum.image) {
const reader = new FileReader(); const reader = new FileReader();
reader.readAsDataURL(file); reader.readAsDataURL(file);
reader.onload = () => { reader.onload = () => {
const item: UserInputFileItemType = { const item: UserInputFileItemType = {
id: getNanoid(6), id: getNanoid(6),
rawFile: file, rawFile: file,
type: ChatFileTypeEnum.image, type: chatFileType,
name: file.name, name: file.name,
icon: reader.result as string, icon: reader.result as string,
status: 0 status: 0
...@@ -151,7 +153,7 @@ export const useFileUpload = (props: UseFileUploadOptions) => { ...@@ -151,7 +153,7 @@ export const useFileUpload = (props: UseFileUploadOptions) => {
resolve({ resolve({
id: getNanoid(6), id: getNanoid(6),
rawFile: file, rawFile: file,
type: ChatFileTypeEnum.file, type: chatFileType,
name: file.name, name: file.name,
icon: getFileIcon(file.name), icon: getFileIcon(file.name),
status: 0 status: 0
...@@ -174,7 +176,7 @@ export const useFileUpload = (props: UseFileUploadOptions) => { ...@@ -174,7 +176,7 @@ export const useFileUpload = (props: UseFileUploadOptions) => {
if (filterFiles.length === 0) return; if (filterFiles.length === 0) return;
replaceFiles(fileList.map((item) => ({ ...item, status: 1 }))); replaceFiles(fileList.map((item) => ({ ...item, status: 1 })));
let errorFileIndex: number[] = []; const errorFileIndex: number[] = [];
await Promise.allSettled( await Promise.allSettled(
filterFiles.map(async (file) => { filterFiles.map(async (file) => {
...@@ -240,14 +242,9 @@ export const useFileUpload = (props: UseFileUploadOptions) => { ...@@ -240,14 +242,9 @@ export const useFileUpload = (props: UseFileUploadOptions) => {
]); ]);
const sortFileList = useMemo(() => { const sortFileList = useMemo(() => {
// Sort: Document, image // Sort: Document/audio/video, image
const sortResult = clone(fileList).sort((a, b) => { const sortResult = clone(fileList).sort((a, b) => {
if (a.type === ChatFileTypeEnum.image && b.type === ChatFileTypeEnum.file) { return Number(a.type === ChatFileTypeEnum.image) - Number(b.type === ChatFileTypeEnum.image);
return 1;
} else if (a.type === ChatFileTypeEnum.file && b.type === ChatFileTypeEnum.image) {
return -1;
}
return 0;
}); });
return sortResult; return sortResult;
}, [fileList]); }, [fileList]);
......
...@@ -7,7 +7,11 @@ import type { ...@@ -7,7 +7,11 @@ import type {
import type { ChatSiteItemType } from './type'; import type { ChatSiteItemType } from './type';
import { type ChatBoxInputType, type UserInputFileItemType } from './type'; import { type ChatBoxInputType, type UserInputFileItemType } from './type';
import { getFileIcon } from '@fastgpt/global/common/file/icon'; import { getFileIcon } from '@fastgpt/global/common/file/icon';
import { ChatRoleEnum, ChatStatusEnum } from '@fastgpt/global/core/chat/constants'; import {
ChatFileTypeEnum,
ChatRoleEnum,
ChatStatusEnum
} from '@fastgpt/global/core/chat/constants';
import { import {
extractDeepestInteractive, extractDeepestInteractive,
getLastInteractiveValue getLastInteractiveValue
...@@ -20,6 +24,13 @@ import { ...@@ -20,6 +24,13 @@ import {
import { FlowNodeInputTypeEnum } from '@fastgpt/global/core/workflow/node/constant'; import { FlowNodeInputTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
import { normalizeFormInputResultFile } from '../../components/FormInputResult'; import { normalizeFormInputResultFile } from '../../components/FormInputResult';
export const getUploadChatFileType = (file: File) => {
if (file.type.includes('image')) return ChatFileTypeEnum.image;
if (file.type.includes('audio')) return ChatFileTypeEnum.audio;
if (file.type.includes('video')) return ChatFileTypeEnum.video;
return ChatFileTypeEnum.file;
};
export const formatChatValue2InputType = (value?: ChatItemValueItemType[]): ChatBoxInputType => { export const formatChatValue2InputType = (value?: ChatItemValueItemType[]): ChatBoxInputType => {
if (!value) { if (!value) {
return { text: '', files: [] }; return { text: '', files: [] };
......
...@@ -28,8 +28,8 @@ const RenderFilePreview = ({ ...@@ -28,8 +28,8 @@ const RenderFilePreview = ({
gap={'6px'} gap={'6px'}
> >
{fileList.map((item, index) => { {fileList.map((item, index) => {
const isFile = item.type === ChatFileTypeEnum.file;
const isImage = item.type === ChatFileTypeEnum.image; const isImage = item.type === ChatFileTypeEnum.image;
const isFile = !isImage;
const icon = getFileIcon(item.name); const icon = getFileIcon(item.name);
return ( return (
......
...@@ -17,6 +17,7 @@ import type { HelperBotTypeEnumType } from '@fastgpt/global/core/chat/helperBot/ ...@@ -17,6 +17,7 @@ import type { HelperBotTypeEnumType } from '@fastgpt/global/core/chat/helperBot/
import { getHelperBotFilePresign } from '../api'; import { getHelperBotFilePresign } from '../api';
import { useRequest } from '@fastgpt/web/hooks/useRequest'; import { useRequest } from '@fastgpt/web/hooks/useRequest';
import { putFileToS3 } from '@fastgpt/web/common/file/utils'; import { putFileToS3 } from '@fastgpt/web/common/file/utils';
import { getUploadChatFileType } from '../../ChatContainer/ChatBox/utils';
type UseFileUploadOptions = { type UseFileUploadOptions = {
fileSelectConfig?: AppFileSelectConfigType; fileSelectConfig?: AppFileSelectConfigType;
...@@ -119,14 +120,15 @@ export const useFileUpload = (props: UseFileUploadOptions) => { ...@@ -119,14 +120,15 @@ export const useFileUpload = (props: UseFileUploadOptions) => {
filterFilesByMaxSize.map( filterFilesByMaxSize.map(
(file) => (file) =>
new Promise<UserInputFileItemType>((resolve, reject) => { new Promise<UserInputFileItemType>((resolve, reject) => {
if (file.type.includes('image')) { const chatFileType = getUploadChatFileType(file);
if (chatFileType === ChatFileTypeEnum.image) {
const reader = new FileReader(); const reader = new FileReader();
reader.readAsDataURL(file); reader.readAsDataURL(file);
reader.onload = () => { reader.onload = () => {
const item: UserInputFileItemType = { const item: UserInputFileItemType = {
id: getNanoid(6), id: getNanoid(6),
rawFile: file, rawFile: file,
type: ChatFileTypeEnum.image, type: chatFileType,
name: file.name, name: file.name,
icon: reader.result as string, icon: reader.result as string,
status: 0 status: 0
...@@ -140,7 +142,7 @@ export const useFileUpload = (props: UseFileUploadOptions) => { ...@@ -140,7 +142,7 @@ export const useFileUpload = (props: UseFileUploadOptions) => {
resolve({ resolve({
id: getNanoid(6), id: getNanoid(6),
rawFile: file, rawFile: file,
type: ChatFileTypeEnum.file, type: chatFileType,
name: file.name, name: file.name,
icon: getFileIcon(file.name), icon: getFileIcon(file.name),
status: 0 status: 0
...@@ -163,7 +165,7 @@ export const useFileUpload = (props: UseFileUploadOptions) => { ...@@ -163,7 +165,7 @@ export const useFileUpload = (props: UseFileUploadOptions) => {
if (filterFiles.length === 0) return; if (filterFiles.length === 0) return;
replaceFiles(fileList.map((item) => ({ ...item, status: 1 }))); replaceFiles(fileList.map((item) => ({ ...item, status: 1 })));
let errorFileIndex: number[] = []; const errorFileIndex: number[] = [];
await Promise.allSettled( await Promise.allSettled(
filterFiles.map(async (file) => { filterFiles.map(async (file) => {
...@@ -216,14 +218,9 @@ export const useFileUpload = (props: UseFileUploadOptions) => { ...@@ -216,14 +218,9 @@ export const useFileUpload = (props: UseFileUploadOptions) => {
}, [chatId, fileList, removeFiles, replaceFiles, t, toast, type, updateFiles]); }, [chatId, fileList, removeFiles, replaceFiles, t, toast, type, updateFiles]);
const sortFileList = useMemo(() => { const sortFileList = useMemo(() => {
// Sort: Document, image // Sort: Document/audio/video, image
const sortResult = clone(fileList).sort((a, b) => { const sortResult = clone(fileList).sort((a, b) => {
if (a.type === ChatFileTypeEnum.image && b.type === ChatFileTypeEnum.file) { return Number(a.type === ChatFileTypeEnum.image) - Number(b.type === ChatFileTypeEnum.image);
return 1;
} else if (a.type === ChatFileTypeEnum.file && b.type === ChatFileTypeEnum.image) {
return -1;
}
return 0;
}); });
return sortResult; return sortResult;
}, [fileList]); }, [fileList]);
......
...@@ -32,7 +32,6 @@ import { type TeamInvoiceHeaderType } from '@fastgpt/global/support/user/team/ty ...@@ -32,7 +32,6 @@ import { type TeamInvoiceHeaderType } from '@fastgpt/global/support/user/team/ty
import { InvoiceHeaderSingleForm } from './InvoiceHeaderForm'; import { InvoiceHeaderSingleForm } from './InvoiceHeaderForm';
import MyBox from '@fastgpt/web/components/common/MyBox'; import MyBox from '@fastgpt/web/components/common/MyBox';
import { getTeamInvoiceHeader } from '@/web/support/user/team/api'; import { getTeamInvoiceHeader } from '@/web/support/user/team/api';
import { useToast } from '@fastgpt/web/hooks/useToast';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
...@@ -131,7 +130,7 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => { ...@@ -131,7 +130,7 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => {
<Box w={'100%'} fontSize={'0.875rem'}> <Box w={'100%'} fontSize={'0.875rem'}>
<Flex w={'100%'} justifyContent={'space-between'}> <Flex w={'100%'} justifyContent={'space-between'}>
<Box>{t('account_bill:total_amount')}</Box> <Box>{t('account_bill:total_amount')}</Box>
<Box>{t('account:yuan', { amount: formatStorePrice2Read(totalPrice) })}</Box> <Box>{t('account_bill:yuan', { amount: formatStorePrice2Read(totalPrice) })}</Box>
</Flex> </Flex>
<Box w={'100%'} py={4}> <Box w={'100%'} py={4}>
<Divider showBorderBottom={false} /> <Divider showBorderBottom={false} />
...@@ -192,20 +191,23 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => { ...@@ -192,20 +191,23 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => {
chosenBillDataList.length === billsList?.length && billsList?.length !== 0 chosenBillDataList.length === billsList?.length && billsList?.length !== 0
} }
onChange={(e) => { onChange={(e) => {
!e.target.checked if (!e.target.checked) {
? setChosenBillDataList([]) setChosenBillDataList([]);
: setChosenBillDataList( return;
billsList?.map((item) => ({ }
_id: item._id,
price: item.price setChosenBillDataList(
})) || [] billsList?.map((item) => ({
); _id: item._id,
price: item.price
})) || []
);
}} }}
/> />
</Th> </Th>
<Th>{t('account_bill:type')}</Th> <Th>{t('account_bill:type')}</Th>
<Th>{t('account_bill:time')}</Th> <Th>{t('account_bill:time')}</Th>
<Th>{t('account:support_wallet_amount')}</Th> <Th>{t('account_bill:support_wallet_amount')}</Th>
</Tr> </Tr>
</Thead> </Thead>
<Tbody fontSize={'0.875rem'}> <Tbody fontSize={'0.875rem'}>
...@@ -233,7 +235,9 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => { ...@@ -233,7 +235,9 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => {
? dayjs(item.createTime).format('YYYY/MM/DD HH:mm:ss') ? dayjs(item.createTime).format('YYYY/MM/DD HH:mm:ss')
: '-'} : '-'}
</Td> </Td>
<Td>{t('account:yuan', { amount: formatStorePrice2Read(item.price) })}</Td> <Td>
{t('account_bill:yuan', { amount: formatStorePrice2Read(item.price) })}
</Td>
</Tr> </Tr>
))} ))}
</Tbody> </Tbody>
...@@ -259,7 +263,7 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => { ...@@ -259,7 +263,7 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => {
px="0" px="0"
isDisabled={!chosenBillDataList.length} isDisabled={!chosenBillDataList.length}
onClick={() => { onClick={() => {
let total = chosenBillDataList.reduce((acc, cur) => acc + Number(cur.price), 0); const total = chosenBillDataList.reduce((acc, cur) => acc + Number(cur.price), 0);
if (!total) return; if (!total) return;
setTotalPrice(total); setTotalPrice(total);
onOpenSettleModal(); onOpenSettleModal();
......
...@@ -118,7 +118,7 @@ const BillDetailModal = ({ billId, onClose }: BillDetailModalProps) => { ...@@ -118,7 +118,7 @@ const BillDetailModal = ({ billId, onClose }: BillDetailModalProps) => {
} }
return items; return items;
}, [bill?.couponDetail?.subscriptions]); }, [bill?.couponDetail?.subscriptions, bill?.metadata.standSubLevel]);
return ( return (
<MyModal <MyModal
...@@ -172,7 +172,7 @@ const BillDetailModal = ({ billId, onClose }: BillDetailModalProps) => { ...@@ -172,7 +172,7 @@ const BillDetailModal = ({ billId, onClose }: BillDetailModalProps) => {
<Flex alignItems={'center'} pb={4}> <Flex alignItems={'center'} pb={4}>
<FormLabel flex={'0 0 120px'}>{t('account:has_invoice')}:</FormLabel> <FormLabel flex={'0 0 120px'}>{t('account:has_invoice')}:</FormLabel>
{bill?.metadata.payWay === 'balance' ? ( {bill?.metadata.payWay === 'balance' ? (
t('user:bill.not_need_invoice') t('account:bill.not_need_invoice')
) : ( ) : (
<Box>{bill.hasInvoice ? t('account:yes') : t('account:no')}</Box> <Box>{bill.hasInvoice ? t('account:yes') : t('account:no')}</Box>
)} )}
......
import React, { useState, useMemo, useEffect } from 'react'; import React, { useState, useMemo } from 'react';
import { import {
Button, Button,
Table, Table,
...@@ -150,8 +150,8 @@ const BillTable = () => { ...@@ -150,8 +150,8 @@ const BillTable = () => {
></MySelect> ></MySelect>
</Th> </Th>
<Th>{t('account_bill:time')}</Th> <Th>{t('account_bill:time')}</Th>
<Th>{t('account:support_wallet_amount')}</Th> <Th>{t('account_bill:support_wallet_amount')}</Th>
<Th>{t('account:status')}</Th> <Th>{t('account_bill:status')}</Th>
<Th></Th> <Th></Th>
</Tr> </Tr>
</Thead> </Thead>
...@@ -163,7 +163,7 @@ const BillTable = () => { ...@@ -163,7 +163,7 @@ const BillTable = () => {
<Td> <Td>
{item.createTime ? dayjs(item.createTime).format('YYYY/MM/DD HH:mm:ss') : '-'} {item.createTime ? dayjs(item.createTime).format('YYYY/MM/DD HH:mm:ss') : '-'}
</Td> </Td>
<Td>{t('account:yuan', { amount: formatStorePrice2Read(item.price) })}</Td> <Td>{t('account_bill:yuan', { amount: formatStorePrice2Read(item.price) })}</Td>
<Td>{t(billStatusMap[item.status]?.label as any)}</Td> <Td>{t(billStatusMap[item.status]?.label as any)}</Td>
<Td display={'flex'} justifyContent={'end'}> <Td display={'flex'} justifyContent={'end'}>
{item.status === 'NOTPAY' && ( {item.status === 'NOTPAY' && (
......
...@@ -142,10 +142,10 @@ export const InvoiceHeaderSingleForm = ({ ...@@ -142,10 +142,10 @@ export const InvoiceHeaderSingleForm = ({
> >
<HStack h={'2rem'}> <HStack h={'2rem'}>
<Radio value="true" pr={'1rem'}> <Radio value="true" pr={'1rem'}>
<Box fontSize={'14px'}>{t('account:yes')}</Box> <Box fontSize={'14px'}>{t('account_bill:yes')}</Box>
</Radio> </Radio>
<Radio value="false"> <Radio value="false">
<Box fontSize={'14px'}>{t('account:no')}</Box> <Box fontSize={'14px'}>{t('account_bill:no')}</Box>
</Radio> </Radio>
</HStack> </HStack>
</RadioGroup> </RadioGroup>
......
...@@ -46,8 +46,8 @@ const InvoiceTable = () => { ...@@ -46,8 +46,8 @@ const InvoiceTable = () => {
<Tr> <Tr>
<Th w={'20%'}>#</Th> <Th w={'20%'}>#</Th>
<Th w={'20%'}>{t('account_bill:time')}</Th> <Th w={'20%'}>{t('account_bill:time')}</Th>
<Th w={'20%'}>{t('account:support_wallet_amount')}</Th> <Th w={'20%'}>{t('account_bill:support_wallet_amount')}</Th>
<Th w={'20%'}>{t('account:status')}</Th> <Th w={'20%'}>{t('account_bill:status')}</Th>
<Th w={'20%'}></Th> <Th w={'20%'}></Th>
</Tr> </Tr>
</Thead> </Thead>
...@@ -58,7 +58,7 @@ const InvoiceTable = () => { ...@@ -58,7 +58,7 @@ const InvoiceTable = () => {
<Td> <Td>
{item.createTime ? dayjs(item.createTime).format('YYYY/MM/DD HH:mm:ss') : '-'} {item.createTime ? dayjs(item.createTime).format('YYYY/MM/DD HH:mm:ss') : '-'}
</Td> </Td>
<Td>{t('account:yuan', { amount: formatStorePrice2Read(item.amount) })}</Td> <Td>{t('account_bill:yuan', { amount: formatStorePrice2Read(item.amount) })}</Td>
<Td> <Td>
<Flex <Flex
px={'0.75rem'} px={'0.75rem'}
...@@ -162,7 +162,7 @@ function InvoiceDetailModal({ ...@@ -162,7 +162,7 @@ function InvoiceDetailModal({
<Flex w={'100%'} h={'100%'} flexDir={'column'} gap={'1rem'}> <Flex w={'100%'} h={'100%'} flexDir={'column'} gap={'1rem'}>
<LabelItem <LabelItem
label={t('account_bill:invoice_amount')} label={t('account_bill:invoice_amount')}
value={t('account:yuan', { amount: formatStorePrice2Read(invoice.amount) })} value={t('account_bill:yuan', { amount: formatStorePrice2Read(invoice.amount) })}
/> />
<LabelItem label={t('account_bill:organization_name')} value={invoice.teamName} /> <LabelItem label={t('account_bill:organization_name')} value={invoice.teamName} />
<LabelItem label={t('account_bill:unit_code')} value={invoice.unifiedCreditCode} /> <LabelItem label={t('account_bill:unit_code')} value={invoice.unifiedCreditCode} />
...@@ -172,7 +172,7 @@ function InvoiceDetailModal({ ...@@ -172,7 +172,7 @@ function InvoiceDetailModal({
<LabelItem label={t('account_bill:bank_account')} value={invoice.bankAccount} /> <LabelItem label={t('account_bill:bank_account')} value={invoice.bankAccount} />
<LabelItem <LabelItem
label={t('account_bill:need_special_invoice')} label={t('account_bill:need_special_invoice')}
value={invoice.needSpecialInvoice ? t('account:yes') : t('account:no')} value={invoice.needSpecialInvoice ? t('account_bill:yes') : t('account_bill:no')}
/> />
<LabelItem label={t('account_bill:contact_phone')} value={invoice.contactPhone} /> <LabelItem label={t('account_bill:contact_phone')} value={invoice.contactPhone} />
<LabelItem label={t('account_bill:email_address')} value={invoice.emailAddress} /> <LabelItem label={t('account_bill:email_address')} value={invoice.emailAddress} />
......
...@@ -25,7 +25,7 @@ import { useForm } from 'react-hook-form'; ...@@ -25,7 +25,7 @@ import { useForm } from 'react-hook-form';
import { AddModelButton } from '../AddModelBox'; import { AddModelButton } from '../AddModelBox';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import { type SystemModelItemType } from '@fastgpt/service/core/ai/type'; import { type SystemModelItemType } from '@fastgpt/service/core/ai/type';
import type { ModelTypeEnum } from '@fastgpt/global/core/ai/constants'; import { ModelTypeEnum } from '@fastgpt/global/core/ai/constants';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import { getSystemModelList } from '@/web/core/ai/config'; import { getSystemModelList } from '@/web/core/ai/config';
import { useRequest } from '@fastgpt/web/hooks/useRequest'; import { useRequest } from '@fastgpt/web/hooks/useRequest';
...@@ -113,6 +113,13 @@ const EditChannelModal = ({ ...@@ -113,6 +113,13 @@ const EditChannelModal = ({
isCustom: true, isCustom: true,
isActive: true, isActive: true,
...(type === ModelTypeEnum.llm
? {
vision: false,
audio: false,
video: false
}
: {}),
// @ts-ignore // @ts-ignore
type type
}); });
......
...@@ -201,7 +201,7 @@ const ModelTest = ({ ...@@ -201,7 +201,7 @@ const ModelTest = ({
<Thead> <Thead>
<Tr> <Tr>
<Th>{t('account_model:model_name')}</Th> <Th>{t('account_model:model_name')}</Th>
<Th>{t('account:model.model_id')}</Th> <Th>{t('account_model:model.model_id')}</Th>
<Th>{t('account_model:channel_status')}</Th> <Th>{t('account_model:channel_status')}</Th>
<Th></Th> <Th></Th>
</Tr> </Tr>
...@@ -233,7 +233,7 @@ const ModelTest = ({ ...@@ -233,7 +233,7 @@ const ModelTest = ({
<MyIconButton <MyIconButton
isLoading={item.loading} isLoading={item.loading}
icon={'core/chat/sendLight'} icon={'core/chat/sendLight'}
tip={t('account:model.test_model')} tip={t('account_model:model.test_model')}
onClick={() => onTestOneModel(item.model)} onClick={() => onTestOneModel(item.model)}
/> />
)} )}
......
...@@ -50,6 +50,7 @@ import { AddModelButton } from './AddModelBox'; ...@@ -50,6 +50,7 @@ import { AddModelButton } from './AddModelBox';
import PopoverConfirm from '@fastgpt/web/components/common/MyPopover/PopoverConfirm'; import PopoverConfirm from '@fastgpt/web/components/common/MyPopover/PopoverConfirm';
import PriceTiersLabel from '@/components/core/ai/PriceTiersLabel'; import PriceTiersLabel from '@/components/core/ai/PriceTiersLabel';
import TestModeBetaTag from '@/components/core/ai/TestModeBetaTag'; import TestModeBetaTag from '@/components/core/ai/TestModeBetaTag';
import ModelCapabilityTags from '@/components/core/ai/ModelCapabilityTags';
const MyModal = dynamic(() => import('@fastgpt/web/components/common/MyModal')); const MyModal = dynamic(() => import('@fastgpt/web/components/common/MyModal'));
const ModelEditModal = dynamic(() => import('./AddModelBox').then((mod) => mod.ModelEditModal)); const ModelEditModal = dynamic(() => import('./AddModelBox').then((mod) => mod.ModelEditModal));
...@@ -281,7 +282,14 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { ...@@ -281,7 +282,14 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
isDefault: false, isDefault: false,
isDefaultDatasetTextModel: false, isDefaultDatasetTextModel: false,
isDefaultDatasetImageModel: false, isDefaultDatasetImageModel: false,
type type,
...(type === ModelTypeEnum.llm
? {
vision: false,
audio: false,
video: false
}
: {})
} as SystemModelItemType; } as SystemModelItemType;
setEditModelData(modelData); setEditModelData(modelData);
...@@ -309,10 +317,10 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { ...@@ -309,10 +317,10 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
{Tab} {Tab}
<Box flex={1} /> <Box flex={1} />
<Button variant={'whiteBase'} mr={2} onClick={onOpenDefaultModel}> <Button variant={'whiteBase'} mr={2} onClick={onOpenDefaultModel}>
{t('account:model.default_model')} {t('account_model:model.default_model')}
</Button> </Button>
<Button variant={'whiteBase'} mr={2} onClick={onOpenJsonConfig}> <Button variant={'whiteBase'} mr={2} onClick={onOpenJsonConfig}>
{t('account:model.json_config')} {t('account_model:model.json_config')}
</Button> </Button>
<AddModelButton onCreate={onCreateModel} /> <AddModelButton onCreate={onCreateModel} />
</Flex> </Flex>
...@@ -365,7 +373,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { ...@@ -365,7 +373,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
onClick={() => setShowModelId(!showModelId)} onClick={() => setShowModelId(!showModelId)}
> >
<Box> <Box>
{showModelId ? t('account:model.model_id') : t('common:model.name')} {showModelId ? t('account_model:model.model_id') : t('common:model.name')}
</Box> </Box>
<MyIcon name={'modal/changePer'} w={'1rem'} /> <MyIcon name={'modal/changePer'} w={'1rem'} />
</HStack> </HStack>
...@@ -378,7 +386,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { ...@@ -378,7 +386,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
onClick={() => setShowActive(!showActive)} onClick={() => setShowActive(!showActive)}
color={showActive ? 'primary.600' : 'myGray.600'} color={showActive ? 'primary.600' : 'myGray.600'}
> >
{t('account:model.active')}({activeModelLength}) {t('account_model:model.active')}({activeModelLength})
</Box> </Box>
</Th> </Th>
<Th fontSize={'xs'}></Th> <Th fontSize={'xs'}></Th>
...@@ -401,25 +409,14 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { ...@@ -401,25 +409,14 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
{item.testMode && <TestModeBetaTag />} {item.testMode && <TestModeBetaTag />}
</Flex> </Flex>
</HStack> </HStack>
<HStack mt={2}> <ModelCapabilityTags
{item.contextToken && ( mt={2}
<MyTag type="borderFill" colorSchema="blue" py={0.5}> contextToken={item.contextToken}
{Math.floor(item.contextToken / 1000)}k showVision={!!item.vision}
</MyTag> showVideo={!!item.video}
)} showAudio={!!item.audio}
{item.vision && ( showReasoning={!!item.reasoning}
<MyTag type="borderFill" colorSchema="green" py={0.5}> />
{item.type === ModelTypeEnum.llm
? t('account:model.vision_tag')
: t('common:core.ai.model.multimodal')}
</MyTag>
)}
{item.toolChoice && (
<MyTag type="borderFill" colorSchema="adora" py={0.5}>
{t('account:model.tool_choice_tag')}
</MyTag>
)}
</HStack>
</Td> </Td>
<Td> <Td>
<MyTag colorSchema={item.tagColor as any}>{item.typeLabel}</MyTag> <MyTag colorSchema={item.tagColor as any}>{item.typeLabel}</MyTag>
...@@ -442,12 +439,12 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { ...@@ -442,12 +439,12 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
<HStack> <HStack>
<MyIconButton <MyIconButton
icon={'core/chat/sendLight'} icon={'core/chat/sendLight'}
tip={t('account:model.test_model')} tip={t('account_model:model.test_model')}
onClick={() => onTestModel({ model: item.model })} onClick={() => onTestModel({ model: item.model })}
/> />
<MyIconButton <MyIconButton
icon={'common/settingLight'} icon={'common/settingLight'}
tip={t('account:model.edit_model')} tip={t('account_model:model.edit_model')}
onClick={() => onEditModel(item.model)} onClick={() => onEditModel(item.model)}
/> />
{item.isCustom && ( {item.isCustom && (
...@@ -458,7 +455,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { ...@@ -458,7 +455,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
</Box> </Box>
} }
type="delete" type="delete"
content={t('account:model.delete_model_confirm')} content={t('account_model:model.delete_model_confirm')}
onConfirm={() => deleteModel({ model: item.model })} onConfirm={() => deleteModel({ model: item.model })}
/> />
)} )}
...@@ -519,13 +516,13 @@ const JsonConfigModal = ({ ...@@ -519,13 +516,13 @@ const JsonConfigModal = ({
isLoading={loading} isLoading={loading}
onClose={onClose} onClose={onClose}
iconSrc="modal/edit" iconSrc="modal/edit"
title={t('account:model.json_config')} title={t('account_model:model.json_config')}
w={'100%'} w={'100%'}
h={'100%'} h={'100%'}
> >
<ModalBody display={'flex'} flexDirection={'column'}> <ModalBody display={'flex'} flexDirection={'column'}>
<Box fontSize={'sm'} color={'myGray.500'}> <Box fontSize={'sm'} color={'myGray.500'}>
{t('account:model.json_config_tip')} {t('account_model:model.json_config_tip')}
</Box> </Box>
<Box mt={2} flex={1} w={'100%'} overflow={'hidden'}> <Box mt={2} flex={1} w={'100%'} overflow={'hidden'}>
<JsonEditor value={data} onChange={setData} resize h={'100%'} /> <JsonEditor value={data} onChange={setData} resize h={'100%'} />
...@@ -539,7 +536,7 @@ const JsonConfigModal = ({ ...@@ -539,7 +536,7 @@ const JsonConfigModal = ({
<PopoverConfirm <PopoverConfirm
Trigger={<Button>{t('common:Confirm')}</Button>} Trigger={<Button>{t('common:Confirm')}</Button>}
type="info" type="info"
content={t('account:model.json_config_confirm')} content={t('account_model:model.json_config_confirm')}
onConfirm={() => runAsync({ config: data })} onConfirm={() => runAsync({ config: data })}
/> />
</ModalFooter> </ModalFooter>
...@@ -586,7 +583,7 @@ const DefaultModelModal = ({ ...@@ -586,7 +583,7 @@ const DefaultModelModal = ({
<MyModal <MyModal
isOpen isOpen
onClose={onClose} onClose={onClose}
title={t('account:default_model_config')} title={t('account_model:default_model_config')}
iconSrc="modal/edit" iconSrc="modal/edit"
> >
<ModalBody> <ModalBody>
......
...@@ -138,24 +138,24 @@ const EditForm = ({ ...@@ -138,24 +138,24 @@ const EditForm = ({
return selectedModel.quoteMaxToken || 3000; return selectedModel.quoteMaxToken || 3000;
}, [selectedModel.quoteMaxToken]); }, [selectedModel.quoteMaxToken]);
// Force close image select when model not support vision // 简易 Agent 不暴露多模态开关,文件选择能力直接跟随模型能力。
useEffect(() => { useEffect(() => {
if (!selectedModel.vision) { setAppForm((state) => ({
setAppForm((state) => ({ ...state,
...state, chatConfig: {
chatConfig: { ...state.chatConfig,
...state.chatConfig, ...(state.chatConfig.fileSelectConfig
...(state.chatConfig.fileSelectConfig ? {
? { fileSelectConfig: {
fileSelectConfig: { ...state.chatConfig.fileSelectConfig,
...state.chatConfig.fileSelectConfig, canSelectImg: !!selectedModel.vision,
canSelectImg: false canSelectAudio: !!selectedModel.audio,
} canSelectVideo: !!selectedModel.video
} }
: {}) }
} : {})
})); }
} }));
}, [selectedModel, setAppForm]); }, [selectedModel, setAppForm]);
return ( return (
...@@ -191,6 +191,7 @@ const EditForm = ({ ...@@ -191,6 +191,7 @@ const EditForm = ({
showTopP={false} showTopP={false}
showStopSign={false} showStopSign={false}
showResponseFormat={false} showResponseFormat={false}
showMultimodalConfig={false}
onChange={({ maxHistories = 6, ...data }) => { onChange={({ maxHistories = 6, ...data }) => {
setAppForm((state) => ({ setAppForm((state) => ({
...state, ...state,
......
...@@ -27,6 +27,7 @@ import { ...@@ -27,6 +27,7 @@ import {
import { SystemConfigNode } from '@fastgpt/global/core/workflow/template/system/systemConfig'; import { SystemConfigNode } from '@fastgpt/global/core/workflow/template/system/systemConfig';
import { i18nT } from '@fastgpt/global/common/i18n/utils'; import { i18nT } from '@fastgpt/global/common/i18n/utils';
import { workflowStartNodeId } from '@/web/core/app/constants'; import { workflowStartNodeId } from '@/web/core/app/constants';
import { getWebLLMModel } from '@/web/common/system/utils';
import { AgentNode } from '@fastgpt/global/core/workflow/template/system/agent/index'; import { AgentNode } from '@fastgpt/global/core/workflow/template/system/agent/index';
import { getDefaultAppForm } from '@fastgpt/global/core/app/utils'; import { getDefaultAppForm } from '@fastgpt/global/core/app/utils';
import type { FlowNodeInputItemType } from '@fastgpt/global/core/workflow/type/io'; import type { FlowNodeInputItemType } from '@fastgpt/global/core/workflow/type/io';
...@@ -142,6 +143,27 @@ export function agentForm2AppWorkflow( ...@@ -142,6 +143,27 @@ export function agentForm2AppWorkflow(
chatConfig: AppChatConfigType; chatConfig: AppChatConfigType;
} { } {
const aiChatNodeId = '7BdojPlukIQw'; const aiChatNodeId = '7BdojPlukIQw';
const modelData = getWebLLMModel(data.aiSettings.model);
const modelMultimodal = {
vision: !!modelData?.vision,
audio: !!modelData?.audio,
video: !!modelData?.video,
extractFiles: !!(modelData?.vision || modelData?.audio || modelData?.video)
};
const chatConfig: AppChatConfigType = {
...data.chatConfig,
...(data.chatConfig.fileSelectConfig
? {
fileSelectConfig: {
...data.chatConfig.fileSelectConfig,
canSelectImg: modelMultimodal.vision,
canSelectAudio: modelMultimodal.audio,
canSelectVideo: modelMultimodal.video
}
}
: {})
};
function systemConfigTemplate(): StoreNodeItemType { function systemConfigTemplate(): StoreNodeItemType {
return { return {
nodeId: SystemConfigNode.id, nodeId: SystemConfigNode.id,
...@@ -212,7 +234,28 @@ export function agentForm2AppWorkflow( ...@@ -212,7 +234,28 @@ export function agentForm2AppWorkflow(
renderTypeList: [FlowNodeInputTypeEnum.hidden], renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '', label: '',
valueType: WorkflowIOValueTypeEnum.boolean, valueType: WorkflowIOValueTypeEnum.boolean,
value: true value: modelMultimodal.vision
},
{
key: NodeInputKeyEnum.aiChatAudio,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: modelMultimodal.audio
},
{
key: NodeInputKeyEnum.aiChatVideo,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: modelMultimodal.video
},
{
key: NodeInputKeyEnum.aiChatExtractFiles,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: modelMultimodal.extractFiles
}, },
{ {
key: NodeInputKeyEnum.aiChatReasoning, key: NodeInputKeyEnum.aiChatReasoning,
...@@ -340,7 +383,7 @@ export function agentForm2AppWorkflow( ...@@ -340,7 +383,7 @@ export function agentForm2AppWorkflow(
return { return {
nodes: [systemConfigTemplate(), workflowStartTemplate(), ...workflow.nodes], nodes: [systemConfigTemplate(), workflowStartTemplate(), ...workflow.nodes],
edges: workflow.edges, edges: workflow.edges,
chatConfig: data.chatConfig chatConfig
}; };
} }
......
...@@ -115,24 +115,24 @@ const EditForm = ({ ...@@ -115,24 +115,24 @@ const EditForm = ({
return selectedModel.quoteMaxToken || 3000; return selectedModel.quoteMaxToken || 3000;
}, [selectedModel.quoteMaxToken]); }, [selectedModel.quoteMaxToken]);
// Force close image select when model not support vision // 简易应用不暴露多模态开关,文件选择能力直接跟随模型能力。
useEffect(() => { useEffect(() => {
if (!selectedModel.vision) { setAppForm((state) => ({
setAppForm((state) => ({ ...state,
...state, chatConfig: {
chatConfig: { ...state.chatConfig,
...state.chatConfig, ...(state.chatConfig.fileSelectConfig
...(state.chatConfig.fileSelectConfig ? {
? { fileSelectConfig: {
fileSelectConfig: { ...state.chatConfig.fileSelectConfig,
...state.chatConfig.fileSelectConfig, canSelectImg: !!selectedModel.vision,
canSelectImg: false canSelectAudio: !!selectedModel.audio,
} canSelectVideo: !!selectedModel.video
} }
: {}) }
} : {})
})); }
} }));
}, [selectedModel, setAppForm]); }, [selectedModel, setAppForm]);
useEffect(() => { useEffect(() => {
...@@ -204,6 +204,7 @@ const EditForm = ({ ...@@ -204,6 +204,7 @@ const EditForm = ({
aiChatResponseFormat: appForm.aiSettings.aiChatResponseFormat, aiChatResponseFormat: appForm.aiSettings.aiChatResponseFormat,
aiChatJsonSchema: appForm.aiSettings.aiChatJsonSchema aiChatJsonSchema: appForm.aiSettings.aiChatJsonSchema
}} }}
showMultimodalConfig={false}
onChange={({ maxHistories = 6, ...data }) => { onChange={({ maxHistories = 6, ...data }) => {
setAppForm((state) => ({ setAppForm((state) => ({
...state, ...state,
......
...@@ -36,6 +36,7 @@ import { ...@@ -36,6 +36,7 @@ import {
Input_Template_UserChatInput Input_Template_UserChatInput
} from '@fastgpt/global/core/workflow/template/input'; } from '@fastgpt/global/core/workflow/template/input';
import { workflowStartNodeId } from '@/web/core/app/constants'; import { workflowStartNodeId } from '@/web/core/app/constants';
import { getWebLLMModel } from '@/web/common/system/utils';
import { DatasetSearchModeEnum } from '@fastgpt/global/core/dataset/constants'; import { DatasetSearchModeEnum } from '@fastgpt/global/core/dataset/constants';
import { getAppChatConfig } from '@fastgpt/global/core/workflow/utils'; import { getAppChatConfig } from '@fastgpt/global/core/workflow/utils';
import { getDefaultAppForm } from '@fastgpt/global/core/app/utils'; import { getDefaultAppForm } from '@fastgpt/global/core/app/utils';
...@@ -204,6 +205,27 @@ export function form2AppWorkflow( ...@@ -204,6 +205,27 @@ export function form2AppWorkflow(
const datasetNodeId = 'iKBoX2vIzETU'; const datasetNodeId = 'iKBoX2vIzETU';
const aiChatNodeId = '7BdojPlukIQw'; const aiChatNodeId = '7BdojPlukIQw';
const selectedDatasets = data.dataset.datasets; const selectedDatasets = data.dataset.datasets;
const modelData = getWebLLMModel(data.aiSettings.model);
const modelMultimodal = {
vision: !!modelData?.vision,
audio: !!modelData?.audio,
video: !!modelData?.video,
extractFiles: !!(modelData?.vision || modelData?.audio || modelData?.video)
};
const chatConfig: AppChatConfigType = {
...data.chatConfig,
...(data.chatConfig.fileSelectConfig
? {
fileSelectConfig: {
...data.chatConfig.fileSelectConfig,
canSelectImg: modelMultimodal.vision,
canSelectAudio: modelMultimodal.audio,
canSelectVideo: modelMultimodal.video
}
}
: {})
};
function systemConfigTemplate(): StoreNodeItemType { function systemConfigTemplate(): StoreNodeItemType {
return { return {
nodeId: SystemConfigNode.id, nodeId: SystemConfigNode.id,
...@@ -333,7 +355,28 @@ export function form2AppWorkflow( ...@@ -333,7 +355,28 @@ export function form2AppWorkflow(
renderTypeList: [FlowNodeInputTypeEnum.hidden], renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '', label: '',
valueType: WorkflowIOValueTypeEnum.boolean, valueType: WorkflowIOValueTypeEnum.boolean,
value: true value: modelMultimodal.vision
},
{
key: NodeInputKeyEnum.aiChatAudio,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: modelMultimodal.audio
},
{
key: NodeInputKeyEnum.aiChatVideo,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: modelMultimodal.video
},
{
key: NodeInputKeyEnum.aiChatExtractFiles,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: modelMultimodal.extractFiles
}, },
{ {
key: NodeInputKeyEnum.aiChatReasoning, key: NodeInputKeyEnum.aiChatReasoning,
...@@ -696,7 +739,28 @@ export function form2AppWorkflow( ...@@ -696,7 +739,28 @@ export function form2AppWorkflow(
renderTypeList: [FlowNodeInputTypeEnum.hidden], renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '', label: '',
valueType: WorkflowIOValueTypeEnum.boolean, valueType: WorkflowIOValueTypeEnum.boolean,
value: true value: modelMultimodal.vision
},
{
key: NodeInputKeyEnum.aiChatAudio,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: modelMultimodal.audio
},
{
key: NodeInputKeyEnum.aiChatVideo,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: modelMultimodal.video
},
{
key: NodeInputKeyEnum.aiChatExtractFiles,
renderTypeList: [FlowNodeInputTypeEnum.hidden],
label: '',
valueType: WorkflowIOValueTypeEnum.boolean,
value: modelMultimodal.extractFiles
}, },
{ {
key: NodeInputKeyEnum.aiChatReasoning, key: NodeInputKeyEnum.aiChatReasoning,
...@@ -757,6 +821,6 @@ export function form2AppWorkflow( ...@@ -757,6 +821,6 @@ export function form2AppWorkflow(
return { return {
nodes: [systemConfigTemplate(), workflowStartTemplate(), ...workflow.nodes], nodes: [systemConfigTemplate(), workflowStartTemplate(), ...workflow.nodes],
edges: workflow.edges, edges: workflow.edges,
chatConfig: data.chatConfig chatConfig
}; };
} }
...@@ -27,7 +27,7 @@ import MultipleSelect, { ...@@ -27,7 +27,7 @@ import MultipleSelect, {
} from '@fastgpt/web/components/common/MySelect/MultipleSelect'; } from '@fastgpt/web/components/common/MySelect/MultipleSelect';
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip'; import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
import JsonEditor from '@fastgpt/web/components/common/Textarea/JsonEditor'; import JsonEditor from '@fastgpt/web/components/common/Textarea/JsonEditor';
import React, { useCallback, useMemo, useState } from 'react'; import React, { useCallback, useMemo } from 'react';
import { useFieldArray, type UseFormReturn } from 'react-hook-form'; import { useFieldArray, type UseFormReturn } from 'react-hook-form';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
...@@ -37,13 +37,11 @@ import MyTextarea from '@/components/common/Textarea/MyTextarea'; ...@@ -37,13 +37,11 @@ import MyTextarea from '@/components/common/Textarea/MyTextarea';
import MyNumberInput from '@fastgpt/web/components/common/Input/NumberInput'; import MyNumberInput from '@fastgpt/web/components/common/Input/NumberInput';
import TimeInput from '@/components/core/app/formRender/TimeInput'; import TimeInput from '@/components/core/app/formRender/TimeInput';
import MySlider from '@/components/Slider';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import { useUserStore } from '@/web/support/user/useUserStore'; import { useUserStore } from '@/web/support/user/useUserStore';
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel'; import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
import RadioGroup from '@fastgpt/web/components/common/Radio/RadioGroup'; import RadioGroup from '@fastgpt/web/components/common/Radio/RadioGroup';
import { DatasetSelectModal } from '@/components/core/app/DatasetSelectModal'; import { DatasetSelectModal } from '@/components/core/app/DatasetSelectModal';
import type { EmbeddingModelItemType } from '@fastgpt/global/core/ai/model.schema';
import AIModelSelector from '@/components/Select/AIModelSelector'; import AIModelSelector from '@/components/Select/AIModelSelector';
import { useMemoEnhance } from '@fastgpt/web/hooks/useMemoEnhance'; import { useMemoEnhance } from '@fastgpt/web/hooks/useMemoEnhance';
import { formatTime2YMDHMS } from '@fastgpt/global/common/string/time'; import { formatTime2YMDHMS } from '@fastgpt/global/common/string/time';
...@@ -73,7 +71,7 @@ const InputTypeConfig = ({ ...@@ -73,7 +71,7 @@ const InputTypeConfig = ({
// Update methods // Update methods
onSubmitSuccess: (data: any, action: 'confirm' | 'continue') => void; onSubmitSuccess: (data: any, action: 'confirm' | 'continue') => void;
onSubmitError: (e: Object) => void; onSubmitError: (e: object) => void;
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const defaultListValue = { label: t('common:None'), value: '' }; const defaultListValue = { label: t('common:None'), value: '' };
...@@ -168,7 +166,7 @@ const InputTypeConfig = ({ ...@@ -168,7 +166,7 @@ const InputTypeConfig = ({
const handleRemoveEnum = useCallback( const handleRemoveEnum = useCallback(
(index: number) => { (index: number) => {
const removedValue = mergedSelectEnums[index]?.value; const removedValue = getValues(`list.${index}.value`);
removeEnums(index); removeEnums(index);
if (!removedValue) return; if (!removedValue) return;
...@@ -187,7 +185,7 @@ const InputTypeConfig = ({ ...@@ -187,7 +185,7 @@ const InputTypeConfig = ({
} }
} }
}, },
[mergedSelectEnums, removeEnums, inputType, getValues, setValue] [removeEnums, inputType, getValues, setValue]
); );
const isLastEnumEmpty = !mergedSelectEnums[mergedSelectEnums.length - 1]?.label; const isLastEnumEmpty = !mergedSelectEnums[mergedSelectEnums.length - 1]?.label;
...@@ -639,6 +637,7 @@ const InputTypeConfig = ({ ...@@ -639,6 +637,7 @@ const InputTypeConfig = ({
{inputType === FlowNodeInputTypeEnum.multipleSelect && ( {inputType === FlowNodeInputTypeEnum.multipleSelect && (
<MultipleSelect<string> <MultipleSelect<string>
flex={'1 0 0'} flex={'1 0 0'}
size={'md'}
itemWrap={true} itemWrap={true}
bg={'myGray.50'} bg={'myGray.50'}
list={listValue list={listValue
......
...@@ -90,6 +90,12 @@ const SelectAiModelRender = ({ inputs = [], nodeId }: RenderInputProps) => { ...@@ -90,6 +90,12 @@ const SelectAiModelRender = ({ inputs = [], nodeId }: RenderInputProps) => {
)?.value, )?.value,
aiChatVision: aiChatVision:
inputs.find((input) => input.key === NodeInputKeyEnum.aiChatVision)?.value ?? true, inputs.find((input) => input.key === NodeInputKeyEnum.aiChatVision)?.value ?? true,
aiChatAudio:
inputs.find((input) => input.key === NodeInputKeyEnum.aiChatAudio)?.value ?? false,
aiChatVideo:
inputs.find((input) => input.key === NodeInputKeyEnum.aiChatVideo)?.value ?? false,
aiChatExtractFiles:
inputs.find((input) => input.key === NodeInputKeyEnum.aiChatExtractFiles)?.value ?? true,
aiChatReasoning: aiChatReasoning:
inputs.find((input) => input.key === NodeInputKeyEnum.aiChatReasoning)?.value ?? true, inputs.find((input) => input.key === NodeInputKeyEnum.aiChatReasoning)?.value ?? true,
aiChatReasoningEffort: inputs.find( aiChatReasoningEffort: inputs.find(
......
...@@ -23,7 +23,6 @@ import MyLoading from '@fastgpt/web/components/common/MyLoading'; ...@@ -23,7 +23,6 @@ import MyLoading from '@fastgpt/web/components/common/MyLoading';
import type { CustomDomainType } from '@fastgpt/global/support/customDomain/type'; import type { CustomDomainType } from '@fastgpt/global/support/customDomain/type';
import { useState, useMemo } from 'react'; import { useState, useMemo } from 'react';
import { useUserStore } from '@/web/support/user/useUserStore'; import { useUserStore } from '@/web/support/user/useUserStore';
import { StandardSubLevelEnum } from '@fastgpt/global/support/wallet/sub/constants';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import Tag from '@fastgpt/web/components/common/Tag'; import Tag from '@fastgpt/web/components/common/Tag';
...@@ -60,7 +59,7 @@ const CustomDomain = () => { ...@@ -60,7 +59,7 @@ const CustomDomain = () => {
// onClose: onCloseDomainVerify // onClose: onCloseDomainVerify
// } = useDisclosure(); // } = useDisclosure();
const { runAsync: onDelete, loading: loadingDelete } = useRequest(deleteCustomDomain, { const { runAsync: onDelete } = useRequest(deleteCustomDomain, {
manual: true, manual: true,
successToast: t('common:Success'), successToast: t('common:Success'),
onSuccess: () => refreshCustomDomainList() onSuccess: () => refreshCustomDomainList()
...@@ -194,7 +193,7 @@ const CustomDomain = () => { ...@@ -194,7 +193,7 @@ const CustomDomain = () => {
onClick={() => router.push('/price')} onClick={() => router.push('/price')}
size="md" size="md"
> >
{t('account:upgrade_plan')} {t('account_custom_domain:upgrade_plan')}
</Button> </Button>
</Flex> </Flex>
) )
......
...@@ -321,7 +321,7 @@ const MyInfo = ({ onOpenContact }: { onOpenContact: () => void }) => { ...@@ -321,7 +321,7 @@ const MyInfo = ({ onOpenContact }: { onOpenContact: () => void }) => {
try { try {
await putUpdateMemberName(val); await putUpdateMemberName(val);
initUserInfo(); initUserInfo();
} catch (error) {} } catch {}
}} }}
/> />
</Flex> </Flex>
......
...@@ -27,12 +27,12 @@ const ModelProvider = () => { ...@@ -27,12 +27,12 @@ const ModelProvider = () => {
return ( return (
<FillRowTabs<TabType> <FillRowTabs<TabType>
list={[ list={[
{ label: t('account:active_model'), value: 'model' }, { label: t('account_model:active_model'), value: 'model' },
{ label: t('account:config_model'), value: 'config' }, { label: t('account_model:config_model'), value: 'config' },
// @ts-ignore // @ts-ignore
...(feConfigs?.show_aiproxy ...(feConfigs?.show_aiproxy
? [ ? [
{ label: t('account:channel'), value: 'channel' }, { label: t('account_model:channel'), value: 'channel' },
{ label: t('account_model:log'), value: 'channel_log' }, { label: t('account_model:log'), value: 'channel_log' },
{ label: t('account_model:monitoring'), value: 'account_model' } { label: t('account_model:monitoring'), value: 'account_model' }
] ]
......
...@@ -4,9 +4,9 @@ import type { ModelTypeEnum } from '@fastgpt/global/core/ai/constants'; ...@@ -4,9 +4,9 @@ import type { ModelTypeEnum } from '@fastgpt/global/core/ai/constants';
import { authSystemAdmin } from '@fastgpt/service/support/permission/user/auth'; import { authSystemAdmin } from '@fastgpt/service/support/permission/user/auth';
import type { ModelPriceTierType } from '@fastgpt/global/core/ai/model.schema'; import type { ModelPriceTierType } from '@fastgpt/global/core/ai/model.schema';
export type listQuery = {}; export type listQuery = object;
export type listBody = {}; export type listBody = object;
export type listResponse = { export type listResponse = {
type: `${ModelTypeEnum}`; type: `${ModelTypeEnum}`;
...@@ -26,6 +26,9 @@ export type listResponse = { ...@@ -26,6 +26,9 @@ export type listResponse = {
// Tag // Tag
contextToken?: number; contextToken?: number;
vision?: boolean; vision?: boolean;
audio?: boolean;
video?: boolean;
reasoning?: boolean;
toolChoice?: boolean; toolChoice?: boolean;
}[]; }[];
...@@ -54,6 +57,9 @@ async function handler( ...@@ -54,6 +57,9 @@ async function handler(
contextToken: contextToken:
'maxContext' in model ? model.maxContext : 'maxToken' in model ? model.maxToken : undefined, 'maxContext' in model ? model.maxContext : 'maxToken' in model ? model.maxToken : undefined,
vision: 'vision' in model ? model.vision : undefined, vision: 'vision' in model ? model.vision : undefined,
audio: 'audio' in model ? model.audio : undefined,
video: 'video' in model ? model.video : undefined,
reasoning: 'reasoning' in model ? model.reasoning : undefined,
toolChoice: 'toolChoice' in model ? model.toolChoice : undefined toolChoice: 'toolChoice' in model ? model.toolChoice : undefined
})); }));
} }
......
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