Files
AIclinicalresearch/backend/test-pkb-migration.http
HaHafeng 57fdc6ef00 feat(aia): Integrate PromptService for 10 AI agents
Features:
- Migrate 10 agent prompts from hardcoded to database
- Add grayscale preview support (DRAFT/ACTIVE distribution)
- Implement 3-tier fallback (DB -> Cache -> Hardcoded)
- Add version management and rollback capability

Files changed:
- backend/scripts/migrate-aia-prompts.ts (new migration script)
- backend/src/common/prompt/prompt.fallbacks.ts (add AIA fallbacks)
- backend/src/modules/aia/services/agentService.ts (integrate PromptService)
- backend/src/modules/aia/services/conversationService.ts (pass userId)
- backend/src/modules/aia/types/index.ts (fix AgentStage type)

Documentation:
- docs/03-业务模块/AIA-AI智能问答/06-开发记录/2026-01-18-Prompt管理系统集成.md
- docs/02-通用能力层/00-通用能力层清单.md (add FileCard, Prompt management)
- docs/00-系统总体设计/00-系统当前状态与开发指南.md (update to v3.6)

Prompt codes:
- AIA_SCIENTIFIC_QUESTION, AIA_PICO_ANALYSIS, AIA_TOPIC_EVALUATION
- AIA_OUTCOME_DESIGN, AIA_CRF_DESIGN, AIA_SAMPLE_SIZE
- AIA_PROTOCOL_WRITING, AIA_METHODOLOGY_REVIEW
- AIA_PAPER_POLISH, AIA_PAPER_TRANSLATE

Tested: Migration script executed, all 10 prompts inserted successfully
2026-01-18 15:48:53 +08:00

177 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}}
###