feat(aia): Complete AIA V2.0 with universal streaming capabilities

Major Updates:
- Add StreamingService with OpenAI Compatible format (backend/common/streaming)
- Upgrade Chat component V2 with Ant Design X integration
- Implement AIA module with 12 intelligent agents
- Create AgentHub with 100% prototype V11 restoration
- Create ChatWorkspace with streaming response support
- Add ThinkingBlock for deep thinking display
- Add useAIStream Hook for OpenAI Compatible stream handling

Backend Common Capabilities (~400 lines):
- OpenAIStreamAdapter: SSE adapter with OpenAI format
- StreamingService: unified streaming service
- Support content and reasoning_content dual streams
- Deep thinking tag processing (<think>...</think>)

Frontend Common Capabilities (~2000 lines):
- AIStreamChat: modern streaming chat component
- ThinkingBlock: collapsible deep thinking display
- ConversationList: conversation management with grouping
- useAIStream: OpenAI Compatible stream handler Hook
- useConversations: conversation state management Hook
- Modern design styles (Ultramodern theme)

AIA Module Frontend (~1500 lines):
- AgentHub: 12 agent cards with timeline design
- ChatWorkspace: fullscreen immersive chat interface
- AgentCard: theme-colored cards (blue/yellow/teal/purple)
- 5 phases, 12 agents configuration
- Responsive layout (desktop + mobile)

AIA Module Backend (~900 lines):
- agentService: 12 agents config with system prompts
- conversationService: refactored with StreamingService
- attachmentService: file upload skeleton (30k token limit)
- 12 API endpoints with authentication
- Full CRUD for conversations and messages

Documentation:
- AIA module status and development guide
- Universal capabilities catalog (11 services)
- Quick reference card for developers
- System overview updates

Testing:
- Stream response verified (HTTP 200)
- Authentication working correctly
- Auto conversation creation working
- Deep thinking display working
- Message input and send working

Status: Core features completed (85%), attachment and history loading pending
This commit is contained in:
2026-01-14 19:09:28 +08:00
parent 4ed67a8846
commit 3d35e9c58b
38 changed files with 8448 additions and 335 deletions

View File

