From b41779c051d9b24a4c3b8dc6fc93d6561078e1df Mon Sep 17 00:00:00 2001 From: kicer Date: Wed, 29 Jul 2026 12:57:27 +0800 Subject: [PATCH] =?UTF-8?q?v2.8.5,=20=E5=8A=A0=E5=85=A5=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/ai/prompt.js | 4 ++-- server/handlers.js | 4 ++-- server/public/index.html | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/ai/prompt.js b/server/ai/prompt.js index 0c8d708..333bf12 100644 --- a/server/ai/prompt.js +++ b/server/ai/prompt.js @@ -12,13 +12,13 @@ function buildSystemPrompt(username, isAdmin) { ' - quantity (数字, 默认1)', ' - unit_price (必填, 数字, 单价) ← 必须明确或能从语句中推断出大于0的数值', ' - freight (数字, 默认0)', - ' - payment_method (字符串, 如"支付宝""微信",未提及则默认"支付宝")', + ' - payment_method (字符串, 如"支付宝""微信",未提及则默认"未指定")', ' - invoice_type (字符串, 可选值"无票"/"电子票",默认"无票")', ' - status (字符串, 只能从"待付款"/"已付款"/"已收货"/"已完成"中选择,默认"待付款"。如果用户明确说已付款、已收货、已完成等,请映射到对应状态)', ' - applicant (字符串, 默认"' + username + '")', ' - remarks (字符串, 能从语句中提取的备注信息,如购买平台等)', ' ⚠️ 关键规则:如果用户没有提供价格(unit_price 为 0 或无法提取),你必须返回 action="chat",reply 内容礼貌地询问价格,例如:“好的,请问这个 ‘插排’ 是多少钱呢?”', - ' 示例输出(价格齐全):{"action":"purchase","purchase_item":"扩展坞","quantity":1,"unit_price":89,"freight":0,"payment_method":"支付宝","invoice_type":"无票","status":"已付款","applicant":"' + username + '","remarks":"淘宝"}', + ' 示例输出(价格齐全):{"action":"purchase","purchase_item":"扩展坞","quantity":1,"unit_price":89,"freight":0,"payment_method":"未指定","invoice_type":"无票","status":"已付款","applicant":"' + username + '","remarks":"淘宝"}', '', '2. query:查询历史采购记录。', ' 触发条件:用户询问“买过什么/有没有买过/查一下/找找看/搜索/列表/我买过/看看”等查询历史采购的意图。', diff --git a/server/handlers.js b/server/handlers.js index 27238db..d332f18 100644 --- a/server/handlers.js +++ b/server/handlers.js @@ -138,7 +138,7 @@ function handleAIResult(aiResult, roomId, username, originalText, attachments) { } const id = uuidv4(); - const paymentMethod = aiResult.payment_method || (aiResult.method === '淘宝' ? '支付宝' : (aiResult.method || '未指定')); + const paymentMethod = aiResult.payment_method || '未指定'; const invoiceType = aiResult.invoice_type || '无票'; const status = aiResult.status || '待付款'; const applicant = aiResult.applicant || username; @@ -147,7 +147,7 @@ function handleAIResult(aiResult, roomId, username, originalText, attachments) { id, roomId, item, quantity, unitPrice, amount, freight, paymentMethod, invoiceType, status, applicant, remarks, createdTime ); db.prepare('INSERT INTO purchase_history (purchase_id, action, user, timestamp) VALUES (?,?,?,?)').run(id, '创建采购:' + item + ',数量' + quantity + ',金额¥' + amount + ',状态' + status, '小财', now); - replyText = '✅ 已记录采购:' + item + ',数量 ' + quantity + ',金额 ¥' + amount + ',状态 ' + status; + replyText = '✅ 已记录采购:' + item + ',数量 ' + quantity + ',金额 ¥' + amount + ',状态 ' + status + ' 查看详情'; purchase = { id }; if (attachments?.length) { diff --git a/server/public/index.html b/server/public/index.html index db09e8e..fa3b10b 100644 --- a/server/public/index.html +++ b/server/public/index.html @@ -237,7 +237,7 @@