feat(思维导图): 增强深度探索提示的上下文关联
在useThinkFlow中添加根节点、路径上下文和节点详情到深度探索提示 更新中英文提示模板以支持更丰富的上下文信息
This commit is contained in:
@@ -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 }) }]
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -80,13 +80,13 @@
|
||||
},
|
||||
"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. 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.",
|
||||
"image": "Create a premium photorealistic image for a mind-map node (not a poster, not a collage). First interpret the context chain and turn it into ONE clear visual metaphor: show 1 main subject + at most 1-2 minimal supporting elements (only to hint the context mood), do NOT try to depict every concept in the chain. The main subject must represent [{topic}]. Use [{detail}] as subtle traits (ignore if empty). Style: minimalist high-end still-life / product photography, clean background (solid or soft gradient), cohesive color palette, realistic materials and micro-textures, correct perspective and proportions, soft natural or cinematic lighting, shallow depth of field, ultra-sharp high resolution. Aspect ratio: 16:9. FORBIDDEN: any text/watermark/logo; cartoon/illustration/anime/hand-drawn/3D render look; heavy filters; cluttered background; crowded elements/people; distortion, blur, low-res. Context chain: {context}",
|
||||
"continue": "Please continue exploring",
|
||||
"coreIdeaPrefix": "Core Idea",
|
||||
"contextPath": "Thinking Context Path",
|
||||
"selectedNode": "Current Selected Node",
|
||||
"newRequirement": "User Follow-up/New Requirement",
|
||||
"deepDivePrompt": "Please provide a deep and detailed analysis of 【{topic}】. Requirements:\n1. Clear structure, including background, core principles, key elements, and practical applications.\n2. Professional yet easy-to-understand language.\n3. Total length around 300-500 words.\n4. Output the body text directly, do not use JSON format, and do not include any opening or closing remarks.",
|
||||
"deepDivePrompt": "You are generating an in-depth answer for a node in a mind map. You MUST ground the explanation in the root question and the full context path from root to the current node to avoid drifting.\n\nRoot question / Core idea: {rootTopic}\nContext path (root -> current): {context}\nCurrent node: {topic}\nNode description / hints: {detail}\n\nRequirements:\n1. About 300-500 words, well-structured: background, core principles, key points, and practical applications/examples.\n2. Explicitly connect back to the root question/core idea, and explain the role of this node within the path.\n3. If information is insufficient, make reasonable assumptions and label them as \"Assumption\".\n4. Output the body directly (Markdown headings/lists allowed). Do NOT output JSON. No opening/closing remarks.",
|
||||
"summaryPrompt": "You are a thinking summary expert. Please generate a structured summary based on the provided mind map node information (including the core idea and all branched sub-ideas).\n\nNode data:\n{nodes}\n\nRequirements:\n1. Extract the core theme and its underlying logic.\n2. Summarize several main dimensions or branch directions.\n3. Conclude with final insights or conclusions.\n4. Language should be concise, professional, and inspiring.\n5. Output the summary content directly, do not use JSON format, and do not include any opening remarks."
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,13 +80,13 @@
|
||||
},
|
||||
"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": "这是一张高质量写实摄影风格的图片。上下文(从根到当前的概念链路):{context}。主体/概念:{topic}。详情/特征:{detail}。画面要求:真实材质与细节、准确透视与比例、自然光或电影级布光、干净背景与高级构图、色彩克制,适合作为思维导图的视觉核心。质量:超清、锐利、噪点控制自然、层次分明的景深。严禁:任何文字/水印/Logo;卡通、插画、绘本、手绘、漫画、动漫、3D 渲染感、过度滤镜、变形、模糊、低清。",
|
||||
"image": "请生成一张思维导图的核心配图,需同时具备视觉吸引力和概念清晰度。\n\n画面主体与构图:\n- 核心概念:{topic}\n- 关键细节与特征:{detail}\n- 环境/背景暗示:{context}(作为画面氛围或元素参考,不喧宾夺主)\n\n视觉风格要求:\n- 摄影类型:专业级写实摄影,接近商业静物或概念摄影风格\n- 构图:干净、聚焦、有视觉层次,主体突出\n- 光影:自然光或柔和的电影光,明暗对比有氛围感\n- 材质与细节:真实质感,细节丰富但不杂乱\n- 色彩:低饱和度、高级灰调或自然色调,色彩统一有层次\n- 透视与比例:准确、舒适,略带一点视觉张力(若适用)\n\n画面质量:\n- 超高清,细节锐利\n- 噪点控制得当,画面干净\n- 景深有层次,焦点清晰\n\n不适合出现的元素(严禁):\n- 文字、水印、标志、边框\n- 任何非写实风格:卡通、漫画、插画、3D渲染感、手绘效果\n- 过度滤镜、画面变形、模糊、低分辨率\n- 背景杂乱、色彩刺眼、元素堆砌\n\n特别说明:\n请将 {topic} 作为视觉焦点,{detail} 作为可识别的特征融入画面,{context} 作为环境或氛围参考。整体画面应宁静、有深度、易于理解,适合作为思维导图的视觉中心。",
|
||||
"continue": "请继续深入发散",
|
||||
"coreIdeaPrefix": "核心想法",
|
||||
"contextPath": "思考上下文路径",
|
||||
"selectedNode": "当前选择节点",
|
||||
"newRequirement": "用户追问/新要求",
|
||||
"deepDivePrompt": "请针对【{topic}】提供一个深度且详细的解析。要求:\n1. 结构清晰,包含背景、核心原理、关键要素和实际应用。\n2. 语言专业且易懂。\n3. 总字数控制在 300-500 字左右。\n4. 直接输出正文内容,不要包含 JSON 格式,也不要包含任何开场白或结束语。",
|
||||
"deepDivePrompt": "你正在为思维导图中的一个节点生成“回答”。必须结合根问题与从根到当前节点的上下文路径进行解释,避免跑偏。\n\n根问题/核心想法:{rootTopic}\n上下文路径(从根到当前):{context}\n当前节点:{topic}\n/提示:{detail}\n\n要求:\n1. 输出 300-500 字左右,结构清晰,包含背景、核心原理、关键要点与实际应用/例子。\n2. 所有解释都要明确呼应“根问题/核心想法”,并说明该节点在整条路径中的作用与位置。\n3. 若信息不足,请给出合理假设并标注“假设”。\n4. 直接输出正文内容(可使用 Markdown 小标题/列表),不要包含 JSON,也不要写开场白/结束语。",
|
||||
"summaryPrompt": "你是一个思维总结专家。请根据以下提供的思维导图节点信息(包含核心想法及其发散出的所有子想法),生成一份结构化的全篇总结。\n\n节点数据如下:\n{nodes}\n\n要求:\n1. 提炼出核心主题及其背后的核心逻辑。\n2. 归纳出几个主要的维度或分支方向。\n3. 总结最终达成的洞察或结论。\n4. 语言要精炼、专业,富有启发性。\n5. 直接输出总结内容,不要包含 JSON 格式,不要有任何开场白。"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user