From 12e2cd6e0327c5e4cc354177c8e42d710890ff34 Mon Sep 17 00:00:00 2001 From: Bob Du Date: Wed, 2 Jul 2025 00:30:38 +0800 Subject: [PATCH] feat: support fastdeploy model api Signed-off-by: Bob Du --- service/src/chatgpt/index.ts | 12 ++++++++++++ service/src/storage/model.ts | 2 +- src/components/common/Setting/model.ts | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/service/src/chatgpt/index.ts b/service/src/chatgpt/index.ts index 55318248..f8b21e8f 100644 --- a/service/src/chatgpt/index.ts +++ b/service/src/chatgpt/index.ts @@ -119,6 +119,12 @@ async function chatReplyProcess(options: RequestOptions) { enable_thinking: false, } } + else if (key.keyModel === 'FastDeploy') { + getSearchQueryChatCompletionCreateBody.metadata = { + // @ts-expect-error FastDeploy supports a set of parameters that are not part of the OpenAI API. + enable_thinking: false, + } + } const completion = await openai.chat.completions.create(getSearchQueryChatCompletionCreateBody) let searchQuery: string = completion.choices[0].message.content const match = searchQuery.match(/([\s\S]*)<\/search_query>/i) @@ -201,6 +207,12 @@ search result: ${searchResultContent}`, enable_thinking: options.room.thinkEnabled, } } + else if (key.keyModel === 'FastDeploy') { + chatCompletionCreateBody.metadata = { + // @ts-expect-error FastDeploy supports a set of parameters that are not part of the OpenAI API. + enable_thinking: options.room.thinkEnabled, + } + } const stream = await openai.chat.completions.create( chatCompletionCreateBody, { diff --git a/service/src/storage/model.ts b/service/src/storage/model.ts index 5890b923..2bcd6cee 100644 --- a/service/src/storage/model.ts +++ b/service/src/storage/model.ts @@ -326,4 +326,4 @@ export class UserPrompt { } } -export type APIMODEL = 'ChatGPTAPI' | 'VLLM' +export type APIMODEL = 'ChatGPTAPI' | 'VLLM' | 'FastDeploy' diff --git a/src/components/common/Setting/model.ts b/src/components/common/Setting/model.ts index e75a9c09..a0f53220 100644 --- a/src/components/common/Setting/model.ts +++ b/src/components/common/Setting/model.ts @@ -122,9 +122,9 @@ export class UserPrompt { } } -export type APIMODEL = 'ChatGPTAPI' | 'VLLM' +export type APIMODEL = 'ChatGPTAPI' | 'VLLM' | 'FastDeploy' -export const apiModelOptions = ['ChatGPTAPI', 'VLLM'].map((model: string) => { +export const apiModelOptions = ['ChatGPTAPI', 'VLLM', 'FastDeploy'].map((model: string) => { return { label: model, key: model,