feat(chat): 优化发货相关消息处理逻辑
- 在列出聊天消息时,过滤掉类型为'shipping-parse-review'的消息 - 移除不再使用的shippingConversationTaskIdCache - 更新发货决策处理逻辑,简化保存消息的参数 - 添加发货动作按钮刷新时的任务定位优先级逻辑 - 移除解析复核消息的展示逻辑,统一处理到轻量工作台 - 增加单元测试,验证发货动作按钮刷新时的任务定位优先级
This commit is contained in:
1 parent
9f5493185d
commit
6a0a51313f
18 files changed
+1230
-199
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import pytest
|
||||
|
||||
from app import db
|
||||
from app.models import ShippingInventoryMapping, ShippingTask, ShippingTaskEvent
|
||||
from app.models import ChatLog, ShippingInventoryMapping, ShippingTask, ShippingTaskEvent
|
||||
from app.services.shipping_notice.match import match_notice_lines
|
||||
|
||||
|
||||
@@ -1177,6 +1177,49 @@ def test_parse_notice_blocks_when_reservation_id_missing(app, client, monkeypatc
|
||||
assert task.match_status is None
|
||||
|
||||
|
||||
@pytest.mark.auto_rpa
|
||||
def test_parse_notice_low_confidence_does_not_write_parse_review_chat_card(app, client):
|
||||
headers = _tool_headers(app)
|
||||
|
||||
with app.app_context():
|
||||
from app.models import User
|
||||
|
||||
user = User(username="parse_review_card_user", email="parse_review_card_user@example.com")
|
||||
db.session.add(user)
|
||||
db.session.commit()
|
||||
user_id = user.id
|
||||
|
||||
create_res = client.post(
|
||||
"/api/shipping-notice/tools/create_task",
|
||||
headers=headers,
|
||||
json={"source_type": "manual", "conversation_id": "conv-no-parse-card", "user_id": user_id},
|
||||
)
|
||||
task_id = create_res.get_json()["task_id"]
|
||||
|
||||
parse_res = client.post(
|
||||
"/api/shipping-notice/tools/parse_notice",
|
||||
headers=headers,
|
||||
json={
|
||||
"task_id": task_id,
|
||||
"conversation_id": "conv-no-parse-card",
|
||||
"structured": {
|
||||
"customer_name": "ACME",
|
||||
"lines": [{"sku": "A001", "reservation_id": "1000140351", "qty": 10, "uom": "EA"}],
|
||||
"confidence": 0.4,
|
||||
},
|
||||
},
|
||||
)
|
||||
parse_data = parse_res.get_json()
|
||||
assert parse_data["status"] == "needs_human"
|
||||
assert parse_data.get("checkpoint") == "parse_review"
|
||||
|
||||
with app.app_context():
|
||||
assert db.session.query(ChatLog).filter_by(
|
||||
session_id="conv-no-parse-card",
|
||||
message_type="shipping-parse-review",
|
||||
).count() == 0
|
||||
|
||||
|
||||
@pytest.mark.auto_rpa
|
||||
def test_parse_notice_auto_continue_hides_parse_confirmation_hint(app, client, monkeypatch):
|
||||
import app.services.shipping_notice.task_workflow as task_workflow
|
||||
|
||||
Reference in new issue
Block a user