feat(product-suite): align reference prompt rules
This commit is contained in:
@@ -110,6 +110,8 @@ class ProductSuiteTests(unittest.TestCase):
|
||||
self.assertIn("禁止海报长图、详情页长图和多宫格拼接版面", spec["prompt"])
|
||||
self.assertIn("禁止在画面中出现任何国旗", spec["prompt"])
|
||||
self.assertIn("当前上传图片是本任务唯一主参考图", spec["prompt"])
|
||||
self.assertNotIn("参考图规则:", spec["prompt"])
|
||||
self.assertNotIn("序号%d" % spec["source_index"], spec["prompt"])
|
||||
self.assertTrue(
|
||||
spec["prompt"].splitlines()[-1].startswith("本次生成比例:4:3")
|
||||
)
|
||||
@@ -123,11 +125,49 @@ class ProductSuiteTests(unittest.TestCase):
|
||||
specs[1]["prompt"],
|
||||
)
|
||||
white_prompt = specs[0]["prompt"]
|
||||
reference_rule = (
|
||||
"当前上传图片是本任务唯一主参考图;保持商品主体、款式、颜色和关键细节准确;"
|
||||
"不编造用户与参考图均未提供的信息。"
|
||||
)
|
||||
self.assertLess(white_prompt.index("重要尺寸要求"), white_prompt.index("重要禁用内容"))
|
||||
self.assertLess(white_prompt.index("重要禁用内容"), white_prompt.index("价格信息规则"))
|
||||
self.assertLess(white_prompt.index("价格信息规则"), white_prompt.index("尺码信息规则"))
|
||||
self.assertLess(white_prompt.index("尺码信息规则"), white_prompt.index("参考图规则"))
|
||||
self.assertLess(white_prompt.index("参考图规则"), white_prompt.index("商品卖点与要求"))
|
||||
self.assertLess(white_prompt.index("尺码信息规则"), white_prompt.index(reference_rule))
|
||||
self.assertLess(white_prompt.index(reference_rule), white_prompt.index("商品卖点与要求"))
|
||||
|
||||
def test_reference_rule_follows_per_image_primary_setting(self):
|
||||
template = prompts.load_default_product_suite_prompt()
|
||||
settings = product_suite.default_suite_settings()
|
||||
|
||||
single_primary = product_suite.build_suite_prompt(
|
||||
"卖点",
|
||||
settings,
|
||||
"场景图",
|
||||
"51100639510",
|
||||
template_text=template,
|
||||
)
|
||||
self.assertIn(
|
||||
"使用第一張上傳圖作為主商品圖,其餘圖片只作為參考。",
|
||||
single_primary,
|
||||
)
|
||||
self.assertNotIn("当前上传图片是本任务唯一主参考图", single_primary)
|
||||
self.assertNotIn("参考图规则:使用", single_primary)
|
||||
|
||||
settings["per_image_primary"] = True
|
||||
per_image_primary = product_suite.build_suite_prompt(
|
||||
"卖点",
|
||||
settings,
|
||||
"场景图",
|
||||
"51100639510",
|
||||
source_index=2,
|
||||
template_text=template,
|
||||
)
|
||||
self.assertIn(
|
||||
"当前上传图片是本任务唯一主参考图;保持商品主体、款式、颜色和关键细节准确;不编造用户与参考图均未提供的信息。",
|
||||
per_image_primary,
|
||||
)
|
||||
self.assertNotIn("使用第一張上傳圖作為主商品圖", per_image_primary)
|
||||
self.assertNotIn("序号2", per_image_primary)
|
||||
|
||||
def test_product_suite_template_validation_and_custom_category_rendering(self):
|
||||
default_text = prompts.load_default_product_suite_prompt()
|
||||
|
||||
Reference in New Issue
Block a user