mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-27 12:51:26 +08:00
feat(hooks): add systemPrompt parameter to useQuickCompletion hook
This commit is contained in:
parent
684c0a7b63
commit
2f3e634880
@ -29,19 +29,20 @@ export type QuickCompletionParams = {
|
||||
params?: Partial<Omit<FetchChatCompletionParams, 'prompt' | 'messages' | 'assistant' | 'onChunkReceived'>>
|
||||
}
|
||||
|
||||
export const useQuickCompletion = () => {
|
||||
export const useQuickCompletion = (systemPrompt: string) => {
|
||||
const { quickModel } = useDefaultModel()
|
||||
|
||||
const completion = useCallback(
|
||||
async ({ prompt, onChunk, assistantUpdate, params }: QuickCompletionParams) => {
|
||||
const assistant = {
|
||||
...getDefaultAssistant(),
|
||||
prompt: systemPrompt,
|
||||
model: quickModel,
|
||||
...assistantUpdate
|
||||
} satisfies Assistant
|
||||
return fetchChatCompletion({ prompt, assistant, onChunkReceived: onChunk, ...params })
|
||||
},
|
||||
[quickModel]
|
||||
[quickModel, systemPrompt]
|
||||
)
|
||||
|
||||
return completion
|
||||
|
||||
Loading…
Reference in New Issue
Block a user