新增 取消agent配饰(保留鞋子)推荐,改为默认随机配饰搭配

This commit is contained in:
zhh
2025-11-20 11:07:16 +08:00
parent 3b685c34f0
commit 5f50f3ec1a
4 changed files with 14 additions and 9 deletions

View File

@@ -20,9 +20,9 @@ logger = logging.getLogger(__name__)
class AsyncStylistAgent: class AsyncStylistAgent:
CATEGORY_SET = { CATEGORY_SET = {
'Activewear', 'Dresses', 'Outerwear', 'Pants', 'Shirts & Tops', 'Skirts', 'Suits', 'Swimwear', 'Underwear' 'Activewear', 'Dresses', 'Outerwear', 'Pants', 'Shirts & Tops', 'Skirts', 'Suits', 'Swimwear', 'Underwear', 'Shoes',
# 取消推荐配饰 # 取消推荐配饰
# , 'Watches', 'Shopping Totes', 'Sunglasses', 'Handbags', 'Backpacks', 'Belts', 'Hats', 'Jewelry', 'Briefcases', 'Socks', 'Neckties', 'Shoes', 'Scarves & Shawls' # , 'Watches', 'Shopping Totes', 'Sunglasses', 'Handbags', 'Backpacks', 'Belts', 'Hats', 'Jewelry', 'Briefcases', 'Socks', 'Neckties', 'Scarves & Shawls'
} }
CATEGORY_SET_ALL = { CATEGORY_SET_ALL = {
'Activewear', 'Dresses', 'Outerwear', 'Pants', 'Shirts & Tops', 'Skirts', 'Suits', 'Swimwear', 'Underwear', 'Activewear', 'Dresses', 'Outerwear', 'Pants', 'Shirts & Tops', 'Skirts', 'Suits', 'Swimwear', 'Underwear',
@@ -108,8 +108,8 @@ class AsyncStylistAgent:
## Your Workflow and Constraints ## Your Workflow and Constraints
1. **Style Adherence**: You must strictly observe all rules in the Style Guide concerning **color palette, fit, layering principles, pattern restrictions coordination**. 1. **Style Adherence**: You must strictly observe all rules in the Style Guide concerning **color palette, fit, layering principles, pattern restrictions , shoe coordination**.
2. **Step Planning**: The styling sequence must follow a **top-down, inside-out** approach: major garments (tops/outerwear/bottoms/dresses). 2. **Step Planning**: The styling sequence must follow a **top-down, inside-out** approach: First major garments (tops/outerwear/bottoms/dresses) then shoes.
3. **Structured Output**: Every response must recommend the **next single item**. You must strictly use the **JSON format** for your output, as follows: 3. **Structured Output**: Every response must recommend the **next single item**. You must strictly use the **JSON format** for your output, as follows:
```json ```json
@@ -129,7 +129,10 @@ class AsyncStylistAgent:
* **Role in the Outfit** (e.g., serves as the innermost base layer for layering; acts as the crucial tie accent for the smart casual look) * **Role in the Outfit** (e.g., serves as the innermost base layer for layering; acts as the crucial tie accent for the smart casual look)
4. **Termination Condition**: Only when you deem the entire outfit complete and **all mandatory elements stipulated in the Style Guide are met**, you must output the following JSON format to terminate the process: 4. **Termination Condition**: Only when you deem the entire outfit complete and **all mandatory elements stipulated in the Style Guide are met**, you must output the following JSON format to terminate the process:
start 10:59:36,396
fitst image 10:59:51,551
fitst 完成11:00:34,672
all 完成11:02:57,355
```json ```json
{{ {{
"action": "stop", "action": "stop",
@@ -260,7 +263,7 @@ class AsyncStylistAgent:
print(f"An error occurred during item retrieval: {e}") print(f"An error occurred during item retrieval: {e}")
return None return None
def _get_random_accessories(self): async def _get_random_accessories(self):
results = self.local_db.random_get_accessories() results = self.local_db.random_get_accessories()
# 3. 模拟 Agent 审核(实际应用中,你需要将图片发回给 Agent进行审核) # 3. 模拟 Agent 审核(实际应用中,你需要将图片发回给 Agent进行审核)
@@ -343,7 +346,7 @@ class AsyncStylistAgent:
logger.info(f"request data {response_data} | JAVA callback info -> status:{response.status_code} | message:{response.text}") logger.info(f"request data {response_data} | JAVA callback info -> status:{response.status_code} | message:{response.text}")
# 新增配饰 # 新增配饰
new_item = self._get_random_accessories() new_item = await self._get_random_accessories()
self.outfit_items.append(new_item) self.outfit_items.append(new_item)
user_input = self._build_user_input() user_input = self._build_user_input()
gemini_response_text, response_data['path'] = await self._call_gemini(user_input, user_id) gemini_response_text, response_data['path'] = await self._call_gemini(user_input, user_id)
@@ -425,7 +428,7 @@ class AsyncStylistAgent:
logger.info(f"request data {response_data} | JAVA callback info -> status:{response.status_code} | message:{response.text}") logger.info(f"request data {response_data} | JAVA callback info -> status:{response.status_code} | message:{response.text}")
# 新增配饰 # 新增配饰
new_item = self._get_random_accessories() new_item = await self._get_random_accessories()
self.outfit_items.append(new_item) self.outfit_items.append(new_item)
user_input = self._build_user_input() user_input = self._build_user_input()
gemini_response_text, response_data['path'] = await self._call_gemini(user_input, user_id) gemini_response_text, response_data['path'] = await self._call_gemini(user_input, user_id)

View File

@@ -53,4 +53,4 @@ JSON FIELD REQUIREMENTS:
- **style (string):** The overall aesthetic description (e.g., "Classic elegance", "Modern minimalist", "Bohemian vibe", "Edgy and contemporary"). - **style (string):** The overall aesthetic description (e.g., "Classic elegance", "Modern minimalist", "Bohemian vibe", "Edgy and contemporary").
- **color_preference (string or list):** User's preferred or excluded colors/tones (e.g., "Light colors only", "Avoid deep shades", "['Cream', 'Pale Blue']", "No preference"). - **color_preference (string or list):** User's preferred or excluded colors/tones (e.g., "Light colors only", "Avoid deep shades", "['Cream', 'Pale Blue']", "No preference").
- **clothing_type (string):** User's preference for specific garment types, material, or silhouette (e.g., "Lightweight maxi dress", "Skirt with silk blouse", "Tailored wide-leg pants", "Floral print"). - **clothing_type (string):** User's preference for specific garment types, material, or silhouette (e.g., "Lightweight maxi dress", "Skirt with silk blouse", "Tailored wide-leg pants", "Floral print").
- **vibe_or_details (string):** Any other details, mood requirements, or specific constraints (e.g., "Needs to be comfortable and breathable", "Accent on accessories", "Must cover shoulders").""" - **vibe_or_details (string):** Any other details, mood requirements, or specific constraints (e.g., "Needs to be comfortable and breathable", "Must cover shoulders")."""

View File

@@ -68,6 +68,7 @@ class VectorDatabase():
FILTER_CRITERIA = { FILTER_CRITERIA = {
"$and": [ "$and": [
{"item_group_id": {"$ne": "Clothing"}}, {"item_group_id": {"$ne": "Clothing"}},
{"item_group_id": {"$ne": "Shoes"}}, # 新增:过滤 Shoes
{"modality": "image"}, {"modality": "image"},
] ]
} }

View File

@@ -10,6 +10,7 @@ COLLECTION_NAME = 'lc_clothing_embedding'
FILTER_CRITERIA = { FILTER_CRITERIA = {
"$and": [ "$and": [
{"item_group_id": {"$ne": "Clothing"}}, {"item_group_id": {"$ne": "Clothing"}},
{"item_group_id": {"$ne": "Shoes"}}, # 新增:过滤 Shoes
{"modality": "image"}, {"modality": "image"},
] ]
} }