Sprint 1-3 Completed (Backend + Frontend): Backend (Sprint 1-2): - Implement 5-layer Agent framework (Query->Planner->Executor->Tools->Reflection) - Create agent_schema with 6 tables (agent_definitions, stages, prompts, sessions, traces, reflexion_rules) - Create protocol_schema with 2 tables (protocol_contexts, protocol_generations) - Implement Protocol Agent core services (Orchestrator, ContextService, PromptBuilder) - Integrate LLM service adapter (DeepSeek/Qwen/GPT-5/Claude) - 6 API endpoints with full authentication - 10/10 API tests passed Frontend (Sprint 3): - Add Protocol Agent entry in AgentHub (indigo theme card) - Implement ProtocolAgentPage with 3-column layout - Collapsible sidebar (Gemini style, 48px <-> 280px) - StatePanel with 5 stage cards (scientific_question, pico, study_design, sample_size, endpoints) - ChatArea with sync button and action cards integration - 100% prototype design restoration (608 lines CSS) - Detailed endpoints structure: baseline, exposure, outcomes, confounders Features: - 5-stage dialogue flow for research protocol design - Conversation-driven interaction with sync-to-protocol button - Real-time context state management - One-click protocol generation button (UI ready, backend pending) Database: - agent_schema: 6 tables for reusable Agent framework - protocol_schema: 2 tables for Protocol Agent - Seed data: 1 agent + 5 stages + 9 prompts + 4 reflexion rules Code Stats: - Backend: 13 files, 4338 lines - Frontend: 14 files, 2071 lines - Total: 27 files, 6409 lines Status: MVP core functionality completed, pending frontend-backend integration testing Next: Sprint 4 - One-click protocol generation + Word export
187 lines
4.8 KiB
HTTP
187 lines
4.8 KiB
HTTP
###
|
||
# PKB模块迁移 - API测试脚本
|
||
# 测试v1和v2路由的功能完整性和一致<EFBFBD>?
|
||
###
|
||
|
||
@baseUrl = http://localhost:3000
|
||
@userId = user-mock-001
|
||
|
||
### ============================================
|
||
### 阶段3.1: 健康检<EFBFBD>?
|
||
### ============================================
|
||
|
||
### 1. PKB v2健康检<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/pkb/health
|
||
Accept: application/json
|
||
|
||
### ============================================
|
||
### 阶段3.2: 知识库CRUD测试
|
||
### ============================================
|
||
|
||
### 2. 获取知识库列表(v1<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/knowledge-bases
|
||
Accept: application/json
|
||
|
||
### 3. 获取知识库列表(v2<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/pkb/knowledge/knowledge-bases
|
||
Accept: application/json
|
||
|
||
### 4. 创建知识库(v2<EFBFBD>?
|
||
POST {{baseUrl}}/api/v1/pkb/knowledge/knowledge-bases
|
||
Content-Type: application/json
|
||
|
||
{
|
||
"name": "测试知识库v2-{{$timestamp}}",
|
||
"description": "这是一个通过v2 API创建的测试知识库"
|
||
}
|
||
|
||
### 5. 创建知识库(v1 - 对比<EFBFBD>?
|
||
POST {{baseUrl}}/api/v1/knowledge-bases
|
||
Content-Type: application/json
|
||
|
||
{
|
||
"name": "测试知识库v1-{{$timestamp}}",
|
||
"description": "这是一个通过v1 API创建的测试知识库"
|
||
}
|
||
|
||
### 6. 获取知识库详情(v2<EFBFBD>?
|
||
# 替换为实际的知识库ID
|
||
@kbId = f6ebe476-c50f-4222-83d2-c2525edc6054
|
||
GET {{baseUrl}}/api/v1/pkb/knowledge/knowledge-bases/{{kbId}}
|
||
Accept: application/json
|
||
|
||
### 7. 获取知识库详情(v1 - 对比<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/knowledge-bases/{{kbId}}
|
||
Accept: application/json
|
||
|
||
### 8. 更新知识库(v2<EFBFBD>?
|
||
PUT {{baseUrl}}/api/v1/pkb/knowledge/knowledge-bases/{{kbId}}
|
||
Content-Type: application/json
|
||
|
||
{
|
||
"name": "更新后的知识库名称v2",
|
||
"description": "通过v2 API更新的描<EFBFBD>?
|
||
}
|
||
|
||
### 9. 获取知识库统计(v2<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/pkb/knowledge/knowledge-bases/{{kbId}}/stats
|
||
Accept: application/json
|
||
|
||
### 10. 获取知识库统计(v1 - 对比<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/knowledge-bases/{{kbId}}/stats
|
||
Accept: application/json
|
||
|
||
### ============================================
|
||
### 阶段3.3: RAG检索测<EFBFBD>?
|
||
### ============================================
|
||
|
||
### 11. RAG检索(v2<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/pkb/knowledge/knowledge-bases/{{kbId}}/search?query=阿尔兹海默症的治疗方<EFBFBD>?top_k=5
|
||
Accept: application/json
|
||
|
||
### 12. RAG检索(v1 - 对比<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/knowledge-bases/{{kbId}}/search?query=阿尔兹海默症的治疗方<EFBFBD>?top_k=5
|
||
Accept: application/json
|
||
|
||
### ============================================
|
||
### 阶段3.4: 文档选择(全文阅读模式)
|
||
### ============================================
|
||
|
||
### 13. 获取文档选择(v2<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/pkb/knowledge/knowledge-bases/{{kbId}}/document-selection?max_files=7&max_tokens=750000
|
||
Accept: application/json
|
||
|
||
### 14. 获取文档选择(v1 - 对比<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/knowledge-bases/{{kbId}}/document-selection?max_files=7&max_tokens=750000
|
||
Accept: application/json
|
||
|
||
### ============================================
|
||
### 阶段3.5: 文档管理测试
|
||
### ============================================
|
||
|
||
### 15. 获取文档列表(通过知识库详情)
|
||
GET {{baseUrl}}/api/v1/pkb/knowledge/knowledge-bases/{{kbId}}
|
||
Accept: application/json
|
||
|
||
### 16. 获取单个文档详情(v2<EFBFBD>?
|
||
# 替换为实际的文档ID
|
||
@docId = your-document-id
|
||
GET {{baseUrl}}/api/v1/pkb/knowledge/documents/{{docId}}
|
||
Accept: application/json
|
||
|
||
### ============================================
|
||
### 阶段3.6: 批处理功能测<EFBFBD>?
|
||
### ============================================
|
||
|
||
### 17. 获取批处理模板(v2<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/pkb/batch-tasks/batch/templates
|
||
Accept: application/json
|
||
|
||
### 18. 创建批处理任务(v2<EFBFBD>?
|
||
POST {{baseUrl}}/api/v1/pkb/batch-tasks/batch/execute
|
||
Content-Type: application/json
|
||
|
||
{
|
||
"kb_id": "{{kbId}}",
|
||
"document_ids": [],
|
||
"template_type": "preset",
|
||
"template_id": "clinical_research_method",
|
||
"model_type": "deepseek-v3",
|
||
"task_name": "测试批处理任务v2"
|
||
}
|
||
|
||
### ============================================
|
||
### 阶段3.7: 边界条件测试
|
||
### ============================================
|
||
|
||
### 19. 测试不存在的知识库(v2<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/pkb/knowledge/knowledge-bases/00000000-0000-0000-0000-000000000000
|
||
Accept: application/json
|
||
|
||
### 20. 测试无效的查询参数(v2<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/pkb/knowledge/knowledge-bases/{{kbId}}/search?query=&top_k=0
|
||
Accept: application/json
|
||
|
||
### 21. 测试超大top_k参数(v2<EFBFBD>?
|
||
GET {{baseUrl}}/api/v1/pkb/knowledge/knowledge-bases/{{kbId}}/search?query=测试&top_k=1000
|
||
Accept: application/json
|
||
|
||
### ============================================
|
||
### 阶段3.8: 清理测试数据(可选)
|
||
### ============================================
|
||
|
||
### 22. 删除测试知识库(v2<EFBFBD>?
|
||
# @testKbId = 从创建响应中获取的ID
|
||
DELETE {{baseUrl}}/api/v1/pkb/knowledge/knowledge-bases/{{testKbId}}
|
||
|
||
###
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|