rag/wwwroot/api/kb_create.dspy
ymq 51b0bf1b85 refactor(rag-api): API Key 改由平台 dapi 模块统一管理
- 删除自建 rag_api_keys 表 model + api_key_create/list/revoke 管理端点
  (key 申请/管理走 dapi 的 downapp/downapikey UI,避免两套 key 体系)
- verify_api_key 改调 dapi.get_apikey_user:有效性/过期/IP白名单全走平台机制,
  从认证用户 orgid 注入机构边界
- 7 个对外端点去掉 rag 侧 scopes 检查(授权粒度归 dapi 账号)
- 部署目标:产线平台测试环境(ragserver 弃用),rag 模块已在 pipeline-app pkgs
2026-09-03 16:04:54 +08:00

11 lines
394 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 对外 API创建知识库
# POST /rag/api/kb_create.dspy Authorization: Bearer <api-key>
# body(JSON 或 query): {name, description?, embedding_engine?}
from rag import api_core as C
_ctx, _e = await C.verify_api_key(request)
if _e:
return C._err(_e, code="unauthorized")
_ns = await C.read_json_body(request, params_kw)
env = C.make_api_env(_ctx)
return await C.kb_create(env, _ns)