fix(acceptance): improve bot setup and execution log presentation

This commit is contained in:
Hyu
2026-10-09 17:03:15 +08:00
parent 113bb0b773
commit e22bea7f1e
29 changed files with 450 additions and 151 deletions
@@ -4,6 +4,7 @@ from __future__ import annotations
import datetime
import json
from langbot_plugin.api.entities.builtin.platform.events import event_summary
import sqlalchemy as sa
from sqlalchemy.ext.asyncio import AsyncSession
@@ -32,19 +33,8 @@ def event_content(content, event_data):
"""Keep event-specific properties alongside the normalized message input."""
if not isinstance(event_data, dict) or not event_data:
return content
if not isinstance(content, dict):
return event_data if not content else {**event_data, 'input': content}
merged = dict(event_data)
conflicts = {}
for key, value in content.items():
if key not in merged:
merged[key] = value
elif merged[key] != value and value is not None and value != '' and value != [] and value != {}:
conflicts[key] = value
if conflicts:
# Never silently overwrite a custom field that shares an input name.
return {'event': merged, 'input': conflicts}
return merged
# Keep the original event intact; text is the existing normalized input field.
return {'text': event_summary(event_data), 'event': event_data, 'input': content}
def event_item(row):
@@ -15,6 +15,7 @@ metadata:
spec:
categories:
- popular
- protocol
help_links:
zh: https://langbot.app/docs/zh/usage/platforms/qq/aiocqhttp/napcat
@@ -15,6 +15,7 @@ metadata:
spec:
categories:
- popular
- china
help_links:
zh: https://langbot.app/docs/zh/usage/platforms/dingtalk
+3 -16
View File
@@ -704,33 +704,20 @@ class RuntimeBot:
@classmethod
def _build_agent_input(cls, event: platform_events.EBAEvent) -> AgentInput:
text = None
text = platform_events.event_summary(event)
contents: list[dict[str, typing.Any]] = []
message_chain = getattr(event, 'message_chain', None)
if message_chain:
text_parts: list[str] = []
try:
for component in message_chain:
if isinstance(component, platform_message.Plain):
text_parts.append(component.text)
elif isinstance(component, platform_message.Image):
if isinstance(component, platform_message.Image):
if component.url:
contents.append({'type': 'image_url', 'image_url': {'url': component.url}})
elif component.base64:
contents.append({'type': 'image_base64', 'image_base64': component.base64})
except TypeError:
text_parts.append(str(message_chain))
text = ''.join(text_parts) or str(message_chain)
if text is None:
feedback_content = getattr(event, 'feedback_content', None)
if feedback_content:
text = str(feedback_content)
elif getattr(event, 'action', None):
text = str(getattr(event, 'action'))
else:
text = str(getattr(event, 'type', 'event'))
pass
if text:
contents.insert(0, {'type': 'text', 'text': text})
@@ -14,6 +14,7 @@ metadata:
spec:
legacy: true
categories:
- popular
- protocol
help_links:
zh: https://langbot.app/docs/zh/usage/platforms/qq/aiocqhttp/napcat
@@ -59,4 +60,4 @@ spec:
execution:
python:
path: ./aiocqhttp.py
attr: AiocqhttpAdapter
attr: AiocqhttpAdapter
@@ -14,6 +14,7 @@ metadata:
spec:
legacy: true
categories:
- popular
- china
help_links:
zh: https://langbot.app/docs/zh/usage/platforms/dingtalk
@@ -8,10 +8,14 @@ metadata:
zh_Hant: HTTP 通用接入
ja_JP: HTTP ボット
description:
en_US: Integrate any backend over plain HTTP. Push messages in via a signed webhook, receive replies on a callback URL. Server-to-server, no long-lived connection. Preserves message aggregation (N->1) and multi-part replies (1->M).
zh_Hans: 通过 HTTP 接入任意后端系统。以签名 Webhook 推入消息,在回调地址接收回复。面向服务间集成,无需长连接。完整保留消息聚合(多条合一)与多段回复(一条问、多条回)能力。
zh_Hant: 透過 HTTP 接入任意後端系統。以簽名 Webhook 推入訊息,在回調地址接收回覆。面向服務間整合,無需長連線。完整保留訊息聚合(多條合一)與多段回覆(一條問、多條回)能力。
ja_JP: 任意のバックエンドを HTTP で接続。署名付き Webhook でメッセージを送信し、コールバック URL で返信を受信します。サーバー間連携、長時間接続不要。メッセージ集約(N→1)とマルチパート返信(1→M)に対応。
en_US: Connect backend systems via HTTP. Send messages through signed webhooks and receive replies via callbacks.
zh_Hans: 通过 HTTP 接入后端系统,以签名 Webhook 发送消息,通过回调接收回复。
zh_Hant: 透過 HTTP 接入後端系統,以簽名 Webhook 傳送訊息,透過回呼接收回覆。
ja_JP: HTTP でバックエンドに接続。署名付き Webhook でメッセージを送信し、コールバックで返信を受信します。
es_ES: Conecta sistemas mediante HTTP. Envía mensajes con webhooks firmados y recibe respuestas mediante callbacks.
ru_RU: Подключайте серверные системы по HTTP. Отправляйте сообщения через подписанные вебхуки и получайте ответы через обратные вызовы.
th_TH: เชื่อมต่อระบบผ่าน HTTP ส่งข้อความด้วย Webhook ที่ลงลายเซ็นและรับคำตอบผ่าน callback
vi_VN: Kết nối hệ thống qua HTTP. Gửi tin nhắn bằng webhook có chữ ký và nhận phản hồi qua callback.
icon: http_bot.svg
spec:
categories:
+2 -1
View File
@@ -20,6 +20,7 @@ metadata:
icon: line.png
spec:
categories:
- popular
- global
help_links:
zh: https://langbot.app/docs/zh/usage/platforms/line
@@ -81,4 +82,4 @@ spec:
execution:
python:
path: ./line.py
attr: LINEAdapter
attr: LINEAdapter
@@ -22,7 +22,6 @@ metadata:
spec:
categories:
- global
- popular
config:
- name: server_url
label:
@@ -385,6 +385,7 @@ class OpenClawWeixinAdapter(abstract_platform_adapter.AbstractMessagePlatformAda
await self.logger.error(
f'Failed to send component {type(component).__name__}: {traceback.format_exc()}'
)
raise
async def reply_message(
self,