feat(思维导图): 增强深度探索提示的上下文关联

在useThinkFlow中添加根节点、路径上下文和节点详情到深度探索提示
更新中英文提示模板以支持更丰富的上下文信息
This commit is contained in:
liuziting
2026-01-22 10:07:58 +08:00
parent 9d42ad07d3
commit 2708ccd864
3 changed files with 12 additions and 6 deletions

View File

@@ -786,6 +786,12 @@ export function useThinkFlow({ t, locale }: { t: Translate; locale: Ref<string>
const finalApiKey = apiConfig.mode === 'default' ? useConfig.apiKey || API_KEY : useConfig.apiKey
try {
const rootNode = flowNodes.value.find(n => n.data.type === 'root')
const rootTopic = rootNode?.data?.label || ''
const detail = node.data.description || ''
const path = findPathToNode(nodeId)
const context = path.join(' -> ')
const response = await fetch(useConfig.baseUrl, {
method: 'POST',
headers: {
@@ -794,7 +800,7 @@ export function useThinkFlow({ t, locale }: { t: Translate; locale: Ref<string>
},
body: JSON.stringify({
model: useConfig.model,
messages: [{ role: 'user', content: t('prompts.deepDivePrompt', { topic }) }]
messages: [{ role: 'user', content: t('prompts.deepDivePrompt', { rootTopic, context, topic, detail }) }]
})
})