outfit单品数量通过java传参控制

This commit is contained in:
zhh
2025-11-03 10:09:48 +08:00
parent 4c4d704f09
commit eb7efc6d91

View File

@@ -21,6 +21,7 @@ class AgentRequestModel(BaseModel):
stylist_path: str stylist_path: str
callback_url: str callback_url: str
gender: str gender: str
max_len: int
class LCAgent(ls.LitAPI): class LCAgent(ls.LitAPI):
@@ -39,7 +40,7 @@ class LCAgent(ls.LitAPI):
) )
self.stylist_agent_kwages = { self.stylist_agent_kwages = {
'local_db': self.vector_db, 'local_db': self.vector_db,
'max_len': 5, 'max_len': 9,
'gemini_model_name': settings.LLM_MODEL_NAME 'gemini_model_name': settings.LLM_MODEL_NAME
} }
self.outfit_ids = [] self.outfit_ids = []
@@ -80,7 +81,8 @@ class LCAgent(ls.LitAPI):
num_outfits=request.num_outfits, num_outfits=request.num_outfits,
user_id=request.user_id, user_id=request.user_id,
gender=request.gender, gender=request.gender,
callback_url=request.callback_url) callback_url=request.callback_url,
max_len=request.max_len)
logger.info("--- Final Recommendation Results ---") logger.info("--- Final Recommendation Results ---")
for i, path in enumerate(recommendation_results.get("successful_outfits", [])): for i, path in enumerate(recommendation_results.get("successful_outfits", [])):
logger.info(f"✅ Outfit {i + 1} saved to: {path}") logger.info(f"✅ Outfit {i + 1} saved to: {path}")
@@ -101,7 +103,7 @@ class LCAgent(ls.LitAPI):
return summary return summary
async def recommend_outfit(self, request_summary: str, stylist_name: str, start_outfit=None, num_outfits: int = 1, async def recommend_outfit(self, request_summary: str, stylist_name: str, start_outfit=None, num_outfits: int = 1,
user_id: str = "test", gender: str = "male", callback_url: str = None): user_id: str = "test", gender: str = "male", callback_url: str = None, max_len: str = 9):
""" """
基于用户的对话历史和需求,推荐一套搭配。 基于用户的对话历史和需求,推荐一套搭配。
@@ -115,6 +117,7 @@ class LCAgent(ls.LitAPI):
task_map = {} task_map = {}
for i in range(num_outfits): for i in range(num_outfits):
self.stylist_agent_kwages['outfit_id'] = self.outfit_ids[i] self.stylist_agent_kwages['outfit_id'] = self.outfit_ids[i]
self.stylist_agent_kwages['max_len'] = max_len
agent = AsyncStylistAgent(**self.stylist_agent_kwages) agent = AsyncStylistAgent(**self.stylist_agent_kwages)
task = agent.run_styling_process( task = agent.run_styling_process(
request_summary=request_summary, request_summary=request_summary,