Files
AIclinicalresearch/backend/test-pkb-migration.http
HaHafeng 96290d2f76 feat(aia): Implement Protocol Agent MVP with reusable Agent framework
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
2026-01-24 17:29:24 +08:00

187 lines
4.8 KiB
HTTP
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.
###
# PKB - API
# v1v2<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. RAGv2<EFBFBD>?
GET {{baseUrl}}/api/v1/pkb/knowledge/knowledge-bases/{{kbId}}/search?query=<EFBFBD>?top_k=5
Accept: application/json
### 12. RAGv1 - <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_kv2<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}}
###