v2.8.5, 加入查看详情功能
This commit is contained in:
@@ -12,13 +12,13 @@ function buildSystemPrompt(username, isAdmin) {
|
|||||||
' - quantity (数字, 默认1)',
|
' - quantity (数字, 默认1)',
|
||||||
' - unit_price (必填, 数字, 单价) ← 必须明确或能从语句中推断出大于0的数值',
|
' - unit_price (必填, 数字, 单价) ← 必须明确或能从语句中推断出大于0的数值',
|
||||||
' - freight (数字, 默认0)',
|
' - freight (数字, 默认0)',
|
||||||
' - payment_method (字符串, 如"支付宝""微信",未提及则默认"支付宝")',
|
' - payment_method (字符串, 如"支付宝""微信",未提及则默认"未指定")',
|
||||||
' - invoice_type (字符串, 可选值"无票"/"电子票",默认"无票")',
|
' - invoice_type (字符串, 可选值"无票"/"电子票",默认"无票")',
|
||||||
' - status (字符串, 只能从"待付款"/"已付款"/"已收货"/"已完成"中选择,默认"待付款"。如果用户明确说已付款、已收货、已完成等,请映射到对应状态)',
|
' - status (字符串, 只能从"待付款"/"已付款"/"已收货"/"已完成"中选择,默认"待付款"。如果用户明确说已付款、已收货、已完成等,请映射到对应状态)',
|
||||||
' - applicant (字符串, 默认"' + username + '")',
|
' - applicant (字符串, 默认"' + username + '")',
|
||||||
' - remarks (字符串, 能从语句中提取的备注信息,如购买平台等)',
|
' - remarks (字符串, 能从语句中提取的备注信息,如购买平台等)',
|
||||||
' ⚠️ 关键规则:如果用户没有提供价格(unit_price 为 0 或无法提取),你必须返回 action="chat",reply 内容礼貌地询问价格,例如:“好的,请问这个 ‘插排’ 是多少钱呢?”',
|
' ⚠️ 关键规则:如果用户没有提供价格(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:查询历史采购记录。',
|
'2. query:查询历史采购记录。',
|
||||||
' 触发条件:用户询问“买过什么/有没有买过/查一下/找找看/搜索/列表/我买过/看看”等查询历史采购的意图。',
|
' 触发条件:用户询问“买过什么/有没有买过/查一下/找找看/搜索/列表/我买过/看看”等查询历史采购的意图。',
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ function handleAIResult(aiResult, roomId, username, originalText, attachments) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const id = uuidv4();
|
const id = uuidv4();
|
||||||
const paymentMethod = aiResult.payment_method || (aiResult.method === '淘宝' ? '支付宝' : (aiResult.method || '未指定'));
|
const paymentMethod = aiResult.payment_method || '未指定';
|
||||||
const invoiceType = aiResult.invoice_type || '无票';
|
const invoiceType = aiResult.invoice_type || '无票';
|
||||||
const status = aiResult.status || '待付款';
|
const status = aiResult.status || '待付款';
|
||||||
const applicant = aiResult.applicant || username;
|
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
|
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);
|
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 + ' <a href="#" onclick="openDetail(\'' + id + '\')">查看详情</a>';
|
||||||
purchase = { id };
|
purchase = { id };
|
||||||
|
|
||||||
if (attachments?.length) {
|
if (attachments?.length) {
|
||||||
|
|||||||
@@ -237,7 +237,7 @@
|
|||||||
<script>
|
<script>
|
||||||
// 版本号
|
// 版本号
|
||||||
(function() {
|
(function() {
|
||||||
document.getElementById('version-text').textContent = 'v2.8.3-260729';
|
document.getElementById('version-text').textContent = 'v2.8.5-260729';
|
||||||
})();
|
})();
|
||||||
document.addEventListener('input', function(e) {
|
document.addEventListener('input', function(e) {
|
||||||
if (e.target.id === 'msg-input' || e.target.id === 'purchase-msg-input') {
|
if (e.target.id === 'msg-input' || e.target.id === 'purchase-msg-input') {
|
||||||
|
|||||||
Reference in New Issue
Block a user