merge clothing stage and accessories stage of stylist guide

This commit is contained in:
pangkaicheng
2026-01-12 11:52:53 +08:00
parent 4fa815158f
commit 077ceea219
9 changed files with 63 additions and 63 deletions

View File

@@ -102,15 +102,12 @@ class AsyncStylistAgent:
def _load_style_guide(self, stylist_name: str):
"""加载 markdown 风格指南内容。"""
guide_path = os.path.join(settings.STYLIST_GUIDE_DIR, f"{stylist_name}_en.md")
acc_guide_path = os.path.join(settings.STYLIST_GUIDE_DIR, f"{stylist_name}_acc.md")
try:
with open(guide_path, 'r', encoding='utf-8') as file:
stylist_guide = file.read()
with open(acc_guide_path, 'r', encoding='utf-8') as file:
accessories_guide = file.read()
return stylist_guide, accessories_guide
return stylist_guide
except Exception as e:
raise Exception(f"Failed to load style guide from {guide_path}, {acc_guide_path}: {e}")
raise Exception(f"Failed to load style guide from {guide_path}: {e}")
async def _call_gemini(self, user_input: str, user_id: str, file_name: str, output_schema: Dict[str, Any], image_bytes: bytes = None, system_prompt: str = "") -> str:
"""
@@ -519,7 +516,7 @@ class AsyncStylistAgent:
self.outfit_items = []
else:
self.outfit_items = deepcopy(start_outfit)
stylist_guide, accessories_guide = self._load_style_guide(self.stylist_name)
stylist_guide = self._load_style_guide(self.stylist_name)
url = f'{callback_url}/api/style/callback'
if not occasions:
occasions = ["Casual"]
@@ -563,7 +560,7 @@ class AsyncStylistAgent:
general_rule,
request_summary,
occasions[0],
accessories_guide,
stylist_guide,
current_category,
allowed_subcategories,
MAX_LEN_ACC
@@ -606,7 +603,7 @@ class AsyncStylistAgent:
self.outfit_items = []
else:
self.outfit_items = deepcopy(start_outfit)
stylist_guide, accessories_guide = self._load_style_guide(self.stylist_name)
stylist_guide = self._load_style_guide(self.stylist_name)
url = f'{callback_url}/api/style/callback'
MAX_LEN = 9
@@ -622,7 +619,7 @@ class AsyncStylistAgent:
general_rules,
request_summary,
occasions[0],
stylist_guide + accessories_guide,
stylist_guide,
"",
allowed_subcategories,
MAX_LEN