mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-27 04:31:27 +08:00
fix: use system prompt variables in quick assistant (#10925)
* feat: replace prompt variables in assistant before chat completion
* refactor(home-window): reorder prompt variable replacement for clarity
Move prompt variable replacement before message preparation to improve logical flow
(cherry picked from commit c7c9e1ee44)
This commit is contained in:
parent
c3b0beb37f
commit
156ceca4a7
@ -19,6 +19,7 @@ import { abortCompletion } from '@renderer/utils/abortController'
|
||||
import { isAbortError } from '@renderer/utils/error'
|
||||
import { createMainTextBlock, createThinkingBlock } from '@renderer/utils/messageUtils/create'
|
||||
import { getMainTextContent } from '@renderer/utils/messageUtils/find'
|
||||
import { replacePromptVariables } from '@renderer/utils/prompt'
|
||||
import { defaultLanguage } from '@shared/config/constant'
|
||||
import { IpcChannel } from '@shared/IpcChannel'
|
||||
import { Divider } from 'antd'
|
||||
@ -266,6 +267,10 @@ const HomeWindow: FC<{ draggable?: boolean }> = ({ draggable = true }) => {
|
||||
newAssistant.webSearchProviderId = undefined
|
||||
newAssistant.mcpServers = undefined
|
||||
newAssistant.knowledge_bases = undefined
|
||||
// replace prompt vars
|
||||
newAssistant.prompt = await replacePromptVariables(currentAssistant.prompt, currentAssistant?.model.name)
|
||||
// logger.debug('newAssistant', newAssistant)
|
||||
|
||||
const { modelMessages, uiMessages } = await ConversationService.prepareMessagesForModel(
|
||||
messagesForContext,
|
||||
newAssistant
|
||||
|
||||
Loading…
Reference in New Issue
Block a user