fix: 修复手动测试发现的3项问题

1. food-encyclopedia: 修复 v-for key id:index TypeError
   - :key 改为 :key="index",避免 WeChat 小程序 key 表达式异常
   - filteredFoodList 加本地搜索过滤 + null item 过滤
   - normalizeFoodItem 新增英文→中文分类名映射(grain→谷薯类等)
   - loadFoodList/handleSearch 过滤 null 条目

2. ToolKnowledgeServiceImpl: 修复 TooManyResultsException
   - getNutrientDetail 查询新增 LIMIT 1 + ORDER BY knowledge_id DESC
   - 防止 DB 中同名营养素存在多条导致 selectOne 异常

3. ai-nutritionist: 统一走 Coze API,移除 KieAI Gemini 路径
   - sendToAI 文本/多模态均改为 api.cozeChat + pollChatStatus
   - 支持 type='text'/'multimodal'/图片 三种消息类型构建

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Developer
2026-03-25 14:54:31 +08:00
parent ba08abd374
commit 355895dba2
3 changed files with 71 additions and 53 deletions

View File

@@ -96,7 +96,9 @@ public class ToolKnowledgeServiceImpl implements ToolKnowledgeService {
lqw.eq(V2Knowledge::getType, "nutrients");
lqw.eq(V2Knowledge::getNutrientName, name);
lqw.eq(V2Knowledge::getStatus, "published");
lqw.orderByDesc(V2Knowledge::getKnowledgeId);
lqw.last("LIMIT 1");
V2Knowledge knowledge = v2KnowledgeDao.selectOne(lqw);
if (knowledge == null) {
return new HashMap<>();