docs: 修正 API 文档响应结构描述 + 添加缺失测试

- 修正 PROCESS_MESSAGE 响应数据访问路径 (result['content'] -> result['data']['content'])
- 添加 CLEAR_HISTORY 文档说明 (基于 SAVE_HISTORY 空消息实现)
- 添加 test_clear_history 和 test_send_message_is_alias 测试用例
- 优化 BackendClient 历史相关方法的返回值处理
This commit is contained in:
root
2026-04-15 12:09:48 +08:00
parent a8dc24e7f3
commit 09a45c52e7
4 changed files with 58 additions and 7 deletions

View File

@ -103,7 +103,10 @@ client = BackendClient(server)
result = client.process_message("Hello, please remember my name is Xiao Ming")
if result.get("success"):
print(result["content"])
# Response data is in "data" field
print(result["data"]["content"])
# Tool calls: result["data"]["tool_calls"]
# Rejected tools: result["data"]["rejected_tools"]
```
---
@ -288,7 +291,7 @@ body = {
- Messages are automatically saved to database `chat_records` table
- System automatically keeps only 500 most recent records, older records are deleted
- Each call to `PROCESS_MESSAGE` will automatically save user message and AI response
```
- **Clear History**: Passing empty messages list `messages=[]` clears history, `client.clear_history()` method is implemented based on this
---