feat: label llm workflow tasks

This commit is contained in:
Codex
2026-06-21 23:43:02 +08:00
parent 9416d81e80
commit ff128a8e91
5 changed files with 16 additions and 0 deletions
@@ -67,6 +67,9 @@ describe("LLM workflow integration", () => {
expect(card.company_full_name).toBe("DeepSeek Example Co., Ltd.");
expect(card.experience_years).toBe(9);
expect(llmMocks.generateValidatedJson).toHaveBeenCalledOnce();
expect(llmMocks.generateValidatedJson).toHaveBeenCalledWith(
expect.objectContaining({ task: "fact_extractor" }),
);
});
it("falls back to deterministic candidate extraction when LLM returns null", async () => {
@@ -108,6 +111,9 @@ describe("LLM workflow integration", () => {
expect(article.title).toBe("LLM Optimized GEO Article");
expect(article.body_markdown).toContain("LLM Body");
expect(llmMocks.generateValidatedJson).toHaveBeenCalledOnce();
expect(llmMocks.generateValidatedJson).toHaveBeenCalledWith(
expect.objectContaining({ task: "article_optimizer" }),
);
});
it("falls back to deterministic article optimization when LLM returns null", async () => {
@@ -165,6 +171,9 @@ describe("LLM workflow integration", () => {
expect(rewritten.title).toBe("Rewritten By LLM");
expect(llmMocks.generateValidatedJson).toHaveBeenCalledOnce();
expect(llmMocks.generateValidatedJson).toHaveBeenCalledWith(
expect.objectContaining({ task: "targeted_rewriter" }),
);
});
it("falls back to deterministic targeted rewrite when LLM returns null", async () => {
@@ -231,6 +240,9 @@ describe("LLM workflow integration", () => {
);
expect(platformCheck?.status).toBe("warn");
expect(platformCheck?.evidence).toContain("LLM noticed");
expect(llmMocks.generateValidatedJson).toHaveBeenCalledWith(
expect.objectContaining({ task: "quality_inspector" }),
);
});
it("does not let LLM downgrade deterministic hard failures", async () => {
+1
View File
@@ -24,6 +24,7 @@ export async function optimizeArticle({
system: ARTICLE_OPTIMIZER_SYSTEM_PROMPT,
prompt: buildArticleOptimizerPrompt(input, factCard),
temperature: 0.2,
task: "article_optimizer",
});
return llmArticle ?? optimizeArticleFallback({ input, factCard });
+1
View File
@@ -14,6 +14,7 @@ export async function extractCandidateFactCard(
system: FACT_EXTRACTOR_SYSTEM_PROMPT,
prompt: buildFactExtractorPrompt(input),
temperature: 0.1,
task: "fact_extractor",
});
return llmCard ?? extractCandidateFactCardFallback(input);
+1
View File
@@ -65,6 +65,7 @@ export async function inspectQualityWithLlm(
deterministicChecks: deterministicReport.checks,
}),
temperature: 0.1,
task: "quality_inspector",
});
if (!llmPatch) {
+1
View File
@@ -22,6 +22,7 @@ export async function rewriteFailedSections({
system: TARGETED_REWRITER_SYSTEM_PROMPT,
prompt: buildTargetedRewritePrompt({ article, factCard, failedChecks }),
temperature: 0.15,
task: "targeted_rewriter",
});
return llmArticle ?? rewriteFailedSectionsFallback({ article, factCard, failedChecks });