mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-08 14:29:15 +08:00
refactor(services): 提取 FetchChatCompletionOptions 类型以提升代码可维护性
This commit is contained in:
parent
ddb203170e
commit
d4a22d3b0c
@ -75,6 +75,12 @@ export async function fetchMcpTools(assistant: Assistant) {
|
|||||||
return mcpTools
|
return mcpTools
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type FetchChatCompletionOptions = {
|
||||||
|
signal?: AbortSignal
|
||||||
|
timeout?: number
|
||||||
|
headers?: Record<string, string>
|
||||||
|
}
|
||||||
|
|
||||||
export async function fetchChatCompletion({
|
export async function fetchChatCompletion({
|
||||||
messages,
|
messages,
|
||||||
assistant,
|
assistant,
|
||||||
@ -84,11 +90,7 @@ export async function fetchChatCompletion({
|
|||||||
}: {
|
}: {
|
||||||
messages: StreamTextParams['messages']
|
messages: StreamTextParams['messages']
|
||||||
assistant: Assistant
|
assistant: Assistant
|
||||||
options: {
|
options: FetchChatCompletionOptions
|
||||||
signal?: AbortSignal
|
|
||||||
timeout?: number
|
|
||||||
headers?: Record<string, string>
|
|
||||||
}
|
|
||||||
onChunkReceived: (chunk: Chunk) => void
|
onChunkReceived: (chunk: Chunk) => void
|
||||||
topicId?: string // 添加 topicId 参数
|
topicId?: string // 添加 topicId 参数
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user