bot/docs/vikingbot-phase1-validation-with-openviking-server.md
Author: OpenViking Team Status: Draft Date: 2026-04-29
本文用于验证 Vikingbot feedback observability Phase 1 当前已经落地的能力,验证方式基于 openviking-server --with-bot 启动模式。
本次 Phase 1 需要确认的核心点有四个:
response_idresponse_idresponse_idresponse_completed 没有暴露到用户侧 channel 或 OpenAPI 对外返回中本文适用于以下启动方式:
openviking-server --with-bot
在这种模式下:
1933vikingbot gateway/bot/v1因此本文所有 HTTP 验证请求都走:
http://127.0.0.1:1933/bot/v1而不是直接访问 vikingbot gateway 自身端口。
开始前请确认:
--with-botbot-langfuse 依赖并在 ov.conf 中开启 LangfuseLangfuse 配置示例:
{
"bot": {
"langfuse": {
"enabled": true,
"secret_key": "your-secret-key",
"public_key": "your-public-key",
"base_url": "http://localhost:3000"
}
}
}
如果你修改了配置,需要重启:
openviking-server --with-bot
在一个终端中启动:
openviking-server --with-bot
预期日志中至少应看到类似内容:
Bot API proxy enabled, forwarding to http://127.0.0.1:18790
Starting vikingbot gateway...
Vikingbot gateway started (PID: ...)
OpenViking HTTP Server is running on 127.0.0.1:1933
如果这里启动失败,后面的验证都不成立,先解决启动问题。
先确认 Bot API 代理已经可访问:
curl -sS http://127.0.0.1:1933/bot/v1/health
预期返回 HTTP 200。
如果这里失败,说明 --with-bot 没有生效,或者内部 bot gateway 没有成功启动。
response_id发送一条最小请求:
curl -sS -X POST "http://127.0.0.1:1933/bot/v1/chat" \
-H "Content-Type: application/json" \
-d '{
"session_id": "phase1-verify-session",
"user_id": "phase1-verify-user",
"message": "请简单回复一句:验证 response_id"
}'
预期返回中至少包含以下结构:
{
"session_id": "phase1-verify-session",
"response_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"message": "...",
"events": [
{
"type": "response",
"data": {
"content": "...",
"response_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"timestamp": "..."
}
]
}
重点检查:
response_idevents 中最终 type == "response" 的事件里,data.response_id 存在response_id 与 events[*].data.response_id 一致如果只看到 message,但没有 response_id,说明 Phase 1 的 API 贯通未生效。
response_id发送一条流式请求:
curl -N -X POST "http://127.0.0.1:1933/bot/v1/chat/stream" \
-H "Content-Type: application/json" \
-d '{
"session_id": "phase1-verify-stream",
"user_id": "phase1-verify-user",
"stream": true,
"message": "请简单回复一句:验证 stream response_id"
}'
预期 SSE 中最终 response 事件的数据类似:
{
"type": "response",
"data": {
"content": "...",
"response_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"timestamp": "..."
}
重点检查:
response 事件带有 data.response_idresponse_completed 事件response_idPhase 1 当前会把 response_id 持久化到 assistant message 中。
默认情况下,bot data 目录是:
~/.openviking/data/bot
session 目录是:
~/.openviking/data/bot/sessions
如果你在 ov.conf 中设置了 storage.workspace,则实际目录为:
{storage.workspace}/bot/sessions
先搜索刚才的 session:
rg "phase1-verify-session|response_id" ~/.openviking/data/bot/sessions
也可以直接列出 session 文件:
ls ~/.openviking/data/bot/sessions
找到对应文件后,检查 assistant message,预期类似:
{
"role": "assistant",
"content": "...",
"timestamp": "...",
"response_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"token_usage": {
"prompt_tokens": 123,
"completion_tokens": 45,
"total_tokens": 168
}
}
重点检查:
role == "assistant" 的消息里有 response_idresponse_id 与 HTTP 返回中的 response_id 一致如果 session 中没有 response_id,说明只有 API 层返回了该字段,但持久化链路未生效。
response_id这一步要求已经启用 Langfuse。
完成第 5.2 步后,打开 Langfuse UI,找到刚才对应的 trace / generation,检查 metadata。
预期至少包含:
response_idhas_toolsfinish_reason重点检查:
response_idresponse_id 与 HTTP 返回一致response_id再发一条更容易触发工具的问题,例如:
curl -sS -X POST "http://127.0.0.1:1933/bot/v1/chat" \
-H "Content-Type: application/json" \
-d '{
"session_id": "phase1-verify-tool",
"user_id": "phase1-verify-user",
"message": "请查看当前工作区有哪些文件,并简短总结"
}'
然后在 Langfuse 中查看对应 tool span metadata。
预期至少包含:
response_idduration_mssuccess重点检查:
response_idresponse_idresponse_completed 没有对外暴露response_completed 当前是内部分析事件,不应直接暴露给 OpenAPI 客户端,也不应出现在用户可见 channel 中。
验证方式:
responsereasoningtool_calltool_resultresponse_completed如果你同时在使用 CLI chat、Email 或 Mochat 等用户侧 channel,也应确认:
response_completed 或内部 JSON 数据说明:
response_completed 是通过内部 bus 发布的分析事件如果以下条件全部满足,可以认为当前 Phase 1 实现已验证通过:
/bot/v1/chat 返回顶层 response_idresponse 事件的 data.response_id 存在response_idresponse_idresponse_idresponse_completed/bot/v1/health 不通优先检查:
openviking-server --with-botBot API proxy enabled18790如果 18790 已经被单独运行的 vikingbot 或旧进程占用,openviking-server --with-bot 会直接拒绝启动,并输出类似错误:
Error: vikingbot gateway port 18790 is already in use.
A previous process is still bound - refusing to start a duplicate.
response_id优先检查:
/bot/v1/chat 的正常回答路径response_id优先检查:
storage.workspaceresponse_id优先检查:
bot-langfuse 依赖ov.conf 中 bot.langfuse.enabled 是否为 true如果只想用最短时间确认核心链路,建议至少完成以下三步:
/bot/v1/chat 并确认返回中有 response_idresponse_idresponse_completed这三步成功,说明 Phase 1 最核心的“response identity + response facts 基础链路”已经基本打通。