feat: 强化多视角图片一致性 + 修复下载逻辑 + 技术文档

- 新增品类专属背面/侧面描述(BACK_VIEW_HINTS/SIDE_VIEW_HINTS)
- 强化一致性前缀策略,按视角定制相机位置描述
- 更新视角映射提示词为纯摄影术语
- 修复前端下载逻辑:改用fetch直接下载当前视角图片
- HTTPS改HTTP修复外网URL访问
- 新增多视角一致性与3D视频生成技术文档
This commit is contained in:
2026-03-28 19:51:08 +08:00
parent 1d94ec114a
commit 2ef126e445
8 changed files with 942 additions and 286 deletions

View File

@@ -29,6 +29,41 @@ CATEGORY_VIEWS: Dict[str, List[str]] = {
"随形": ["效果图", "正面图", "侧面图", "背面图"],
}
# ============================================================
# 品类专属背面描述(不同品类的背面特征差异很大)
# ============================================================
BACK_VIEW_HINTS: Dict[str, str] = {
"牌子": (
"IMPORTANT: The reverse/back side of a jade pendant plaque is traditionally a smooth, flat, polished surface. "
"It may have a brief inscription or seal mark, but it must NOT have any carved figure, face, or decorative relief pattern. "
"The back is plain and minimalist. Do NOT mirror or duplicate the front carving on the back."
),
"手把件": (
"The back of this hand-held jade piece continues the same sculptural form as the front. "
"It is part of the same three-dimensional object, showing the natural continuation of the carving from the rear angle."
),
"雕刻件": (
"The back of this carved jade piece shows the rear of the same three-dimensional sculpture. "
"The carving continues around the object naturally, not a separate or different design."
),
"摆件": (
"The back of this jade display piece shows the rear of the same three-dimensional artwork. "
"The form and carving continue naturally around the object."
),
"随形": (
"The back of this free-form jade piece shows the natural stone surface from the rear. "
"The organic shape continues naturally, the back may show more of the raw jade texture."
),
}
# 品类专属侧面描述
SIDE_VIEW_HINTS: Dict[str, str] = {
"牌子": (
"The side/edge view of a jade pendant plaque shows its thin, flat profile. "
"The plaque is typically 5-10mm thick, showing the edge thickness and any subtle edge carving."
),
}
def _load_mappings(mapping_type: str) -> Dict[str, str]:
"""从数据库加载指定类型的映射字典"""
@@ -159,7 +194,13 @@ def build_prompt(
view_desc = view_map.get(view_name, "three-quarter view")
parts.append(view_desc)
# 12. 质量后缀
# 12. 品类专属视角描述(背面/侧面特征)
if view_name == "背面图" and category_name in BACK_VIEW_HINTS:
parts.append(BACK_VIEW_HINTS[category_name])
elif view_name == "侧面图" and category_name in SIDE_VIEW_HINTS:
parts.append(SIDE_VIEW_HINTS[category_name])
# 13. 质量后缀
parts.append(quality_suffix)
return ", ".join(parts)