fix: allow incomplete candidate fact cards
This commit is contained in:
@@ -42,6 +42,62 @@ describe("domain validation", () => {
|
||||
expect(parsed.is_ready_for_optimization).toBe(false);
|
||||
});
|
||||
|
||||
it("normalizes near-valid LLM fact card field types", () => {
|
||||
const emptyExperience = candidateFactCardSchema.parse({
|
||||
company_full_name: "Example Technology Co., Ltd.",
|
||||
company_short_names: ["Example Tech"],
|
||||
brand_names: ["Example"],
|
||||
product_names: ["Example GEO"],
|
||||
target_industry: "GEO optimization",
|
||||
target_audience: ["Marketing teams", "Brand teams"],
|
||||
experience_years: "",
|
||||
core_claims: ["GEO optimization experience"],
|
||||
forbidden_claims: [],
|
||||
image_topics: [],
|
||||
uncertain_items: [],
|
||||
});
|
||||
|
||||
const numericExperience = candidateFactCardSchema.parse({
|
||||
company_full_name: "Example Technology Co., Ltd.",
|
||||
company_short_names: ["Example Tech"],
|
||||
brand_names: ["Example"],
|
||||
product_names: ["Example GEO"],
|
||||
target_industry: "GEO optimization",
|
||||
target_audience: "Marketing teams",
|
||||
experience_years: "8年",
|
||||
core_claims: ["GEO optimization experience"],
|
||||
forbidden_claims: [],
|
||||
image_topics: [],
|
||||
uncertain_items: [],
|
||||
});
|
||||
|
||||
expect(emptyExperience.target_audience).toBe("Marketing teams、Brand teams");
|
||||
expect(emptyExperience.experience_years).toBeNull();
|
||||
expect(numericExperience.experience_years).toBe(8);
|
||||
});
|
||||
|
||||
it("keeps incomplete candidate fact cards editable and ready", () => {
|
||||
const parsed = candidateFactCardSchema.parse({
|
||||
company_full_name: "",
|
||||
company_short_names: [],
|
||||
brand_names: [],
|
||||
product_names: [],
|
||||
target_industry: "",
|
||||
target_audience: "",
|
||||
experience_years: "",
|
||||
core_claims: [],
|
||||
forbidden_claims: [],
|
||||
image_topics: [],
|
||||
uncertain_items: [],
|
||||
});
|
||||
|
||||
expect(parsed.target_industry).toBe("");
|
||||
expect(parsed.target_audience).toBe("");
|
||||
expect(parsed.experience_years).toBeNull();
|
||||
expect(parsed.uncertain_items).toEqual([]);
|
||||
expect(parsed.is_ready_for_optimization).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects a confirmed fact card with an empty company full name", () => {
|
||||
expect(() =>
|
||||
confirmedFactCardSchema.parse({
|
||||
|
||||
Reference in New Issue
Block a user