知識ベース対話では、知識ベースロボットのAPIキーが自動的にバックエンドで選択された知識ベースにバインドされ、この種のキーを使用する場合はkb_idを指定しなくてもよい Request
Provide your bearer token in the Authorization
header when making requests to protected resources. Example:Authorization: Bearer ********************
Body Params application/json
{
"kb_id": 0,
"model_name": "gpt-4o-mini",
"query": "你好",
"stream": false,
"history": [
{"role": "user","content": "你好啊"},
{"role": "assistant","content": "你好"}
],
"top_k": 5,
"score_threshold": 1,
"temperature":0.5
}
Request Code Samples
curl --location --request POST 'https://api.302.ai/302/kb/chat/knowledge_base_chat' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"kb_id": 0,
"model_name": "gpt-4o-mini",
"query": "你好",
"stream": false,
"history": [
{"role": "user","content": "你好啊"},
{"role": "assistant","content": "你好"}
],
"top_k": 5,
"score_threshold": 1,
"temperature":0.5
}'
Responses
application/json {
"code": 0,
"msg": "success",
"data": {
"answer": "你好!有什么我可以帮助你的吗?"
}
}
Modified at 2026-01-13 09:23:59