- 新增通知系统 (notifications 表、服务、API) - 新增飞书定时任务结果推送 (webhook + 应用消息) - 新增飞书应用消息发送服务 (feishu_app_service) - 新增飞书 WebSocket 长连接事件监听 (苹果应用) - 新增飞书账号绑定/解绑 API - 新增橙子飞书机器人 (独立 WS 连接,固定路由到橙子助手 Agent) - 执行记录添加 schedule_id,用户添加飞书绑定字段 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
70 lines
2.5 KiB
Python
70 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
||
"""
|
||
代码编程助手 — 工作流执行冒烟测试
|
||
|
||
与 test_agent_execution.py 相同调用链:POST /api/v1/executions,
|
||
input_data 仅含 query、USER_INPUT(与《工作流调用测试总结》一致)。
|
||
|
||
用法示例:
|
||
python test_coding_agent_execution.py
|
||
python test_coding_agent_execution.py -m "你好"
|
||
python test_coding_agent_execution.py <agent_id>
|
||
python test_coding_agent_execution.py <agent_id> "写一个 hello world"
|
||
python test_coding_agent_execution.py --base-url http://127.0.0.1:8037 --max-wait 420
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
import argparse
|
||
|
||
from test_agent_execution import DEFAULT_BASE_URL, test_agent_execution
|
||
|
||
CODING_AGENT_NAME = "代码编程助手"
|
||
DEFAULT_MESSAGE = "你好"
|
||
|
||
|
||
def _parse_args() -> argparse.Namespace:
|
||
p = argparse.ArgumentParser(
|
||
description=f'测试「{CODING_AGENT_NAME}」工作流执行(默认用户话术「{DEFAULT_MESSAGE}」)'
|
||
)
|
||
p.add_argument("agent_id", nargs="?", default=None, help="Agent UUID(可选;不传则按名称查找)")
|
||
p.add_argument("user_input", nargs="?", default=None, help="用户消息(可选;等价于省略时使用默认值)")
|
||
p.add_argument(
|
||
"-m",
|
||
"--message",
|
||
default=None,
|
||
metavar="TEXT",
|
||
help=f'用户话术(优先于第二个位置参数;默认「{DEFAULT_MESSAGE}」)',
|
||
)
|
||
p.add_argument("--base-url", default=DEFAULT_BASE_URL, help="API 根地址")
|
||
p.add_argument("--username", default="admin")
|
||
p.add_argument("--password", default="123456")
|
||
p.add_argument("--request-timeout", type=int, default=120, help="单次 HTTP 超时秒数")
|
||
p.add_argument("--max-wait", type=int, default=420, help="轮询最长等待秒数(编程助手可能多轮 LLM)")
|
||
p.add_argument("--poll-interval", type=float, default=2.0)
|
||
return p.parse_args()
|
||
|
||
|
||
def main() -> None:
|
||
args = _parse_args()
|
||
msg = DEFAULT_MESSAGE
|
||
if args.message is not None:
|
||
msg = args.message
|
||
elif args.user_input is not None:
|
||
msg = args.user_input
|
||
|
||
test_agent_execution(
|
||
agent_id=args.agent_id,
|
||
user_input=msg,
|
||
base_url=args.base_url,
|
||
username=args.username,
|
||
password=args.password,
|
||
agent_name=None if args.agent_id else CODING_AGENT_NAME,
|
||
request_timeout=args.request_timeout,
|
||
max_wait_time=args.max_wait,
|
||
poll_interval=args.poll_interval,
|
||
)
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|