fix: 兼容优化稿LLM可选字段
This commit is contained in:
@@ -200,4 +200,35 @@ describe("domain validation", () => {
|
||||
"body: Fixed sentence flow.",
|
||||
]);
|
||||
});
|
||||
|
||||
it("normalizes near-valid optimized article LLM optional fields", () => {
|
||||
const parsed = optimizedArticleSchema.parse({
|
||||
title: { text: "示例科技 GEO 内容优化方案" },
|
||||
summary: ["围绕事实卡重写官网文章摘要"],
|
||||
body_markdown: {
|
||||
markdown: "## 服务能力\n示例科技有限公司提供GEO内容优化服务。",
|
||||
},
|
||||
image_suggestions: [
|
||||
"当前版本不生成图片建议",
|
||||
{ source: "image_1" },
|
||||
{ suggestion: "使用产品后台截图" },
|
||||
{ source: "image_2", suggestion: "保留原文截图说明" },
|
||||
],
|
||||
changed_sections: [
|
||||
{ section: "title", change: "改成中文官网标题" },
|
||||
],
|
||||
requires_user_confirmation: [
|
||||
{ claim: "客户案例", reason: "原文没有给出客户名称" },
|
||||
],
|
||||
});
|
||||
|
||||
expect(parsed.title).toBe("示例科技 GEO 内容优化方案");
|
||||
expect(parsed.summary).toBe("围绕事实卡重写官网文章摘要");
|
||||
expect(parsed.body_markdown).toContain("## 服务能力");
|
||||
expect(parsed.image_suggestions).toEqual([
|
||||
{ source: "image_2", suggestion: "保留原文截图说明" },
|
||||
]);
|
||||
expect(parsed.changed_sections).toEqual(["title: 改成中文官网标题"]);
|
||||
expect(parsed.requires_user_confirmation).toEqual(["客户案例"]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user