feat: 添加图片搜索功能和 Qwen 模型支持
图片搜索功能(以图搜图): - Chatwoot webhook 检测图片搜索消息 (content_type="search_image") - 从 content_attributes.url 提取图片 URL - 调用 Mall API 图片搜索接口 (/mall/api/spu?searchImageUrl=...) - 支持嵌套和顶层 URL 位置提取 - Product Agent 添加 fast path 直接调用图片搜索工具 - 防止无限循环(使用后清除 context.image_search_url) Qwen 模型支持: - 添加 LLM provider 选择(zhipu/qwen) - 实现 QwenLLMClient 类(基于 DashScope SDK) - 添加 dashscope>=1.14.0 依赖 - 修复 API key 设置(直接设置 dashscope.api_key) - 更新 .env.example 和 docker-compose.yml 配置 其他优化: - 重构 Chatwoot 集成代码(删除冗余) - 优化 Product Agent prompt - 增强 Customer Service Agent 多语言支持 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -316,6 +316,44 @@ class MallClient:
|
||||
except Exception as e:
|
||||
raise Exception(f"搜索商品失败 (Search SPU products failed): {str(e)}")
|
||||
|
||||
async def get_love_list(
|
||||
self,
|
||||
page: int = 1,
|
||||
page_size: int = 6,
|
||||
warehouse_id: int = 2
|
||||
) -> dict[str, Any]:
|
||||
"""Get recommended products (Love List) from Mall API
|
||||
|
||||
获取推荐商品列表
|
||||
|
||||
Args:
|
||||
page: Page number (default: 1)
|
||||
page_size: Number of products per page (default: 6)
|
||||
warehouse_id: Warehouse ID (default: 2)
|
||||
|
||||
Returns:
|
||||
Dictionary containing product list and metadata
|
||||
|
||||
Example:
|
||||
>>> client = MallClient()
|
||||
>>> result = await client.get_love_list(page=1, page_size=6, warehouse_id=2)
|
||||
>>> print(f"找到 {len(result.get('list', []))} 个推荐商品")
|
||||
"""
|
||||
try:
|
||||
params = {
|
||||
"page": page,
|
||||
"pageSize": page_size,
|
||||
"warehouseId": warehouse_id
|
||||
}
|
||||
|
||||
result = await self.get(
|
||||
"/mall/api/loveList",
|
||||
params=params
|
||||
)
|
||||
return result
|
||||
except Exception as e:
|
||||
raise Exception(f"获取推荐商品失败 (Get love list failed): {str(e)}")
|
||||
|
||||
|
||||
# Global Mall client instance
|
||||
mall_client: Optional[MallClient] = None
|
||||
|
||||
Reference in New Issue
Block a user