优化输出内容
This commit is contained in:
65
server2.js
65
server2.js
@@ -1484,18 +1484,39 @@ app.post("/analyze", upload.single("file"), async (req, res) => {
|
|||||||
const imageAnalysisMessages = [
|
const imageAnalysisMessages = [
|
||||||
{
|
{
|
||||||
role: "system",
|
role: "system",
|
||||||
content: "你是一名图像分析专家,需要结合历史对话内容分析当前图像。"
|
content: `
|
||||||
|
你是一名图像分析专家。
|
||||||
|
你的任务不是描述图像内容,而是:
|
||||||
|
- 仅提炼【用于后续分析的思考线索】
|
||||||
|
- 不出现任何具体物体、文字、数值、位置
|
||||||
|
- 不描述画面、不复述图片
|
||||||
|
强制规则:
|
||||||
|
- 不得出现以下词语:
|
||||||
|
thinking, answer, 思路, 结论, 分析, 推理, 过程
|
||||||
|
- 不使用“基于以上”“综合来看”等过渡句
|
||||||
|
- 不重复前文
|
||||||
|
|
||||||
|
|
||||||
|
输出要求:
|
||||||
|
- 仅输出【思路线索】
|
||||||
|
- 使用抽象、概括性语言
|
||||||
|
- 禁止出现任何图像细节
|
||||||
|
`
|
||||||
},
|
},
|
||||||
...historyMessages, // 添加历史对话作为上下文
|
...historyMessages, // 添加历史对话作为上下文
|
||||||
{
|
{
|
||||||
role: "user",
|
role: "user",
|
||||||
content: [
|
content: [
|
||||||
{ type: "text", text: userPrompt || `请描述图片内容, 请输出【思路概览】,模拟人类分析问题的过程,但不要暴露内部推理细节。
|
{ type: "text", text: `
|
||||||
|
请基于图片,仅输出【思路线索】而不是图片内容。
|
||||||
|
|
||||||
要求:
|
要求:
|
||||||
- 使用项目符号
|
- 使用项目符号
|
||||||
- 只输出思路,不给结论
|
- 只描述“分析思路方向”
|
||||||
` },
|
- 不描述看到什么
|
||||||
|
- 不出现“分析过程”“推理”"thinking""answer"等字眼
|
||||||
|
- 不下结论
|
||||||
|
` },
|
||||||
imageBase64
|
imageBase64
|
||||||
? {
|
? {
|
||||||
type: "image_url",
|
type: "image_url",
|
||||||
@@ -1532,7 +1553,7 @@ app.post("/analyze", upload.single("file"), async (req, res) => {
|
|||||||
|
|
||||||
if (delta) {
|
if (delta) {
|
||||||
res.write(
|
res.write(
|
||||||
`data: ${JSON.stringify({ type: "scene", content: delta })}\n\n`
|
`data: ${JSON.stringify({ type: "thinking", content: delta })}\n\n`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1546,11 +1567,19 @@ app.post("/analyze", upload.single("file"), async (req, res) => {
|
|||||||
role: "system",
|
role: "system",
|
||||||
content: `
|
content: `
|
||||||
你是一名新能源项目AI分析师。
|
你是一名新能源项目AI分析师。
|
||||||
请输出【思路概览】,模拟人类分析问题的过程,但不要暴露内部推理细节。
|
|
||||||
|
请基于:
|
||||||
|
- 历史对话
|
||||||
|
- 图片提供的【思路线索】
|
||||||
|
|
||||||
|
输出【思路概览】。
|
||||||
|
|
||||||
要求:
|
要求:
|
||||||
|
- 模拟人类分析路径
|
||||||
|
- 不出现任何图片内容
|
||||||
|
- 不给结论
|
||||||
- 使用项目符号
|
- 使用项目符号
|
||||||
- 只输出思路,不给结论
|
- 不出现“分析过程”“推理”"thinking""answer"等字眼
|
||||||
`
|
`
|
||||||
},
|
},
|
||||||
...historyMessages,
|
...historyMessages,
|
||||||
@@ -1602,14 +1631,16 @@ app.post("/analyze", upload.single("file"), async (req, res) => {
|
|||||||
{
|
{
|
||||||
role: "system",
|
role: "system",
|
||||||
content: `
|
content: `
|
||||||
你是一名新能源项目图像分析AI。
|
你是一名新能源项目分析AI。
|
||||||
请基于以下信息,输出【最终结论】:
|
|
||||||
|
|
||||||
要求:
|
请基于【思路概览】,输出【最终结论】。
|
||||||
- 内容完整、专业、可执行
|
|
||||||
- 不重复思路概览
|
要求:
|
||||||
- 可以分段、分点说明
|
- 专业、完整、可执行
|
||||||
`
|
- 不复述思路
|
||||||
|
- 不描述图片
|
||||||
|
- 不出现“分析过程”“推理”"thinking""answer"等字眼
|
||||||
|
`
|
||||||
},
|
},
|
||||||
...historyMessages,
|
...historyMessages,
|
||||||
{
|
{
|
||||||
@@ -1618,7 +1649,7 @@ app.post("/analyze", upload.single("file"), async (req, res) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
role: "assistant",
|
role: "assistant",
|
||||||
content: sceneText + thinkingText
|
content: thinkingText
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user