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
This commit is contained in:
2026-01-18 15:48:53 +08:00
parent 66255368b7
commit 57fdc6ef00
290 changed files with 2950 additions and 106 deletions

View File

@@ -210,3 +210,6 @@

View File

@@ -152,6 +152,10 @@
background: none;
border: none;
border-left: 2px solid transparent;
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
border-radius: 8px;
font-size: 12px;
color: #64748b;
@@ -174,6 +178,85 @@
border-left-color: #4F6EF2;
}
/* 历史记录标题 */
.history-item-title {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: left;
}
/* 历史记录操作按钮 */
.history-item-actions {
display: none;
align-items: center;
gap: 4px;
flex-shrink: 0;
}
.history-item:hover .history-item-actions {
display: flex;
}
.history-action-btn {
padding: 4px;
background: none;
border: none;
color: #94a3b8;
cursor: pointer;
border-radius: 4px;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
}
.history-action-btn:hover {
background-color: #e2e8f0;
color: #475569;
}
.history-action-btn.delete:hover {
background-color: #fee2e2;
color: #ef4444;
}
/* 历史记录编辑模式 */
.history-item-edit {
display: flex;
align-items: center;
gap: 6px;
width: 100%;
}
.history-edit-input {
flex: 1;
padding: 4px 8px;
border: 1px solid #4F6EF2;
border-radius: 4px;
font-size: 12px;
outline: none;
background: white;
}
.history-edit-save {
padding: 4px;
background: #4F6EF2;
border: none;
color: white;
cursor: pointer;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
}
.history-edit-save:hover {
background: #3b5fe0;
}
/* 用户信息 */
.sidebar-user {
padding: 16px;
@@ -495,7 +578,103 @@
border-top: 1px solid #f1f5f9;
}
/* 工具栏 */
/* 工具栏(新版:按钮+附件同一行) */
.input-toolbar-row {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
overflow-x: auto;
scrollbar-width: thin;
scrollbar-color: #e2e8f0 transparent;
padding-bottom: 4px;
}
.input-toolbar-row::-webkit-scrollbar {
height: 4px;
}
.input-toolbar-row::-webkit-scrollbar-track {
background: transparent;
}
.input-toolbar-row::-webkit-scrollbar-thumb {
background-color: #e2e8f0;
border-radius: 2px;
}
.toolbar-buttons {
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
}
/* 工具栏中的附件列表 */
.toolbar-attachments {
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
}
/* 紧凑型附件卡片 */
.toolbar-attachment-chip {
display: flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 8px;
font-size: 12px;
color: #475569;
white-space: nowrap;
transition: all 0.2s;
}
.toolbar-attachment-chip:hover {
background: #f1f5f9;
border-color: #cbd5e1;
}
.toolbar-attachment-chip.uploading {
opacity: 0.7;
}
.toolbar-attachment-chip .chip-icon {
font-size: 14px;
}
.toolbar-attachment-chip .chip-name {
max-width: 120px;
overflow: hidden;
text-overflow: ellipsis;
}
.toolbar-attachment-chip .chip-loading {
font-size: 12px;
}
.toolbar-attachment-chip .chip-remove {
display: flex;
align-items: center;
justify-content: center;
padding: 2px;
background: none;
border: none;
color: #94a3b8;
cursor: pointer;
border-radius: 4px;
transition: all 0.2s;
}
.toolbar-attachment-chip .chip-remove:hover {
background: #e2e8f0;
color: #ef4444;
}
/* 旧版工具栏(保留兼容) */
.input-toolbar {
display: flex;
align-items: center;
@@ -544,6 +723,91 @@
color: #64748b;
}
.attachment-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.attachment-btn.has-attachments {
color: #4F6EF2;
position: relative;
}
.attachment-count {
position: absolute;
top: -2px;
right: -2px;
background-color: #4F6EF2;
color: white;
font-size: 10px;
min-width: 14px;
height: 14px;
border-radius: 7px;
display: flex;
align-items: center;
justify-content: center;
padding: 0 3px;
}
/* 附件预览区域 */
.attachments-preview {
display: flex;
flex-wrap: wrap;
gap: 8px;
padding: 8px 16px;
max-width: 1024px;
margin: 0 auto;
}
.attachment-chip {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 10px;
background-color: #f1f5f9;
border: 1px solid #e2e8f0;
border-radius: 8px;
font-size: 12px;
color: #475569;
}
.attachment-chip.uploading {
opacity: 0.6;
}
.attachment-name {
max-width: 150px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.uploading-spinner {
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.remove-attachment {
padding: 2px;
background: none;
border: none;
color: #94a3b8;
cursor: pointer;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
}
.remove-attachment:hover {
background-color: #fee2e2;
color: #ef4444;
}
/* 输入框 */
.input-box {
position: relative;
@@ -642,3 +906,43 @@
background-color: #94a3b8;
}
/* === 消息中的附件显示 === */
.message-attachments {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 8px;
padding-bottom: 8px;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
/* FileCard 在消息中的显示样式 */
.message-file-cards {
display: flex;
flex-direction: column;
gap: 8px;
margin-bottom: 8px;
max-width: 320px;
}
.message-item.user .message-file-cards {
margin-left: auto;
}
/* 自定义 FileCard 样式以适配对话场景 */
.message-file-cards :global(.ant-file-card) {
background: rgba(255, 255, 255, 0.95);
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
/* 附件预览区域的 FileCard.List 样式 */
.attachments-preview :global(.ant-file-card-list) {
gap: 8px;
}
.attachments-preview :global(.ant-file-card) {
background: rgba(255, 255, 255, 0.95);
border-radius: 8px;
}