- wwwroot/api/ 六个对外端点(Bearer Key 鉴权,路由授 any、业务鉴权在 api_core):
kb_create/kb_delete/doc_upload/doc_delete/tag_create/doc_set_tags/search
- rag/api_core.py: verify_api_key + make_api_env(org注入) + 六个业务核心
(复用 init.py 底层检索/入库能力,杜绝双实现分叉)
- 统一返回格式 {"status":"ok"|"error","data":...}
- rag/ingest.py: 入库管线从 upload_file.dspy 抽出共享(UI/API同一引擎)
- rag/tools.py: RAG_TOOL_SCHEMAS + exec_rag_tool(与API同构,供内部助手调用)
- rag_api_keys 表 model(key 只存 SHA256);管理端 api_key_create/list/revoke
- load_path.py 注册 7 个 API 端点(any) + 3 个管理端点(logined)
99 lines
2.2 KiB
JSON
99 lines
2.2 KiB
JSON
{
|
|
"summary": [
|
|
{
|
|
"name": "rag_api_keys",
|
|
"title": "对外API密钥",
|
|
"primary": [
|
|
"id"
|
|
]
|
|
}
|
|
],
|
|
"fields": [
|
|
{
|
|
"name": "id",
|
|
"title": "ID",
|
|
"type": "str",
|
|
"length": 32,
|
|
"nullable": "no"
|
|
},
|
|
{
|
|
"name": "org_id",
|
|
"title": "所属机构",
|
|
"type": "str",
|
|
"length": 32,
|
|
"nullable": "no"
|
|
},
|
|
{
|
|
"name": "name",
|
|
"title": "密钥名称",
|
|
"type": "str",
|
|
"length": 100,
|
|
"nullable": "yes"
|
|
},
|
|
{
|
|
"name": "key_hash",
|
|
"title": "密钥哈希(SHA256)",
|
|
"type": "str",
|
|
"length": 64,
|
|
"nullable": "no"
|
|
},
|
|
{
|
|
"name": "prefix",
|
|
"title": "密钥前缀(展示)",
|
|
"type": "str",
|
|
"length": 16,
|
|
"nullable": "yes"
|
|
},
|
|
{
|
|
"name": "scopes",
|
|
"title": "权限范围",
|
|
"type": "str",
|
|
"length": 500,
|
|
"nullable": "yes",
|
|
"default": ""
|
|
},
|
|
{
|
|
"name": "status",
|
|
"title": "状态",
|
|
"type": "str",
|
|
"length": 16,
|
|
"nullable": "yes",
|
|
"default": "active"
|
|
},
|
|
{
|
|
"name": "expires_at",
|
|
"title": "过期时间",
|
|
"type": "datetime",
|
|
"nullable": "yes"
|
|
},
|
|
{
|
|
"name": "last_used_at",
|
|
"title": "最近使用",
|
|
"type": "datetime",
|
|
"nullable": "yes"
|
|
},
|
|
{
|
|
"name": "created_at",
|
|
"title": "创建时间",
|
|
"type": "datetime",
|
|
"nullable": "yes"
|
|
}
|
|
],
|
|
"indexes": [
|
|
{
|
|
"name": "idx_ak_hash",
|
|
"idxtype": "unique",
|
|
"idxfields": [
|
|
"key_hash"
|
|
]
|
|
},
|
|
{
|
|
"name": "idx_ak_org",
|
|
"idxtype": "index",
|
|
"idxfields": [
|
|
"org_id"
|
|
]
|
|
}
|
|
]
|
|
}
|