From c0c72a9c87bf68a16b18445719356763a5d50714 Mon Sep 17 00:00:00 2001 From: pangkaicheng <924366729@qq.com> Date: Fri, 19 Dec 2025 11:37:39 +0800 Subject: [PATCH] ADD function, brand restriction --- .gitignore | 3 +- app/server/ChatbotAgent/agent_server.py | 11 +++-- .../ChatbotAgent/core/stylist_agent_server.py | 1 + .../ChatbotAgent/core/vector_database.py | 8 +++- app/taxonomy.py | 41 ++++++++++++++++++- stylist_guide/quincy_acc.md | 4 ++ stylist_guide/quincy_en.md | 7 ++++ 7 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 stylist_guide/quincy_acc.md create mode 100644 stylist_guide/quincy_en.md diff --git a/.gitignore b/.gitignore index e06af0c..74d9203 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ data/ *.toml .prod_env google_application_credentials.json -*.bash \ No newline at end of file +*.bash +app/google_application_credentials.json \ No newline at end of file diff --git a/app/server/ChatbotAgent/agent_server.py b/app/server/ChatbotAgent/agent_server.py index 2c994ea..31415fe 100644 --- a/app/server/ChatbotAgent/agent_server.py +++ b/app/server/ChatbotAgent/agent_server.py @@ -320,14 +320,19 @@ if __name__ == "__main__": # 2. 准备请求数据 import json stylist_agent_kwages = agent_api.stylist_agent_kwages.copy() - with open("/mnt/data/workspace/Code/lc_stylist_agent/data/2025_q4/request_test.json", "r") as f: + if settings.LOCAL == 1: + request_file_path = "./data/2025_q4/request_test.json" + else: + request_file_path = "/mnt/data/workspace/Code/lc_stylist_agent/data/2025_q4/request_test.json" + + with open(request_file_path, "r") as f: request_data = json.load(f) tasks_with_metadata = [] - for test_content in request_data[20:25]: + for test_content in request_data[0:10]: occasions = test_content['occasions'] request_summary = test_content['request_summary'] - for stylist_name in ["edi", "vera"]: + for stylist_name in ["quincy"]: stylist_agent_kwages['outfit_id'] = test_content['test_case_id'] + "_" + "_".join(occasions) + f"_{stylist_name}" stylist_agent_kwages['stylist_name'] = stylist_name stylist_agent_kwages['gender'] = "female" diff --git a/app/server/ChatbotAgent/core/stylist_agent_server.py b/app/server/ChatbotAgent/core/stylist_agent_server.py index 99ff641..13f0b1b 100644 --- a/app/server/ChatbotAgent/core/stylist_agent_server.py +++ b/app/server/ChatbotAgent/core/stylist_agent_server.py @@ -200,6 +200,7 @@ class AsyncStylistAgent: "category": best_meta['category'], 'description': best_meta['description'], "subcategory": best_meta['subcategory'], + "brand": best_meta['brand'], "gpt_description": item_description, "gpt_subcategory": subcategory, # 假设 'item_path' 存储在 metadata 中,或从 'item_id' 推导 diff --git a/app/server/ChatbotAgent/core/vector_database.py b/app/server/ChatbotAgent/core/vector_database.py index c86ef4e..c051d99 100644 --- a/app/server/ChatbotAgent/core/vector_database.py +++ b/app/server/ChatbotAgent/core/vector_database.py @@ -5,7 +5,7 @@ from PIL import Image from typing import List, Dict, Any from transformers import CLIPProcessor, CLIPModel -from app.taxonomy import OCCASION, CATEGORY_LIST, IGNORE_SUBCATEGORY +from app.taxonomy import OCCASION, CATEGORY_LIST, IGNORE_SUBCATEGORY, BRAND_WHITELIST class VectorDatabase(): @@ -59,6 +59,12 @@ class VectorDatabase(): ]}, {"subcategory": {"$nin": IGNORE_SUBCATEGORY}} ] + + # 加了一条限制,但是部署到生产的时候把他设定为False + brand_strication = True + if brand_strication: + and_conditions.append({"brand": {"$in": BRAND_WHITELIST}}) + if batch_sources and len(batch_sources) > 0: if len(batch_sources) == 1: and_conditions.append({"batch_source": batch_sources[0]}) diff --git a/app/taxonomy.py b/app/taxonomy.py index 4236eca..35b6f15 100644 --- a/app/taxonomy.py +++ b/app/taxonomy.py @@ -91,4 +91,43 @@ FASHION_TAXONOMY = { CATEGORY_LIST = list(FASHION_TAXONOMY.keys()) ALL_SUBCATEGORY_LIST = sum(FASHION_TAXONOMY.values(), []) -IGNORE_SUBCATEGORY = ['socks'] \ No newline at end of file +IGNORE_SUBCATEGORY = ['socks'] + +BRAND_WHITELIST = [ + "ALAÏA", + "BALENCIAGA", + "BALMAIN", + "BARBOUR", + "BOTTEGA VENETA", + "BRUNELLO CUCINELLI", + "ALEXANDERWANG", + "CHLOÉ", + "DIOR", + "FEAR OF GOD", + "FENDI", + "GIA STUDIOS", + "GUCCI", + "HELMUT LANG", + "JACQUEMUS", + "JIMMY CHOO", + "JW ANDERSON", + "KHAITE", + "LEMAIRE", + "LOEWE", + "MAISON MARGIELA", + "MIU MIU", + "MM6 MAISON MARGIELA", + "MONCLER", + "PEDDER RED", + "PETER DO", + "PHOEBE PHILO", + "PRADA", + "RICK OWENS", + "SACAI", + "SKIMS", + "THE ROW", + "THEORY", + "THOM BROWNE", + "THE FRANKIE SHOP", + "TOTEME", +] \ No newline at end of file diff --git a/stylist_guide/quincy_acc.md b/stylist_guide/quincy_acc.md new file mode 100644 index 0000000..c268ddb --- /dev/null +++ b/stylist_guide/quincy_acc.md @@ -0,0 +1,4 @@ +# Accessory Guide +## Prohibitions +1. Watches: No watches are permitted in any outfit. +2. Hats: The use of hats is strictly prohibited. \ No newline at end of file diff --git a/stylist_guide/quincy_en.md b/stylist_guide/quincy_en.md new file mode 100644 index 0000000..5917d8a --- /dev/null +++ b/stylist_guide/quincy_en.md @@ -0,0 +1,7 @@ +# Outfit Style Guide +1. Limit outfit in three main colours with same colour tone +2. Could be two neutrals and one accent colour +3. Do not show any mid-calf length pants +4. Cropped pants pair with loafers, or ankle boots +5. Loose on top pair with fitted bottom +6. Fitted top pair with loose bottom \ No newline at end of file