fix(knowdge-base): 修复google浏览器不兼容问题

This commit is contained in:
sophie committed 2026-07-02 15:23:10 +08:00
1 parent 60dd0c0f58
commit 09cd6fc3c7
2 files changed
+44 -13

No files matched your search

@@ -11,6 +11,7 @@ from app.services.shipping_notice.state_machine import (
ALL_ACTION_IDS,
ALL_CHECKPOINT_IDS,
CHECKPOINT_REGISTRY,
CP_INVENTORY_SOURCE_REVIEW,
TaskTransition,
TaskUiState,
action_buttons_for_checkpoint,
@@ -21,6 +22,7 @@ from app.services.shipping_notice.state_machine import (
human_options_for_checkpoint,
human_options_for_task,
human_options_for_task_or_checkpoint,
inventory_source_action_buttons,
resolve_task_ui_state,
ui_state_for_checkpoint,
upload_req_options_for_task,
@@ -30,6 +32,34 @@ from app.services.shipping_notice.state_machine import (
# Legacy alias
CHECKPOINT_OPTIONS = CHECKPOINT_REGISTRY
def build_chat_actions_payload(task):
"""
Build the legacy chat-actions API payload for one shipping task.
AI trigger: use this when the workspace chat panel needs the current checkpoint
and clickable action buttons for an existing ShippingTask. The payload keeps the
historical `task_id` field as `task.task_no` so older frontend code can consume it.
"""
ui_state = resolve_task_ui_state(task)
action_buttons = (
inventory_source_action_buttons(task)
if ui_state.checkpoint == CP_INVENTORY_SOURCE_REVIEW
else ui_state.action_buttons
)
return {
"task_id": task.task_no,
"task_no": task.task_no,
"checkpoint": ui_state.checkpoint,
"human_options": ui_state.human_options or [],
"action_buttons": action_buttons,
"process_status": task.process_status,
"review_status": task.review_status,
"pending_human_reason": task.pending_human_reason,
"match_status": task.match_status,
"updated_at": task.updated_at.isoformat() if task.updated_at else None,
}
__all__ = [
"ACTION_SPECS",
"ALL_ACTION_IDS",
@@ -41,6 +71,7 @@ __all__ = [
"action_buttons_for_checkpoint",
"apply_task_transition",
"build_action_buttons",
"build_chat_actions_payload",
"build_checkpoint_catalog",
"checkpoint_for_task",
"human_options_for_checkpoint",