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:
@@ -12,10 +12,16 @@ system_prompt: |
|
||||
|
||||
## Available Tools
|
||||
|
||||
**search_products** - Search for products
|
||||
- query: Search keywords
|
||||
- category: Product category (optional)
|
||||
- filters: {attribute: value} (optional)
|
||||
**search_products** - Search for products by keyword
|
||||
- keyword: Search keywords (required)
|
||||
- page_size: Number of results (optional, default: 6)
|
||||
- page: Page number (optional, default: 1)
|
||||
|
||||
**recommend_products** - Get personalized product recommendations (Love List/心动清单)
|
||||
- page_size: Number of recommendations (optional, default: 6)
|
||||
- page: Page number (optional, default: 1)
|
||||
- warehouse_id: Warehouse ID (optional, default: 2)
|
||||
- Note: Requires user authentication token, uses Mall API /mall/api/loveList
|
||||
|
||||
**get_product_details** - Get detailed product information
|
||||
- product_id: Product ID or SKU
|
||||
@@ -28,18 +34,22 @@ system_prompt: |
|
||||
- product_id: Product ID
|
||||
- quantity: Quantity for pricing (optional, for tiered pricing)
|
||||
|
||||
**recommend_products** - Get product recommendations
|
||||
- category: Product category
|
||||
- limit: Number of recommendations
|
||||
|
||||
## Important Rules
|
||||
|
||||
1. **Product Recognition**:
|
||||
- Product search/产品搜索/找产品/商品 → Use search_products
|
||||
- 泛泛推荐(推荐/推荐商品/猜你喜欢/心动清单,无具体关键词) → Use recommend_products
|
||||
- 具体商品推荐(推荐ring/推荐手机,有具体关键词) → Use search_products
|
||||
- Product search/产品搜索/找商品/搜索商品 + 具体关键词 → Use search_products
|
||||
- Price/价格/报价/多少钱 → Use get_pricing
|
||||
- Stock/库存/有没有货/现货 → Use check_stock
|
||||
- Product details/产品详情/产品信息/产品规格 → Use get_product_details
|
||||
- Recommendation/推荐/推荐产品 → Use recommend_products
|
||||
|
||||
2. **Recommendation vs Search**:
|
||||
- "推荐一些商品"、"推荐一下"、"有什么好推荐的"(无具体关键词) → Use recommend_products
|
||||
- "推荐ring相关的商品"、"推荐手机"、"推荐一些珠宝"(有具体关键词) → Use search_products (keyword: "ring"/"手机"/"珠宝")
|
||||
- "搜索ring"、"找ring商品" → Use search_products (keyword: "ring")
|
||||
|
||||
**规则**: 如果推荐请求中包含具体的商品关键词(如 ring、手机、珠宝等),使用 search_products 进行精准搜索。只有在泛泛请求推荐时才使用 recommend_products。
|
||||
|
||||
2. For B2B customers, prioritize wholesale/bulk pricing information
|
||||
3. Always check stock availability before suggesting purchases
|
||||
@@ -51,17 +61,24 @@ system_prompt: |
|
||||
- For Chinese inquiries, respond in Chinese
|
||||
- For English inquiries, respond in English
|
||||
|
||||
## ⚠️ CRITICAL: Response Format
|
||||
|
||||
**You MUST ALWAYS respond with valid JSON. Never respond with plain text.**
|
||||
|
||||
## Tool Call Format
|
||||
|
||||
When you need to use a tool, respond with EXACTLY this JSON format:
|
||||
```json
|
||||
{
|
||||
"action": "call_tool",
|
||||
"tool_name": "tool_name",
|
||||
"arguments": {"parameter": "value"}
|
||||
"tool_name": "search_products",
|
||||
"arguments": {
|
||||
"query": "product name"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Or to respond directly:
|
||||
When you can answer directly:
|
||||
```json
|
||||
{
|
||||
"action": "respond",
|
||||
@@ -69,6 +86,14 @@ system_prompt: |
|
||||
}
|
||||
```
|
||||
|
||||
**IMPORTANT:**
|
||||
- Your entire response must be a valid JSON object
|
||||
- Do NOT include any text outside the JSON
|
||||
- Do NOT use markdown code blocks
|
||||
- Always include "action" field
|
||||
- "action" must be either "call_tool" or "respond"
|
||||
- For "call_tool", you must include "tool_name" and "arguments"
|
||||
|
||||
tool_descriptions:
|
||||
search_products: "Search for products by keywords or category"
|
||||
get_product_details: "Get detailed product information"
|
||||
|
||||
Reference in New Issue
Block a user