1. 对话聊天
Nexent接口
  • 北向接口
    • 健康检查
      • Health Check
    • 会话管理
      • 获取会话列表
      • 获取会话历史
      • 自动生成会话标题
      • 更新会话标题
    • Agent管理
      • 获取已发布Agent信息
      • 获取已发布Agent列表
    • 对话聊天
      • A2A
        • 获取A2A Agent卡片
        • 聊天接口:http+json 非流式
        • 聊天接口:http+json 流式
        • 聊天接口:jsonrpc 非流式
      • 上传聊天附件
        POST
      • 开始流式聊天
        POST
      • 停止聊天
        GET
    • 知识库
      • 获取知识库列表
      • 创建知识库
      • 删除知识库
      • 知识库上传文件
      • 查询知识库文件
      • 删除知识库文件
      • 获取文件信息
      • 获取文档分片
      • 获取当前智能体当前用户的可用aidp知识库
    • Api keys
      • 批量创建 API 用户
      • 刷新 API Key
      • 吊销 API Key
    • 模型管理
      • 查询租户模型列表
  1. 对话聊天

开始流式聊天

POST
/nb/v1/chat/run
最后修改时间:2026-09-23 01:32:19
以 SSE(text/event-stream)发起流式聊天。agent_name 与 query 必填;conversation_id 缺省时创建新会话,并在流首前置 conversation_created 事件
其余字段可选:attachments 接受附件引用(预签名 URL 或站内路径)、model_id 指定模型、metadata / meta_data 携带运行时元数据与审计元数据、tool_params 配置工具参数
支持 Idempotency-Key 请求头(默认按租户/会话/Agent/query 自动组合);按租户限流(默认 120 次/分钟)
错误:400 参数错误、403 无权限、429 限流、502 运行时不可用、504 运行时超时

请求参数

Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
Header 参数

Body 参数application/json必填

示例
{
    "conversation_id": 35,
    "agent_name": "common_sense_qa_assistant",
    "query": "介绍一下什么是openviking",
    "model_id": 42,
    "attachments": [
        {
            "object_name": "attachments/44dc6fa5-bfce-42b0-b3a4-7dadd3309edb/20260615081018_2a0ffd4652644d178e915d67d790aea6.md",
            "name": "how-openviking-skill-works.md",
            "type": "file",
            "size": 6946,
            "url": "/nexent/attachments/44dc6fa5-bfce-42b0-b3a4-7dadd3309edb/20260615081018_2a0ffd4652644d178e915d67d790aea6.md",
            "description": "",
            "presigned_url": "http://localhost:5013/api/nb/v1/file/fetch?presigned_url=http%3A%2F%2Fnexent-minio%3A9000%2Fnexent%2Fattachments%2F44dc6fa5-bfce-42b0-b3a4-7dadd3309edb%2F20260615081018_2a0ffd4652644d178e915d67d790aea6.md%3FX-Amz-Algorithm%3DAWS4-HMAC-SHA256%26X-Amz-Credential%3D9ff15e1c7f980659e0f87421%252F20260615%252Fcn-north-1%252Fs3%252Faws4_request%26X-Amz-Date%3D20260615T081018Z%26X-Amz-Expires%3D86400%26X-Amz-SignedHeaders%3Dhost%26X-Amz-Signature%3Dff332d11f4aed9940a273f89ab27d4d3f3bf5de5544a82b9c9182d1a712bfd5c"
        }
    ],
    "tool_params": {
        "agents": {
            "common_sense_qa_assistant": {
                "tools": {
                    "knowledge_base_search": {
                        "top_k": 10,
                        "index_names": [
                            "29-af208f3cb86c4820a5052a9f89aecc79"
                        ],
                        "document_paths": [
                            "knowledge_base/20260530014828_82f3adee990a4269bc03ec2009f552f8.json"
                        ]
                    }
                }
            }
        }
    },
    "metadata": {}
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location 'http://localhost:5013/api/nb/v1/chat/run' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
    "conversation_id": 35,
    "agent_name": "common_sense_qa_assistant",
    "query": "介绍一下什么是openviking",
    "model_id": 42,
    "attachments": [
        {
            "object_name": "attachments/44dc6fa5-bfce-42b0-b3a4-7dadd3309edb/20260615081018_2a0ffd4652644d178e915d67d790aea6.md",
            "name": "how-openviking-skill-works.md",
            "type": "file",
            "size": 6946,
            "url": "/nexent/attachments/44dc6fa5-bfce-42b0-b3a4-7dadd3309edb/20260615081018_2a0ffd4652644d178e915d67d790aea6.md",
            "description": "",
            "presigned_url": "http://localhost:5013/api/nb/v1/file/fetch?presigned_url=http%3A%2F%2Fnexent-minio%3A9000%2Fnexent%2Fattachments%2F44dc6fa5-bfce-42b0-b3a4-7dadd3309edb%2F20260615081018_2a0ffd4652644d178e915d67d790aea6.md%3FX-Amz-Algorithm%3DAWS4-HMAC-SHA256%26X-Amz-Credential%3D9ff15e1c7f980659e0f87421%252F20260615%252Fcn-north-1%252Fs3%252Faws4_request%26X-Amz-Date%3D20260615T081018Z%26X-Amz-Expires%3D86400%26X-Amz-SignedHeaders%3Dhost%26X-Amz-Signature%3Dff332d11f4aed9940a273f89ab27d4d3f3bf5de5544a82b9c9182d1a712bfd5c"
        }
    ],
    "tool_params": {
        "agents": {
            "common_sense_qa_assistant": {
                "tools": {
                    "knowledge_base_search": {
                        "top_k": 10,
                        "index_names": [
                            "29-af208f3cb86c4820a5052a9f89aecc79"
                        ],
                        "document_paths": [
                            "knowledge_base/20260530014828_82f3adee990a4269bc03ec2009f552f8.json"
                        ]
                    }
                }
            }
        }
    },
    "metadata": {}
}'

