# 对外 API:文件上传(原始字节 body) # POST /rag/api/doc_upload.dspy?kb_id=X&file_name=Y Authorization: Bearer # 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)