feat(admin): Complete Phase 3.5.1-3.5.4 Prompt Management System (83%)

Summary:
- Implement Prompt management infrastructure and core services
- Build admin portal frontend with light theme
- Integrate CodeMirror 6 editor for non-technical users

Phase 3.5.1: Infrastructure Setup
- Create capability_schema for Prompt storage
- Add prompt_templates and prompt_versions tables
- Add prompt:view/edit/debug/publish permissions
- Migrate RVW prompts to database (RVW_EDITORIAL, RVW_METHODOLOGY)

Phase 3.5.2: PromptService Core
- Implement gray preview logic (DRAFT for debuggers, ACTIVE for users)
- Module-level debug control (setDebugMode)
- Handlebars template rendering
- Variable extraction and validation (extractVariables, validateVariables)
- Three-level disaster recovery (database -> cache -> hardcoded fallback)

Phase 3.5.3: Management API
- 8 RESTful endpoints (/api/admin/prompts/*)
- Permission control (PROMPT_ENGINEER can edit, SUPER_ADMIN can publish)

Phase 3.5.4: Frontend Management UI
- Build admin portal architecture (AdminLayout, OrgLayout)
- Add route system (/admin/*, /org/*)
- Implement PromptListPage (filter, search, debug switch)
- Implement PromptEditor (CodeMirror 6 simplified for clinical users)
- Implement PromptEditorPage (edit, save, publish, test, version history)

Technical Details:
- Backend: 6 files, ~2044 lines (prompt.service.ts 596 lines)
- Frontend: 9 files, ~1735 lines (PromptEditorPage.tsx 399 lines)
- CodeMirror 6: Line numbers, auto-wrap, variable highlight, search, undo/redo
- Chinese-friendly: 15px font, 1.8 line-height, system fonts

Next Step: Phase 3.5.5 - Integrate RVW module with PromptService

Tested: Backend API tests passed (8/8), Frontend pending user testing
Status: Ready for Phase 3.5.5 RVW integration
This commit is contained in:
2026-01-11 21:25:16 +08:00
parent cdfbc9927a
commit 5523ef36ea
297 changed files with 15914 additions and 1266 deletions

View File

@@ -558,5 +558,6 @@ export default FulltextDetailDrawer;

View File

@@ -151,5 +151,6 @@ export const useAssets = (activeTab: AssetTabType) => {

View File

@@ -141,5 +141,6 @@ export const useRecentTasks = () => {

View File

@@ -340,5 +340,6 @@ export default DropnaDialog;

View File

@@ -425,5 +425,6 @@ export default MetricTimePanel;

View File

@@ -311,5 +311,6 @@ export default PivotPanel;

View File

@@ -111,5 +111,6 @@ export function useSessionStatus({

View File

@@ -103,5 +103,6 @@ export interface DataStats {

View File

@@ -99,5 +99,6 @@ export type AssetTabType = 'all' | 'processed' | 'raw';

View File

@@ -220,3 +220,4 @@ export const documentSelectionApi = {

View File

@@ -288,3 +288,4 @@ export default KnowledgePage;

View File

@@ -226,3 +226,4 @@ export const useKnowledgeBaseStore = create<KnowledgeBaseState>((set, get) => ({

View File

@@ -43,3 +43,4 @@ export interface BatchTemplate {

View File

@@ -128,3 +128,4 @@ export function formatTime(dateStr: string): string {
return date.toLocaleDateString('zh-CN', { month: '2-digit', day: '2-digit' });
}

View File

@@ -121,3 +121,4 @@ export default function AgentModal({ visible, taskCount, onClose, onConfirm }: A
);
}

View File

@@ -41,3 +41,4 @@ export default function BatchToolbar({ selectedCount, onRunBatch, onClearSelecti
);
}

View File

@@ -64,3 +64,4 @@ export default function FilterChips({ filters, counts, onFilterChange }: FilterC
);
}

View File

@@ -54,3 +54,4 @@ export default function Header({ onUpload }: HeaderProps) {
);
}

View File

@@ -108,3 +108,4 @@ export default function ReportDetail({ report, onBack }: ReportDetailProps) {
);
}

View File

@@ -36,3 +36,4 @@ export default function ScoreRing({ score, size = 'medium', showLabel = true }:
);
}

View File

@@ -71,3 +71,4 @@ export default function Sidebar({ currentView, onViewChange, onSettingsClick }:
);
}

View File

@@ -13,3 +13,4 @@ export { default as MethodologyReport } from './MethodologyReport';
export { default as ReportDetail } from './ReportDetail';
export { default as TaskDetail } from './TaskDetail';

View File

@@ -282,3 +282,4 @@ export default function Dashboard() {
);
}

View File

@@ -231,3 +231,4 @@
}
}