返回响应

🟢200成功
text/plain
示例
{"type": "tool", "content": "", "tool_name": "search_memory", "tool_arguments": {"query": "User uploaded files. The file information is as follows:\nFile name: northbound_checklist.md\n- S3 URL: s3://
20:00:09
{"type": "execution_logs", "content": "No relevant memories found.", "unit_index": 1}
20:00:09
{"type": "other", "content": "{\"code\": \"uncertainty_reserve_active\", \"message\": \"W2 applied the unified 10% uncertainty reserve because selected model capability behavior is not fully verified.
20:00:09
{"type": "card", "content": "[{\"icon\": \"download\", \"text\": \"Downloading s3://nexent/attachments/f91b9ff6-a723-4c5a-8c50-350fdff33b4d/20260910114940_8f96c4f41cdf426c997743eb4dbd9fe1.md\"}]", "un
20:00:10
{"type": "agent_new_run", "content": "[Current time: 2026-09-10 12:00:10]\n\nUser uploaded files. The file information is as follows:\nFile name: northbound_checklist.md\n- S3 URL: s3://nexent/attachm
20:00:11
{"type": "step_count", "content": "\n**\u6b65\u9aa4 1** \n", "unit_index": 5}
20:00:11
{"type": "model_output_deep_thinking", "content": "\u7528\u6237", "unit_index": 6}
{"type": "model_output_thinking", "content": "\u4f18\u5316", "unit_index": 13}
20:00:33
{"type": "model_output_thinking", "content": "\u3001\u6587\u6863\u751f\u6210\u7b49\n3. **\u5176\u4ed6\u5e2e\u52a9**\uff1f\n\n\u8bf7\u544a\u8bc9\u6211\u4f60\u7684\u5177\u4f53\u9700\u6c42\uff01", "unit_
20:00:33
{"type": "token_count", "content": "{\"step_number\": 2, \"duration\": 11.55, \"step_input_tokens\": 10089, \"step_output_tokens\": 569, \"total_output_tokens\": 897, \"estimated_context_tokens\": 990
20:00:33
{"type": "final_answer", "content": "\u6211\u67e5\u770b\u4e86\u4f60\u4e0a\u4f20\u7684\u6587\u4ef6 `northbound_checklist.md`\uff0c\u8fd9\u662f\u4e00\u4e2a**\u5317\u5411\u63a5\u53e3\u4eba\u5de5\u68c0\u6
修改于 2026-09-23 01:32:19
上一页
上传聊天附件
下一页
停止聊天
Built with