- Add AI学习助手 agent creation script with all 39 tools, 3-layer KG+RAG memory - Add renshenguo (人参果) feishu bot integration (app_service + ws_handler) - Register renshenguo WS client in main.py startup - Add RENSHENGUO_APP_ID / RENSHENGUO_APP_SECRET / RENSHENGUO_AGENT_ID config - Reorganize docs from root into docs/ subdirectories - Move startup scripts to scripts/startup/ - Various backend optimizations and tool improvements Co-Authored-By: Claude Opus 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()
|