feat: 合同付款预警迁移到agent页面

This commit is contained in:
sophie committed 2026-09-16 09:36:18 +08:00
1 parent ef6bc42c20
commit 4ce2defef0
49 files changed
+1052 -423

No files matched your search

@@ -12,5 +12,6 @@ from __future__ import annotations
RUNTIME_HANDLER_BINDINGS: dict[str, str] = {
'shipping_notice': 'shipping_notice',
'file_check': 'file_check',
'contract_payment': 'contract_payment',
'in_transit_transfer': 'in_transit_transfer',
}
@@ -129,6 +129,22 @@ agent_types:
file_upload: true
human_confirm: false
handler_config_schema: {}
contract_payment:
label: 合同付款预警
conversation_mode_default: task_chat
runtime_provider_default: builtin
models:
- ContractPaymentContract
- ContractPaymentAlert
- ContractPaymentAlertBatch
required_fields: []
default_capabilities:
streaming: false
file_upload: false
task_progress: false
forced_capabilities:
file_upload: false
handler_config_schema: {}
in_transit_transfer:
label: 在途仓自动调拨
conversation_mode_default: task_chat
@@ -2,7 +2,7 @@
backend/app/services/agent_registry/handlers/bootstrap.py
用途:应用启动时加载 HANDLER_REGISTRY。
依赖:handlers.shipping_notice 等领域 handler 模块。
依赖:handlers.shipping_notice、handlers.contract_payment 等领域 handler 模块。
逻辑:create_app 在 load_context_adapters 之后调用 load_handlers()。
"""
@@ -29,12 +29,14 @@ def load_handlers() -> None:
import importlib
import app.services.agent_registry.handlers.contract_payment as contract_payment_mod
import app.services.agent_registry.handlers.file_check as file_check_mod
import app.services.agent_registry.handlers.in_transit_transfer as in_transit_transfer_mod
import app.services.agent_registry.handlers.shipping_notice as shipping_mod
importlib.reload(file_check_mod)
importlib.reload(shipping_mod)
importlib.reload(contract_payment_mod)
importlib.reload(in_transit_transfer_mod)
logger.info('Agent handlers loaded: %s', sorted(HANDLER_REGISTRY.keys()))
@@ -0,0 +1,31 @@
"""
backend/app/services/agent_registry/handlers/contract_payment.py
用途:合同付款预警 builtin Handler。第一期不走对话 completions,只满足 Catalog 对 builtin 必须声明 runtime_handler 的校验。
依赖:agent_registry.handlers.base / registry。
逻辑:Chat 主区渲染台账 Tab,不调用 Dify;prepare_stream 原样返回上下文,供后续 hybrid 接入预留。
"""
from __future__ import annotations
from typing import Any
from app.services.agent_registry.handlers.base import AgentHandler, ChatStreamContext
from app.services.agent_registry.handlers.registry import register_handler
@register_handler('contract_payment')
class ContractPaymentHandler(AgentHandler):
"""
合同付款预警业务 Handler。
核心逻辑:第一期隐藏输入框,不进入聊天流;保留钩子以便第二期改 hybrid 后注入合同摘要。
"""
def prepare_stream(self, ctx: ChatStreamContext) -> ChatStreamContext:
"""聊天流开始前原样返回上下文;第一期前端不会发起 completions。"""
return ctx
def build_ui_state_event(self, ctx: ChatStreamContext) -> dict[str, Any] | None:
"""第一期无领域 UI State;台账由独立 HTTP API 加载。"""
return None