ADD function, brand restriction

This commit is contained in:
pangkaicheng
2025-12-19 11:37:39 +08:00
parent 39f8b942cb
commit c0c72a9c87
7 changed files with 69 additions and 6 deletions

View File

@@ -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"

View File

@@ -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' 推导

View File

@@ -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]})