feat(思维导图): 在图片提示中添加上下文路径信息
添加从根节点到当前节点的路径上下文,当路径较长时显示最后4个节点以保持简洁。同时更新中英文翻译文件以包含新的上下文参数。
This commit is contained in:
@@ -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 })
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
},
|
||||
"prompts": {
|
||||
"system": "You are a mind-mapping assistant that helps users expand their ideas layer by layer into a thinking tree.\n\nWorkflow:\n1. User provides an initial idea (or selects an existing node).\n2. Understand user intent based on the [Thinking Context Path] (trace from root to current node).\n3. Generate 3-5 deeper or related sub-ideas.\n4. Each sub-idea includes a short name and a minimal description.\n\nResponse format must be strict JSON:\n{'{'}\n \"nodes\": [\n {'{'} \"text\": \"Sub-idea 1 Name\", \"description\": \"One-sentence description\" {'}'},\n {'{'} \"text\": \"Sub-idea 2 Name\", \"description\": \"One-sentence description\" {'}'}\n ]\n{'}'}\n\nNote: Return ONLY JSON, no explanation.",
|
||||
"image": "A high-quality photorealistic, camera-like image. Subject/Concept: {topic}. Details/Traits: {detail}. Requirements: realistic materials and fine details, correct perspective and proportions, natural or cinematic lighting, clean background, premium composition, restrained color palette—suitable as a visual centerpiece for a mind map. Quality: ultra sharp, high resolution, natural depth of field. STRICTLY FORBIDDEN: any text/watermark/logo; cartoon/illustration/picture-book style, hand-drawn, anime, 3D render look, heavy filters, distortion, blur, low-res.",
|
||||
"image": "A high-quality photorealistic, camera-like image. Context (concept chain from root to current): {context}. Subject/Concept: {topic}. Details/Traits: {detail}. Requirements: realistic materials and fine details, correct perspective and proportions, natural or cinematic lighting, clean background, premium composition, restrained color palette—suitable as a visual centerpiece for a mind map. Quality: ultra sharp, high resolution, natural depth of field. STRICTLY FORBIDDEN: any text/watermark/logo; cartoon/illustration/picture-book style, hand-drawn, anime, 3D render look, heavy filters, distortion, blur, low-res.",
|
||||
"continue": "Please continue exploring",
|
||||
"coreIdeaPrefix": "Core Idea",
|
||||
"contextPath": "Thinking Context Path",
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
},
|
||||
"prompts": {
|
||||
"system": "你是一个思维发散助手,帮助用户将想法逐层展开,构建思维树。\n\n工作流程:\n1. 用户给出一个初始想法(或选择一个已有节点继续追问)。\n2. 你需要根据【思考上下文路径】(即从根节点到当前节点的思考链路)来理解用户的意图。\n3. 生成 3-5 个更深层或相关维度的子想法。\n4. 每个子想法包含简短名称和极简描述。\n\n返回格式必须为严格 JSON:\n{'{'}\n \"nodes\": [\n {'{'} \"text\": \"子想法1名称\", \"description\": \"一句话描述\" {'}'},\n {'{'} \"text\": \"子想法2名称\", \"description\": \"一句话描述\" {'}'}\n ]\n{'}'}\n\n注意:只返回 JSON,不附加解释。",
|
||||
"image": "这是一张高质量写实摄影风格的图片。主体/概念:{topic}。详情/特征:{detail}。画面要求:真实材质与细节、准确透视与比例、自然光或电影级布光、干净背景与高级构图、色彩克制,适合作为思维导图的视觉核心。质量:超清、锐利、噪点控制自然、层次分明的景深。严禁:任何文字/水印/Logo;卡通、插画、绘本、手绘、漫画、动漫、3D 渲染感、过度滤镜、变形、模糊、低清。",
|
||||
"image": "这是一张高质量写实摄影风格的图片。上下文(从根到当前的概念链路):{context}。主体/概念:{topic}。详情/特征:{detail}。画面要求:真实材质与细节、准确透视与比例、自然光或电影级布光、干净背景与高级构图、色彩克制,适合作为思维导图的视觉核心。质量:超清、锐利、噪点控制自然、层次分明的景深。严禁:任何文字/水印/Logo;卡通、插画、绘本、手绘、漫画、动漫、3D 渲染感、过度滤镜、变形、模糊、低清。",
|
||||
"continue": "请继续深入发散",
|
||||
"coreIdeaPrefix": "核心想法",
|
||||
"contextPath": "思考上下文路径",
|
||||
|
||||
Reference in New Issue
Block a user