36 lines
1.5 KiB
Markdown
36 lines
1.5 KiB
Markdown
# 智能体 agent
|
||
|
||
Python 3.12 + FastAPI。HTTP 默认 `8910`。
|
||
|
||
## 本迭代:企微文字 echo 回复
|
||
|
||
链路:回调/注入 → inbox 入队(快回)→ echo handler → outbox → 企微 `message/send`。
|
||
|
||
### 并存期怎么测(重要)
|
||
|
||
公网 `https://ai.ytd-scm.com/wecom/callback` **切流前仍进现网**。不要改 Nginx、不要双连 AIBOT。
|
||
|
||
本机联调(推荐):
|
||
|
||
1. 配置仓库根 `.env`(从 `.env.example` 复制,填 `WECOM_*`,对齐 `prompt/03`,**勿提交**)。
|
||
2. 启动:
|
||
```text
|
||
cd agent
|
||
.\.venv\Scripts\activate
|
||
pip install -r requirements.txt
|
||
python -m agent.http_app
|
||
```
|
||
3. 用你的企微 **userid** 注入一条模拟入站(会真发应用到你的企微):
|
||
```text
|
||
curl -X POST http://127.0.0.1:8910/internal/dev/inject-text -H "Content-Type: application/json" -d "{\"sender_id\":\"你的企微userid\",\"content\":\"你好\"}"
|
||
```
|
||
4. 手机/桌面企微应收到带 `[test]` 前缀的回复。
|
||
|
||
若返回企微 `60020 not allow to access from your ip`:当前出口 IP 未进企微应用可信 IP。请在**服务器白名单出口**上跑智能体,或把本机出口 IP 配进企微后台(与现网出口策略一致)。
|
||
|
||
真要从企微聊天窗口「发消息→新系统回」= **切流**(改 Nginx 反代到 8910 + 停现网对应进程),现网会短暂停收询价,需单独批准。
|
||
|
||
### 健康检查
|
||
|
||
`GET http://127.0.0.1:8910/health` 中 `wecom_send_ready` / `wecom_crypto_ready` 应为 true。
|