feat(思维导图): 在图片提示中添加上下文路径信息

添加从根节点到当前节点的路径上下文,当路径较长时显示最后4个节点以保持简洁。同时更新中英文翻译文件以包含新的上下文参数。
This commit is contained in:
liuziting
2026-01-21 23:31:07 +08:00
parent 4c6ef870cb
commit 3feb0a9727
3 changed files with 5 additions and 3 deletions

View File

@@ -657,6 +657,8 @@ export function useThinkFlow({ t, locale }: { t: Translate; locale: Ref<string>
try {
const topic = node.data.label || prompt
const detail = node.data.description || ''
const path = findPathToNode(nodeId)
const context = path.length > 5 ? `... -> ${path.slice(-4).join(' -> ')}` : path.join(' -> ')
const response = await fetch(useConfig.baseUrl, {
method: 'POST',
headers: {
@@ -665,7 +667,7 @@ export function useThinkFlow({ t, locale }: { t: Translate; locale: Ref<string>
},
body: JSON.stringify({
model: useConfig.model,
prompt: t('prompts.image', { topic, detail })
prompt: t('prompts.image', { topic, detail, context })
})
})