@@ -0,0 +1,210 @@
/**
* AgentCard 智能体卡片样式
*
* 100%还原原型图V11
*/
/* === 卡片基础样式 === */
.agent-card {
background-color: #F6F9FF;
border: 1px solid #E0E7FF;
border-radius: 10px;
padding: 14px;
min-height: 145px;
display: flex;
flex-direction: column;
position: relative;
cursor: pointer;
transition: all 0.2s ease-in-out;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}
.agent-card:hover {
transform: translateY(-3px);
border-color: #4F6EF2;
border-width: 1.5px;
background-color: #EEF4FF;
box-shadow: 0 8px 16px rgba(79, 110, 242, 0.12);
margin: -0.5px;
}
/* === 工具卡片(青色主题) === */
.agent-card.tool-card {
background-color: #F0FDFA;
border-color: #CCFBF1;
}
.agent-card.tool-card:hover {
border-color: #0D9488;
background-color: #E0F2F1;
box-shadow: 0 8px 16px rgba(13, 148, 136, 0.15);
}
/* === 头部布局 === */
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 4px;
}
.card-header-left {
display: flex;
align-items: center;
gap: 8px;
}
/* === 图标容器 === */
.icon-box {
background-color: #FFFFFF;
border: 1px solid #DCE6FF;
border-radius: 4px;
padding: 5px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
}
.agent-card:hover .icon-box {
background-color: #DBEafe;
border-color: #93C5FD;
transform: scale(1.05);
}
.agent-icon {
width: 20px;
height: 20px;
color: #4F6EF2;
}
/* 工具卡片图标 */
.agent-card.tool-card .icon-box {
border-color: #CCFBF1;
}
.agent-card.tool-card .agent-icon {
color: #0D9488;
}
.agent-card.tool-card:hover .icon-box {
background-color: #CCFBF1;
border-color: #5EEAD4;
}
/* 黄色主题图标 */
.agent-card.theme-yellow .icon-box {
border-color: #FEF08A;
}
.agent-card.theme-yellow .agent-icon {
color: #CA8A04;
}
.agent-card.theme-yellow:hover {
border-color: #CA8A04;
background-color: #FEF9C3;
}
.agent-card.theme-yellow:hover .icon-box {
background-color: #FEF08A;
border-color: #FACC15;
}
/* 紫色主题图标 */
.agent-card.theme-purple .icon-box {
border-color: #E9D5FF;
}
.agent-card.theme-purple .agent-icon {
color: #9333EA;
}
.agent-card.theme-purple:hover {
border-color: #9333EA;
background-color: #F3E8FF;
}
.agent-card.theme-purple:hover .icon-box {
background-color: #E9D5FF;
border-color: #C084FC;
}
/* === 标题 === */
.card-title {
font-size: 15px;
font-weight: 700;
color: #0f172a;
margin: 0;
line-height: 1.3;
}
/* === 序号水印 === */
.num-watermark {
color: #E0E7FF;
font-family: 'Inter', sans-serif;
font-weight: 700;
font-size: 1.25rem;
line-height: 1;
}
.agent-card:hover .num-watermark {
color: #C7D2FE;
}
.agent-card.tool-card .num-watermark {
color: #CCFBF1;
}
.agent-card.tool-card:hover .num-watermark {
color: #99F6E4;
}
.agent-card.theme-yellow .num-watermark {
color: #FEF08A;
}
.agent-card.theme-yellow:hover .num-watermark {
color: #FDE047;
}
.agent-card.theme-purple .num-watermark {
color: #E9D5FF;
}
.agent-card.theme-purple:hover .num-watermark {
color: #D8B4FE;
}
/* === 描述文本 === */
.desc-text {
text-align: justify;
line-height: 1.5;
font-size: 13px;
color: #64748b;
margin-top: 8px;
flex-grow: 1;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
/* === 跳转图标(工具类) === */
.link-icon {
position: absolute;
top: 12px;
right: 12px;
width: 14px;
height: 14px;
color: #94A3B8;
opacity: 0.6;
transition: all 0.2s;
}
.agent-card:hover .link-icon {
opacity: 1;
color: #0D9488;
transform: translate(2px, -2px);
}

View File

@@ -0,0 +1,292 @@
/**
* AgentHub 智能体大厅样式
*
* 100%还原原型图V11
*/
/* === CSS变量 === */
:root {
--brand-blue: #4F6EF2;
--brand-hover: #3d5afe;
--brand-teal: #0D9488;
--brand-purple: #9333EA;
--brand-yellow: #CA8A04;
}
/* === 整体布局 === */
.agent-hub {
height: 100vh;
overflow-y: auto;
background-color: #FFFFFF;
font-family: 'Noto Sans SC', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
color: #64748b;
}
/* === 主体内容 === */
.hub-main {
max-width: 760px;
margin: 0 auto;
padding: 24px 16px;
}
/* === 头部搜索区 === */
.hub-header {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-bottom: 32px;
margin-top: 32px;
}
.header-title {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 20px;
}
.title-icon {
background-color: var(--brand-blue);
color: white;
padding: 6px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
}
.title-text {
font-size: 24px;
font-weight: 700;
color: #1e293b;
margin: 0;
display: flex;
align-items: center;
gap: 8px;
}
.title-badge {
font-size: 11px;
font-weight: 400;
color: var(--brand-blue);
background-color: #eef2ff;
border: 1px solid #e0e7ff;
padding: 2px 8px;
border-radius: 4px;
vertical-align: middle;
}
/* === 搜索框 === */
.search-box {
width: 100%;
max-width: 672px;
position: relative;
display: flex;
gap: 8px;
}
.search-input {
flex: 1;
padding: 10px 48px 10px 16px;
border: 1px solid #cbd5e1;
border-radius: 8px;
background-color: #FFFFFF;
font-size: 14px;
color: #334155;
transition: all 0.2s;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.search-input:focus {
outline: none;
border-color: var(--brand-blue);
box-shadow: 0 0 0 3px rgba(79, 110, 242, 0.1);
}
.search-input::placeholder {
color: #94a3b8;
}
.search-btn {
position: absolute;
right: 4px;
top: 4px;
bottom: 4px;
padding: 0 20px;
background-color: var(--brand-blue);
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background-color 0.2s;
}
.search-btn:hover {
background-color: var(--brand-hover);
}
/* === 流水线容器 === */
.pipeline-container {
padding-left: 32px;
}
/* === 阶段 === */
.pipeline-stage {
position: relative;
margin-bottom: 24px;
}
.pipeline-stage.last-stage {
margin-bottom: 0;
}
/* === 时间轴 === */
.timeline-marker {
position: absolute;
left: -28px;
top: 0;
display: flex;
flex-direction: column;
align-items: center;
}
.timeline-dot {
width: 24px;
height: 24px;
border-radius: 50%;
background-color: var(--brand-blue);
color: white;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-weight: 700;
z-index: 10;
border: 2px solid white;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.timeline-dot.theme-teal {
background-color: var(--brand-teal);
}
.timeline-dot.theme-yellow {
background-color: var(--brand-yellow);
}
.timeline-dot.theme-purple {
background-color: var(--brand-purple);
}
.timeline-line {
position: absolute;
top: 28px;
bottom: -28px;
width: 2px;
background-color: #e2e8f0;
z-index: 0;
}
.last-stage .timeline-line {
display: none;
}
/* === 阶段内容 === */
.stage-content {
padding-left: 8px;
}
.stage-title {
font-size: 14px;
font-weight: 700;
color: #1e293b;
margin: 0 0 12px 0;
display: flex;
align-items: center;
gap: 8px;
}
.tool-badge {
font-size: 10px;
font-weight: 500;
color: var(--brand-teal);
background-color: #f0fdfa;
border: 1px solid #ccfbf1;
padding: 2px 8px;
border-radius: 4px;
}
/* === 卡片网格 === */
.agents-grid {
display: grid;
gap: 16px;
}
.agents-grid.grid-cols-3 {
grid-template-columns: repeat(3, 1fr);
}
/* === 底部 === */
.hub-footer {
margin-top: 32px;
padding: 16px;
border-top: 1px solid #f1f5f9;
text-align: center;
}
.hub-footer p {
margin: 0;
font-size: 10px;
color: #94a3b8;
}
/* === 滚动条样式 === */
.agent-hub::-webkit-scrollbar {
width: 8px;
}
.agent-hub::-webkit-scrollbar-track {
background: #f8fafc;
}
.agent-hub::-webkit-scrollbar-thumb {
background-color: #cbd5e1;
border-radius: 4px;
}
.agent-hub::-webkit-scrollbar-thumb:hover {
background-color: #94a3b8;
}
/* === 响应式 === */
@media (max-width: 768px) {
.hub-main {
padding: 16px;
}
.hub-header {
margin-top: 16px;
margin-bottom: 24px;
}
.title-text {
font-size: 20px;
}
.pipeline-container {
padding-left: 24px;
}
.timeline-marker {
left: -24px;
}
.agents-grid.grid-cols-3 {
grid-template-columns: 1fr;
}
}

View File

@@ -0,0 +1,644 @@
/**
* ChatWorkspace 对话工作台样式
*
* 参考原型图V2
*/
/* === 整体布局 === */
.chat-workspace {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 100;
display: flex;
background-color: #FFFFFF;
font-family: 'Noto Sans SC', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
overflow: hidden;
}
/* === 移动端遮罩 === */
.mobile-overlay {
position: fixed;
inset: 0;
z-index: 40;
background-color: rgba(0, 0, 0, 0.2);
backdrop-filter: blur(2px);
}
@media (min-width: 1024px) {
.mobile-overlay {
display: none;
}
}
/* === 左侧边栏 === */
.workspace-sidebar {
position: fixed;
z-index: 50;
width: 256px;
height: 100%;
background-color: #f8fafc;
border-right: 1px solid #e2e8f0;
display: flex;
flex-direction: column;
transform: translateX(-100%);
transition: transform 0.3s ease;
}
.workspace-sidebar.open {
transform: translateX(0);
}
@media (min-width: 1024px) {
.workspace-sidebar {
position: relative;
transform: translateX(0);
}
}
/* 边栏头部 */
.sidebar-header {
padding: 16px;
border-bottom: 1px solid #e2e8f0;
display: flex;
align-items: center;
justify-content: space-between;
}
.back-btn {
display: flex;
align-items: center;
gap: 8px;
padding: 0;
background: none;
border: none;
color: #64748b;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: color 0.2s;
}
.back-btn:hover {
color: #1e293b;
}
.close-sidebar-btn {
padding: 4px;
background: none;
border: none;
color: #94a3b8;
cursor: pointer;
}
@media (min-width: 1024px) {
.close-sidebar-btn {
display: none;
}
}
/* 新建对话按钮 */
.sidebar-new {
padding: 16px;
}
.new-chat-btn {
width: 100%;
padding: 10px 16px;
background-color: #FFFFFF;
border: 1px solid #e2e8f0;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
color: #334155;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
transition: all 0.2s;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.new-chat-btn:hover {
border-color: #4F6EF2;
color: #4F6EF2;
}
/* 历史记录 */
.sidebar-history {
flex: 1;
overflow-y: auto;
padding: 0 8px 16px;
}
.history-group {
margin-bottom: 16px;
}
.history-label {
padding: 8px 8px;
font-size: 10px;
font-weight: 700;
color: #94a3b8;
text-transform: uppercase;
}
.history-item {
width: 100%;
padding: 8px 12px;
background: none;
border: none;
border-left: 2px solid transparent;
border-radius: 8px;
font-size: 12px;
color: #64748b;
text-align: left;
cursor: pointer;
transition: all 0.2s;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.history-item:hover {
background-color: #f1f5f9;
}
.history-item.active {
background-color: rgba(226, 232, 240, 0.5);
color: #1e293b;
font-weight: 500;
border-left-color: #4F6EF2;
}
/* 用户信息 */
.sidebar-user {
padding: 16px;
border-top: 1px solid #e2e8f0;
background-color: rgba(241, 245, 249, 0.5);
display: flex;
align-items: center;
gap: 8px;
}
.user-avatar {
width: 28px;
height: 28px;
border-radius: 50%;
background-color: #4F6EF2;
color: white;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-weight: 600;
}
.user-info {
flex: 1;
min-width: 0;
}
.user-name {
font-size: 12px;
font-weight: 500;
color: #334155;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.user-plan {
font-size: 10px;
color: #94a3b8;
}
/* === 主对话区 === */
.workspace-main {
flex: 1;
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
}
/* 头部 */
.workspace-header {
height: 56px;
padding: 0 16px;
border-bottom: 1px solid #f1f5f9;
background-color: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(8px);
display: flex;
align-items: center;
justify-content: space-between;
flex-shrink: 0;
}
.header-left {
display: flex;
align-items: center;
gap: 12px;
}
.menu-btn {
padding: 8px;
margin-left: -8px;
background: none;
border: none;
color: #64748b;
cursor: pointer;
border-radius: 6px;
transition: background-color 0.2s;
}
.menu-btn:hover {
background-color: #f1f5f9;
}
@media (min-width: 1024px) {
.menu-btn {
display: none;
}
}
.agent-icon-box {
width: 32px;
height: 32px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.agent-info {
display: flex;
flex-direction: column;
}
.agent-name {
font-size: 14px;
font-weight: 700;
color: #1e293b;
margin: 0;
line-height: 1.2;
}
.agent-status {
display: flex;
align-items: center;
gap: 6px;
}
.status-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background-color: #22c55e;
}
.status-text {
font-size: 10px;
color: #64748b;
}
.header-right {
display: flex;
align-items: center;
gap: 8px;
}
.header-action {
padding: 8px;
background: none;
border: none;
color: #94a3b8;
cursor: pointer;
border-radius: 6px;
transition: all 0.2s;
}
.header-action:hover {
color: #4F6EF2;
background-color: #f1f5f9;
}
/* 对话区域容器 */
.workspace-chat-container {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
/* 消息区域 */
.workspace-messages {
flex: 1;
overflow-y: auto;
padding: 24px;
display: flex;
flex-direction: column;
gap: 16px;
}
/* 欢迎卡片容器(左上角,类似消息气泡) */
.welcome-card-container {
display: flex;
gap: 12px;
max-width: 100%;
animation: fadeIn 0.3s ease-out;
}
/* 欢迎卡片 */
.welcome-card {
background-color: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 12px;
border-top-left-radius: 4px;
padding: 12px 16px;
display: flex;
align-items: center;
max-width: 85%;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.welcome-icon {
width: 32px;
height: 32px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.welcome-text {
font-size: 14px;
line-height: 1.5;
color: #334155;
margin: 0;
}
/* === 消息项 === */
.message-item {
display: flex;
gap: 12px;
animation: fadeIn 0.3s ease-out;
}
.message-item.user {
flex-direction: row-reverse;
}
/* 消息头像 */
.message-avatar {
width: 32px;
height: 32px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.message-avatar.user-avatar {
background-color: #e2e8f0;
color: #64748b;
font-size: 12px;
font-weight: 600;
}
/* 消息内容包装 */
.message-content-wrapper {
flex: 1;
display: flex;
flex-direction: column;
gap: 12px;
max-width: 85%;
}
.message-item.user .message-content-wrapper {
align-items: flex-end;
}
/* 消息气泡 */
.message-bubble {
padding: 12px 16px;
border-radius: 12px;
font-size: 14px;
line-height: 1.6;
white-space: pre-wrap;
word-break: break-word;
}
.message-bubble.user {
background: linear-gradient(135deg, #4F6EF2 0%, #3d5afe 100%);
color: white;
border-radius: 12px;
border-top-right-radius: 4px;
box-shadow: 0 2px 8px rgba(79, 110, 242, 0.25);
}
.message-bubble.assistant {
background-color: #f8fafc;
border: 1px solid #e2e8f0;
border-top-left-radius: 4px;
color: #334155;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
/* 打字光标 */
.typing-cursor {
display: inline-block;
animation: blink 0.8s step-end infinite;
color: #4F6EF2;
margin-left: 2px;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0; }
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 加载中提示 */
.loading-container {
display: flex;
align-items: center;
justify-content: center;
padding: 40px;
}
.loading-spinner {
font-size: 14px;
color: #94a3b8;
}
/* 输入区域(靠下) */
.workspace-input-area {
padding: 16px 24px 24px;
background-color: #FFFFFF;
border-top: 1px solid #f1f5f9;
}
/* 工具栏 */
.input-toolbar {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 12px;
}
.deep-thinking-btn {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 12px;
border: 1px solid #e2e8f0;
border-radius: 16px;
background-color: #FFFFFF;
font-size: 13px;
color: #64748b;
cursor: pointer;
transition: all 0.2s;
}
.deep-thinking-btn.active {
background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
border-color: transparent;
color: white;
box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}
.deep-thinking-btn:hover:not(.active) {
border-color: #a78bfa;
color: #8b5cf6;
}
.attachment-btn {
padding: 6px;
background: none;
border: none;
color: #94a3b8;
cursor: pointer;
border-radius: 6px;
transition: all 0.2s;
}
.attachment-btn:hover {
background-color: #f1f5f9;
color: #64748b;
}
/* 输入框 */
.input-box {
position: relative;
background-color: #f8fafc;
border: 2px solid #e2e8f0;
border-radius: 16px;
transition: all 0.3s;
max-width: 1024px;
margin: 0 auto;
}
.input-box:focus-within {
border-color: #4F6EF2;
box-shadow: 0 0 0 4px rgba(79, 110, 242, 0.1);
background-color: #FFFFFF;
}
.chat-textarea {
width: 100%;
padding: 14px 56px 14px 16px;
background: transparent;
border: none;
outline: none;
font-size: 14px;
color: #334155;
resize: none;
max-height: 128px;
font-family: inherit;
line-height: 1.5;
}
.chat-textarea::placeholder {
color: #94a3b8;
}
.chat-textarea:disabled {
cursor: not-allowed;
opacity: 0.6;
}
.send-btn {
position: absolute;
right: 8px;
bottom: 8px;
width: 36px;
height: 36px;
background-color: #1e293b;
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.send-btn:hover {
background-color: #334155;
}
.send-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* 输入提示 */
.input-hint {
text-align: center;
margin-top: 8px;
font-size: 10px;
color: #94a3b8;
}
/* === 滚动条 === */
.sidebar-history::-webkit-scrollbar,
.workspace-messages::-webkit-scrollbar {
width: 6px;
}
.sidebar-history::-webkit-scrollbar-track,
.workspace-messages::-webkit-scrollbar-track {
background: transparent;
}
.sidebar-history::-webkit-scrollbar-thumb,
.workspace-messages::-webkit-scrollbar-thumb {
background-color: #cbd5e1;
border-radius: 3px;
}
.sidebar-history::-webkit-scrollbar-thumb:hover,
.workspace-messages::-webkit-scrollbar-thumb:hover {
background-color: #94a3b8;
}