- 删除自建 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
13 lines
537 B
Plaintext
13 lines
537 B
Plaintext
# 对外 API:文件上传(原始字节 body)
|
||
# POST /rag/api/doc_upload.dspy?kb_id=X&file_name=Y Authorization: Bearer <api-key>
|
||
# Content-Type: application/octet-stream,请求体即文件原始字节
|
||
from rag import api_core as C
|
||
_ctx, _e = await C.verify_api_key(request)
|
||
if _e:
|
||
return C._err(_e, code="unauthorized")
|
||
_ns = dict(params_kw or {})
|
||
_file_data = await request.read()
|
||
_file_name = _ns.get('file_name', '') or 'upload.bin'
|
||
env = C.make_api_env(_ctx)
|
||
return await C.doc_upload(env, _ns, _file_data, _file_name)
|