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

Major Changes:
- Add StreamingService with OpenAI Compatible format
- Upgrade Chat component V2 with Ant Design X integration
- Implement AIA module with 12 intelligent agents
- Update API routes to unified /api/v1 prefix
- Update system documentation

Backend (~1300 lines):
- common/streaming: OpenAI Compatible adapter
- modules/aia: 12 agents, conversation service, streaming integration
- Update route versions (RVW, PKB to v1)

Frontend (~3500 lines):
- modules/aia: AgentHub + ChatWorkspace (100% prototype restoration)
- shared/Chat: AIStreamChat, ThinkingBlock, useAIStream Hook
- Update API endpoints to v1

Documentation:
- AIA module status guide
- Universal capabilities catalog
- System overview updates
- All module documentation sync

Tested: Stream response verified, authentication working
Status: AIA V2.0 core completed (85%)
This commit is contained in:
2026-01-14 19:15:01 +08:00
parent 3d35e9c58b
commit 1b53ab9d52
386 changed files with 52096 additions and 65238 deletions

View File

@@ -1,7 +1,7 @@
# AIA V2.1 å‰<C3A5>端组件设计
> **版本**:V2.1
> **创建日期**2026-01-11
> **创建日期**�026-01-11
> **技术栈**:React 19 + TypeScript 5 + Ant Design 6 + Ant Design X 2.1
---
@@ -11,45 +11,45 @@
```
frontend-v2/src/modules/aia/
├── pages/
│ ├── Dashboard.tsx # 智能体大厅(首页)
│ └── Workspace.tsx # 对话工作台
� ├── Dashboard.tsx # 智能体大厅(首页�
â”? └── Workspace.tsx # 对è¯<EFBFBD>工作å<EFBFBD>?
├── components/
│ ├── AgentPipeline/
│ │ ├── index.tsx # 5阶段流水线容器
│ │ ├── StageColumn.tsx # 单阶段列
│ │ └── AgentCard.tsx # 智能体卡片
│ ├── IntentSearch/
│ │ ├── index.tsx # 意图搜索框
│ │ └── SuggestionDropdown.tsx # 建议下拉框
│ ├── ConversationList/
│ │ ├── index.tsx # 历史会话列表
│ │ └── ConversationItem.tsx # 会话项
│ ├── MessageList/
│ │ ├── index.tsx # 消息列表
│ │ ├── UserMessage.tsx # 用户消息
│ │ ├── AssistantMessage.tsx # AI回复
│ │ └── ThinkingBlock.tsx # 深度思考折叠块
│ ├── Attachment/
│ │ ├── AttachmentUpload.tsx # 附件上传
│ │ ├── AttachmentCard.tsx # 附件卡片
│ │ └── AttachmentPreview.tsx # 附件预览
│ ├── SlashCommands/
│ │ └── index.tsx # 快捷指令菜单
│ └── ActionBar/
└── index.tsx # 结果操作栏
� ├── AgentPipeline/
â”? â”? ├── index.tsx # 5阶段æµ<EFBFBD>水线容å™?
â”? â”? ├── StageColumn.tsx # å<EFBFBD>•阶段åˆ
â”? â”? └── AgentCard.tsx # 智能体å<EFBFBD>¡ç‰?
� ├── IntentSearch/
â”? â”? ├── index.tsx # æ„<EFBFBD>徿<EFBFBD>œç´¢æ¡?
� � └── SuggestionDropdown.tsx # 建议下拉�
� ├── ConversationList/
â”? â”? ├── index.tsx # 历å<EFBFBD>²ä¼šè¯<EFBFBD>列表
â”? â”? └── ConversationItem.tsx # 会è¯<EFBFBD>é¡?
� ├── MessageList/
â”? â”? ├── index.tsx # 消æ<EFBFBD>¯åˆ—表
â”? â”? ├── UserMessage.tsx # 用户消æ<EFBFBD>¯
â”? â”? ├── AssistantMessage.tsx # AIåžå¤<EFBFBD>
â”? â”? └── ThinkingBlock.tsx # 深度æ€<EFBFBD>考折å<EFBFBD> å<EFBFBD>
� ├── Attachment/
� � ├── AttachmentUpload.tsx # 附件上传
â”? â”? ├── AttachmentCard.tsx # 附件å<EFBFBD>¡ç‰‡
� � └── AttachmentPreview.tsx # 附件预览
� ├── SlashCommands/
â”? â”? └── index.tsx # å¿«æ<EFBFBD>·æŒ‡ä»¤è<EFBFBD>œå<EFBFBD>
� └── ActionBar/
â”? └── index.tsx # 结果æ“<EFBFBD>作æ ?
├── hooks/
│ ├── useConversation.ts # 对话管理
│ ├── useAgents.ts # 智能体数据
│ ├── useIntentRouter.ts # 意图路由
│ ├── useStreamMessage.ts # 流式消息
│ └── useAttachment.ts # 附件上传
â”? ├── useConversation.ts # 对è¯<EFBFBD>管ç<EFBFBD>
â”? ├── useAgents.ts # 智能体数æ<EFBFBD>?
â”? ├── useIntentRouter.ts # æ„<EFBFBD>å¾è·¯ç”±
â”? ├── useStreamMessage.ts # æµ<EFBFBD>å¼<EFBFBD>消æ<EFBFBD>¯
� └── useAttachment.ts # 附件上传
├── api/
│ └── index.ts # API 封装
â”? └── index.ts # API å°<EFBFBD>装
├── types/
│ └── index.ts # TypeScript 类型
� └── index.ts # TypeScript 类型
├── styles/
│ ├── dashboard.module.css # Dashboard 样式
│ └── workspace.module.css # Workspace 样式
â”? ├── dashboard.module.css # Dashboard æ ·å¼<EFBFBD>
â”? └── workspace.module.css # Workspace æ ·å¼<EFBFBD>
└── index.tsx # 模å<C2A1>—å…¥å<C2A5>£ + 路由
```
@@ -68,7 +68,7 @@ frontend-v2/src/modules/aia/
--stage-write: #F59E0B; /* 橙色 - 论文撰写 */
--stage-publish: #EF4444; /* 红色 - æˆ<C3A6>æžœå<C593>布 */
/* 功能色 */
/* 功能�*/
--ai-assistant: #6366F1; /* AI助æ‰ä¸»è‰² */
--thinking-bg: #F3F4F6; /* æ€<C3A6>考å<C692>—背景 */
--thinking-border: #E5E7EB; /* æ€<C3A6>考å<C692>—边框 */
@@ -108,7 +108,7 @@ frontend-v2/src/modules/aia/
## 📄 页é<C2B5>¢è®¾è®¡
### 1. Dashboard(智能体大厅)
### 1. Dashboard(智能体大厅�
```tsx
// pages/Dashboard.tsx
@@ -119,7 +119,7 @@ import { AgentPipeline } from '../components/AgentPipeline';
export const Dashboard: React.FC = () => {
return (
<div className={styles.dashboard}>
{/* 顶部意图搜索框 */}
{/* 顶部æ„<EFBFBD>徿<EFBFBD>œç´¢æ¡?*/}
<header className={styles.header}>
<h1>AI æºèƒ½åŠ©æ</h1>
<p>æœä»ä¹ˆå<EFBFBD>¯ä»¥å¸®åŠ©æ¨çšï¼Ÿ</p>
@@ -135,14 +135,14 @@ export const Dashboard: React.FC = () => {
};
```
**布局特点**
**布局特点**�
- 顶部居中大æ<C2A7>œç´¢æ¡†
- 5阶段流水线横向平铺(桌面)/ 纵向滚动(移动)
- Gemini 风格大留白
- 5阶段æµ<EFBFBD>水线横å<EFBFBD>平铺(桌é<EFBFBD>¢ï¼? 纵å<C2B5>滚动(移动)
- Gemini 风格大留�
---
### 2. Workspace(对话工作台)
### 2. Workspace(对è¯<EFBFBD>工作å<EFBFBD>°ï¼?
```tsx
// pages/Workspace.tsx
@@ -201,7 +201,7 @@ export const Workspace: React.FC = () => {
## 🧩 组件详细设计
### 1. AgentPipeline5阶段流水线
### 1. AgentPipelineï¼?阶段æµ<C3A6>水线)
```tsx
// components/AgentPipeline/index.tsx
@@ -238,7 +238,7 @@ export const AgentPipeline: React.FC<AgentPipelineProps> = ({ onAgentClick }) =>
};
```
**样式特点**
**æ ·å¼<EFBFBD>特ç¹**ï¼?
```css
.pipeline {
display: flex;
@@ -258,7 +258,7 @@ export const AgentPipeline: React.FC<AgentPipelineProps> = ({ onAgentClick }) =>
---
### 2. IntentSearch(意图搜索框)
### 2. IntentSearch(æ„<EFBFBD>徿<EFBFBD>œç´¢æ¡†ï¼?
```tsx
// components/IntentSearch/index.tsx
@@ -307,14 +307,14 @@ export const IntentSearch: React.FC = () => {
---
### 3. ThinkingBlock(深度思考折叠块)
### 3. ThinkingBlock(深度æ€<EFBFBD>考折å<EFBFBD> å<EFBFBD>—ï¼?
```tsx
// components/MessageList/ThinkingBlock.tsx
interface ThinkingBlockProps {
content: string;
duration?: number; // 思考耗时(秒)
duration?: number; // æ€<EFBFBD>考耗时(ç§ï¼?
isStreaming?: boolean; // 是å<C2AF>¦æ­£åœ¨ç”Ÿæˆ<C3A6>
}
@@ -328,7 +328,7 @@ export const ThinkingBlock: React.FC<ThinkingBlockProps> = ({
useEffect(() => {
if (!isStreaming && expanded) {
// 完成后 1.5s 自动收起
// 完æˆ<EFBFBD>å<EFBFBD>?1.5s 自动收起
const timer = setTimeout(() => setExpanded(false), 1500);
return () => clearTimeout(timer);
}
@@ -344,7 +344,7 @@ export const ThinkingBlock: React.FC<ThinkingBlockProps> = ({
{isStreaming ? <LoadingOutlined spin /> : <BulbOutlined />}
</span>
<span className={styles.title}>
{isStreaming ? '正在深度思考...' : `已深度思考 (耗时 ${duration?.toFixed(1)}s)`}
{isStreaming ? '正在深度æ€<EFBFBD>è€?..' : `已深度æ€<EFBFBD>è€?(耗时 ${duration?.toFixed(1)}s)`}
</span>
<span className={styles.expandIcon}>
{expanded ? <UpOutlined /> : <DownOutlined />}
@@ -363,7 +363,7 @@ export const ThinkingBlock: React.FC<ThinkingBlockProps> = ({
};
```
**样式**
**æ ·å¼<EFBFBD>**ï¼?
```css
.thinkingBlock {
background: var(--thinking-bg);
@@ -412,18 +412,18 @@ export const AttachmentUpload: React.FC<AttachmentUploadProps> = ({
const handleUpload = async (file: File) => {
if (attachments.length >= maxCount) {
message.error(`最多上传 ${maxCount} 个附件`);
message.error(`最多上�${maxCount} 个附件`);
return false;
}
// 文件类型校验
const allowedTypes = ['application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'text/plain', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
if (!allowedTypes.includes(file.type)) {
message.error('仅支持 PDF、Word、TXT、Excel 文件');
message.error('仅支æŒ?PDFã€<C3A3>Wordã€<C3A3>TXTã€<C3A3>Excel 文件');
return false;
}
// 文件大小校验20MB
// æ‡ä»¶å¤§å°<EFBFBD>校验ï¼?0MBï¼?
if (file.size > 20 * 1024 * 1024) {
message.error(‡ä»¶å¤§å°<C3A5>ä¸<C3A4>能超过 20MB');
return false;
@@ -448,7 +448,7 @@ export const AttachmentUpload: React.FC<AttachmentUploadProps> = ({
</Button>
</Upload>
{/* 已上传附件列表 */}
{/* 已上传附件列�*/}
<div className={styles.attachmentList}>
{attachments.map(att => (
<AttachmentCard
@@ -483,10 +483,10 @@ interface SlashCommandsProps {
}
const commands: SlashCommand[] = [
{ key: 'polish', icon: '✨', label: '润色', description: '优化文本表达' },
{ key: 'polish', icon: 'âœ?, label: 'æ¦è²', description: 'ä¼˜åŒææœ¬è¡¨è¾¾' },
{ key: 'expand', icon: 'ðŸ<EFBFBD>', label: 'æ©å', description: 'æ©å±å容ç»èŠ' },
{ key: 'translate', icon: 'ðŸŒ<EFBFBD>', label: 'ç¿»è¯', description: '中è±äºè¯' },
{ key: 'export', icon: '📄', label: '导出Word', description: '导出为 Word 文档' },
{ key: 'export', icon: 'ðŸ', label: '导åºWord', description: '导åºä¸?Word ææ¡£' },
];
export const SlashCommands: React.FC<SlashCommandsProps> = ({
@@ -544,7 +544,7 @@ export const SlashCommands: React.FC<SlashCommandsProps> = ({
---
### 6. ActionBar(结果操作栏)
### 6. ActionBar(结果æ“<EFBFBD>作æ <EFBFBD>ï¼?
```tsx
// components/ActionBar/index.tsx
@@ -623,7 +623,7 @@ export function useConversation(conversationId?: string): UseConversationReturn
}
}, [conversationId]);
// 发送消息(流式)
// å<EFBFBD>é€<EFBFBD>消æ<EFBFBD>¯ï¼ˆæµ<EFBFBD>å¼<EFBFBD>ï¼?
const sendMessage = async (content: string, attachmentIds?: string[]) => {
setIsLoading(true);
@@ -637,7 +637,7 @@ export function useConversation(conversationId?: string): UseConversationReturn
};
setMessages(prev => [...prev, userMessage]);
// 初始化 AI 消息
// åˆ<EFBFBD>å§åŒ?AI 消æ<CB86>¯
const aiMessage: Message = {
id: `temp-ai-${Date.now()}`,
role: 'assistant',
@@ -769,7 +769,7 @@ export function useStreamMessage() {
---
## 📱 响应式设计
## 📱 å“<C3A5>应å¼<C3A5>设è®?
### 断点策略
@@ -783,19 +783,19 @@ const breakpoints = {
};
```
### Dashboard 响应式
### Dashboard å“<EFBFBD>应å¼?
| 断点 | 布局 |
|------|------|
| `< 768px` | æµ<C3A6>水线纵å<C2B5>滚动,å<C592>¡ç‰‡å<E280A1>•列 |
| `768px` | 流水线横向 5 列 |
| `â‰?768px` | æµ<EFBFBD>水线横å<EFBFBD>?5 åˆ?|
### Workspace 响应式
### Workspace å“<EFBFBD>应å¼?
| 断点 | 布局 |
|------|------|
| `< 768px` | ä¾§è¾¹æ <C3A6>éš<C3A9>è—<C3A8>(抽屉æ»å‡ºï¼‰ï¼Œè¾“入框键ç˜é€é…<C3A9> |
| `768px` | 侧边栏固定显示 240px |
| `â‰?768px` | ä¾§è¾¹æ <EFBFBD>åºå®šæ˜¾ç¤?240px |
---
@@ -883,3 +883,4 @@ export interface SlashCommand {