This commit is contained in:
Typer_Body
2026-05-26 02:28:01 +08:00
parent b5c43cc113
commit 5d4e40459f
59 changed files with 795 additions and 329 deletions

View File

@@ -7,10 +7,15 @@ Node metadata (label, description, inputs, outputs, config) is loaded from:
from __future__ import annotations
import logging
from typing import Any
from langbot_plugin.api.entities.builtin.workflow import ExecutionContext
from langbot_plugin.api.entities.builtin.workflow.entities import ExecutionContext
from ..node import WorkflowNode, workflow_node
from .. import monitoring_helper
logger = logging.getLogger(__name__)
@workflow_node('message_trigger')
class MessageTriggerNode(WorkflowNode):
@@ -21,6 +26,20 @@ class MessageTriggerNode(WorkflowNode):
async def execute(self, inputs: dict[str, Any], context: ExecutionContext) -> dict[str, Any]:
msg_ctx = context.message_context
# Record trigger log
try:
if self.ap and context.query:
workflow_id = context.workflow_id or ''
workflow_name = context.variables.get('_workflow_name', 'Workflow')
await monitoring_helper.WorkflowMonitoringHelper.record_trigger_log(
ap=self.ap,
query=context.query,
workflow_id=workflow_id,
workflow_name=workflow_name,
)
except Exception as e:
logger.warning(f'[MessageTrigger:{self.node_id}] Failed to record trigger log: {e}')
if msg_ctx:
return {
'message': msg_ctx.message_content,