Skip to content

Commit abc479e

Browse files
authored
feat: support fastdeploy model api (#636)
Signed-off-by: Bob Du <i@bobdu.cc>
1 parent f7558f5 commit abc479e

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

service/src/chatgpt/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ async function chatReplyProcess(options: RequestOptions) {
119119
enable_thinking: false,
120120
}
121121
}
122+
else if (key.keyModel === 'FastDeploy') {
123+
getSearchQueryChatCompletionCreateBody.metadata = {
124+
// @ts-expect-error FastDeploy supports a set of parameters that are not part of the OpenAI API.
125+
enable_thinking: false,
126+
}
127+
}
122128
const completion = await openai.chat.completions.create(getSearchQueryChatCompletionCreateBody)
123129
let searchQuery: string = completion.choices[0].message.content
124130
const match = searchQuery.match(/<search_query>([\s\S]*)<\/search_query>/i)
@@ -201,6 +207,12 @@ search result: <search_result>${searchResultContent}</search_result>`,
201207
enable_thinking: options.room.thinkEnabled,
202208
}
203209
}
210+
else if (key.keyModel === 'FastDeploy') {
211+
chatCompletionCreateBody.metadata = {
212+
// @ts-expect-error FastDeploy supports a set of parameters that are not part of the OpenAI API.
213+
enable_thinking: options.room.thinkEnabled,
214+
}
215+
}
204216
const stream = await openai.chat.completions.create(
205217
chatCompletionCreateBody,
206218
{

service/src/storage/model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,4 +326,4 @@ export class UserPrompt {
326326
}
327327
}
328328

329-
export type APIMODEL = 'ChatGPTAPI' | 'VLLM'
329+
export type APIMODEL = 'ChatGPTAPI' | 'VLLM' | 'FastDeploy'

src/components/common/Setting/model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ export class UserPrompt {
122122
}
123123
}
124124

125-
export type APIMODEL = 'ChatGPTAPI' | 'VLLM'
125+
export type APIMODEL = 'ChatGPTAPI' | 'VLLM' | 'FastDeploy'
126126

127-
export const apiModelOptions = ['ChatGPTAPI', 'VLLM'].map((model: string) => {
127+
export const apiModelOptions = ['ChatGPTAPI', 'VLLM', 'FastDeploy'].map((model: string) => {
128128
return {
129129
label: model,
130130
key: model,

0 commit comments

Comments
 (0)