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:
78
frontend-v2/src/modules/aia/components/AgentCard.tsx
Normal file
78
frontend-v2/src/modules/aia/components/AgentCard.tsx
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* AgentCard - 智能体卡片组件
|
||||
*
|
||||
* 100%还原原型图V11的卡片设计:
|
||||
* - 背景色: #F6F9FF (蓝色系) / #F0FDFA (青色系-工具)
|
||||
* - 边框: #E0E7FF / #CCFBF1
|
||||
* - 圆角: 10px
|
||||
* - 内边距: 14px
|
||||
* - 最小高度: 145px
|
||||
* - 序号水印
|
||||
* - 悬停效果
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import * as LucideIcons from 'lucide-react';
|
||||
import type { AgentConfig } from '../types';
|
||||
import '../styles/agent-card.css';
|
||||
|
||||
interface AgentCardProps {
|
||||
agent: AgentConfig;
|
||||
onClick: (agent: AgentConfig) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态获取 Lucide 图标
|
||||
*/
|
||||
const getIcon = (iconName: string): React.ComponentType<any> => {
|
||||
// 转换为 PascalCase
|
||||
const pascalCase = iconName
|
||||
.split('-')
|
||||
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
||||
.join('');
|
||||
|
||||
return (LucideIcons as any)[pascalCase] || LucideIcons.HelpCircle;
|
||||
};
|
||||
|
||||
export const AgentCard: React.FC<AgentCardProps> = ({ agent, onClick }) => {
|
||||
const Icon = getIcon(agent.icon);
|
||||
const orderStr = String(agent.order).padStart(2, '0');
|
||||
|
||||
const handleClick = () => {
|
||||
if (agent.isTool && agent.toolUrl) {
|
||||
// 工具类:跳转外部链接
|
||||
window.location.href = agent.toolUrl;
|
||||
} else {
|
||||
onClick(agent);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`agent-card theme-${agent.theme} ${agent.isTool ? 'tool-card' : ''}`}
|
||||
onClick={handleClick}
|
||||
>
|
||||
{/* 工具类:右上角跳转图标 */}
|
||||
{agent.isTool && (
|
||||
<LucideIcons.ExternalLink className="link-icon" />
|
||||
)}
|
||||
|
||||
{/* 头部:图标 + 标题 + 序号 */}
|
||||
<div className="card-header">
|
||||
<div className="card-header-left">
|
||||
<div className="icon-box">
|
||||
<Icon className="agent-icon" />
|
||||
</div>
|
||||
<h3 className="card-title">{agent.name}</h3>
|
||||
</div>
|
||||
<span className="num-watermark">{orderStr}</span>
|
||||
</div>
|
||||
|
||||
{/* 描述文本 */}
|
||||
<p className="desc-text">{agent.description}</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AgentCard;
|
||||
|
||||
143
frontend-v2/src/modules/aia/components/AgentHub.tsx
Normal file
143
frontend-v2/src/modules/aia/components/AgentHub.tsx
Normal file
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* AgentHub - 智能体大厅主界面
|
||||
*
|
||||
* 100%还原原型图V11:
|
||||
* - 最大宽度 760px,居中
|
||||
* - 头部搜索框
|
||||
* - 时间轴设计(左侧序号圆点+连接线)
|
||||
* - 5个阶段,12个智能体卡片
|
||||
*/
|
||||
|
||||
import React, { useState, useMemo } from 'react';
|
||||
import { BrainCircuit, Search } from 'lucide-react';
|
||||
import { AgentCard } from './AgentCard';
|
||||
import { AGENTS, PHASES } from '../constants';
|
||||
import type { AgentConfig } from '../types';
|
||||
import '../styles/agent-hub.css';
|
||||
|
||||
interface AgentHubProps {
|
||||
onAgentSelect: (agent: AgentConfig) => void;
|
||||
}
|
||||
|
||||
export const AgentHub: React.FC<AgentHubProps> = ({ onAgentSelect }) => {
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
|
||||
// 按阶段分组智能体
|
||||
const agentsByPhase = useMemo(() => {
|
||||
const grouped: Record<number, AgentConfig[]> = {};
|
||||
AGENTS.forEach(agent => {
|
||||
if (!grouped[agent.phase]) {
|
||||
grouped[agent.phase] = [];
|
||||
}
|
||||
grouped[agent.phase].push(agent);
|
||||
});
|
||||
return grouped;
|
||||
}, []);
|
||||
|
||||
// 搜索提交
|
||||
const handleSearch = () => {
|
||||
if (searchValue.trim()) {
|
||||
// 默认进入第一个智能体并携带搜索内容
|
||||
const firstAgent = AGENTS[0];
|
||||
onAgentSelect({ ...firstAgent, initialQuery: searchValue } as any);
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyDown = (e: React.KeyboardEvent) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleSearch();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="agent-hub">
|
||||
{/* 主体内容 */}
|
||||
<main className="hub-main">
|
||||
{/* 头部搜索区 */}
|
||||
<div className="hub-header">
|
||||
<div className="header-title">
|
||||
<div className="title-icon">
|
||||
<BrainCircuit size={24} />
|
||||
</div>
|
||||
<h1 className="title-text">
|
||||
医学研究专属大模型
|
||||
<span className="title-badge">已接入DeepSeek</span>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div className="search-box">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="输入研究想法,例如:SGLT2抑制剂对心衰患者预后的影响..."
|
||||
value={searchValue}
|
||||
onChange={(e) => setSearchValue(e.target.value)}
|
||||
onKeyDown={handleKeyDown}
|
||||
className="search-input"
|
||||
/>
|
||||
<button className="search-btn" onClick={handleSearch}>
|
||||
<Search size={20} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 流水线模块 */}
|
||||
<div className="pipeline-container">
|
||||
{PHASES.map((phase, phaseIndex) => {
|
||||
const isLast = phaseIndex === PHASES.length - 1;
|
||||
const agents = agentsByPhase[phase.phase] || [];
|
||||
|
||||
// 根据阶段确定列数
|
||||
let gridCols = 'grid-cols-3';
|
||||
if (phase.phase === 2) gridCols = 'grid-cols-3'; // 4个卡片,每行3个
|
||||
if (phase.phase === 3) gridCols = 'grid-cols-3'; // 1个卡片
|
||||
if (phase.phase === 4) gridCols = 'grid-cols-3'; // 2个卡片
|
||||
if (phase.phase === 5) gridCols = 'grid-cols-3'; // 2个卡片
|
||||
|
||||
return (
|
||||
<div
|
||||
key={phase.phase}
|
||||
className={`pipeline-stage ${isLast ? 'last-stage' : ''}`}
|
||||
>
|
||||
{/* 左侧时间轴 */}
|
||||
<div className="timeline-marker">
|
||||
<div className={`timeline-dot theme-${phase.theme}`}>
|
||||
{phase.phase}
|
||||
</div>
|
||||
{!isLast && <div className="timeline-line" />}
|
||||
</div>
|
||||
|
||||
{/* 阶段内容 */}
|
||||
<div className="stage-content">
|
||||
<h2 className="stage-title">
|
||||
{phase.name}
|
||||
{phase.isTool && (
|
||||
<span className="tool-badge">工具</span>
|
||||
)}
|
||||
</h2>
|
||||
|
||||
<div className={`agents-grid ${gridCols}`}>
|
||||
{agents.map(agent => (
|
||||
<AgentCard
|
||||
key={agent.id}
|
||||
agent={agent}
|
||||
onClick={onAgentSelect}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
{/* 底部 */}
|
||||
<footer className="hub-footer">
|
||||
<p>© 2025 临床研究平台 - 医学研究专属大模型</p>
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AgentHub;
|
||||
|
||||
465
frontend-v2/src/modules/aia/components/ChatWorkspace.tsx
Normal file
465
frontend-v2/src/modules/aia/components/ChatWorkspace.tsx
Normal file
@@ -0,0 +1,465 @@
|
||||
/**
|
||||
* ChatWorkspace - 沉浸式对话工作台
|
||||
*
|
||||
* 参考原型图V2,结合 Ant Design X 能力:
|
||||
* - 左侧边栏:会话列表
|
||||
* - 头部:智能体信息
|
||||
* - 消息区:流式响应 + 深度思考
|
||||
* - 输入区:附件上传
|
||||
*/
|
||||
|
||||
import React, { useState, useCallback, useEffect, useRef } from 'react';
|
||||
import {
|
||||
ChevronLeft,
|
||||
Plus,
|
||||
Menu,
|
||||
X,
|
||||
Download,
|
||||
Paperclip,
|
||||
Lightbulb,
|
||||
} from 'lucide-react';
|
||||
import * as LucideIcons from 'lucide-react';
|
||||
import { useAIStream } from '@/shared/components/Chat';
|
||||
import { ThinkingBlock } from '@/shared/components/Chat';
|
||||
import { getAccessToken } from '@/framework/auth/api';
|
||||
import { AGENTS, AGENT_PROMPTS, BRAND_COLORS } from '../constants';
|
||||
import type { AgentConfig, Conversation, Message } from '../types';
|
||||
import '../styles/chat-workspace.css';
|
||||
|
||||
interface ChatWorkspaceProps {
|
||||
agent: AgentConfig;
|
||||
initialQuery?: string;
|
||||
onBack: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态获取图标
|
||||
*/
|
||||
const getIcon = (iconName: string): React.ComponentType<any> => {
|
||||
const pascalCase = iconName
|
||||
.split('-')
|
||||
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
||||
.join('');
|
||||
return (LucideIcons as any)[pascalCase] || LucideIcons.Bot;
|
||||
};
|
||||
|
||||
export const ChatWorkspace: React.FC<ChatWorkspaceProps> = ({
|
||||
agent,
|
||||
initialQuery,
|
||||
onBack,
|
||||
}) => {
|
||||
const [sidebarOpen, setSidebarOpen] = useState(false);
|
||||
const [conversations, setConversations] = useState<Conversation[]>([]);
|
||||
const [currentConversationId, setCurrentConversationId] = useState<string | null>(null);
|
||||
const [isCreatingConversation, setIsCreatingConversation] = useState(false);
|
||||
const [messages, setMessages] = useState<Message[]>([]);
|
||||
const [inputValue, setInputValue] = useState('');
|
||||
const [deepThinkingEnabled, setDeepThinkingEnabled] = useState(true);
|
||||
const messagesEndRef = useRef<HTMLDivElement>(null);
|
||||
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
||||
|
||||
const AgentIcon = getIcon(agent.icon);
|
||||
const themeColor = BRAND_COLORS[agent.theme];
|
||||
|
||||
// 获取欢迎语
|
||||
const welcomePrompt = AGENT_PROMPTS[agent.id] || '有什么可以帮您的?';
|
||||
|
||||
// 流式响应 Hook(仅在有对话时初始化)
|
||||
const {
|
||||
content: streamContent,
|
||||
thinking: streamThinking,
|
||||
status: streamStatus,
|
||||
isStreaming,
|
||||
isThinking,
|
||||
error: streamError,
|
||||
sendMessage: sendStreamMessage,
|
||||
abort,
|
||||
} = useAIStream({
|
||||
apiEndpoint: currentConversationId
|
||||
? `/api/v1/aia/conversations/${currentConversationId}/messages/stream`
|
||||
: '',
|
||||
headers: {
|
||||
Authorization: `Bearer ${getAccessToken()}`,
|
||||
},
|
||||
});
|
||||
|
||||
// 创建对话
|
||||
const createConversation = useCallback(async () => {
|
||||
if (isCreatingConversation) return null;
|
||||
|
||||
setIsCreatingConversation(true);
|
||||
try {
|
||||
const token = getAccessToken();
|
||||
const response = await fetch('/api/v1/aia/conversations', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
agentId: agent.id,
|
||||
title: '新对话',
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`创建对话失败: ${response.status}`);
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
const newConv: Conversation = {
|
||||
id: result.data.id,
|
||||
agentId: result.data.agentId,
|
||||
title: result.data.title,
|
||||
createdAt: new Date(result.data.createdAt),
|
||||
updatedAt: new Date(result.data.updatedAt),
|
||||
};
|
||||
|
||||
setConversations(prev => [newConv, ...prev]);
|
||||
setCurrentConversationId(newConv.id);
|
||||
return newConv.id;
|
||||
} catch (error) {
|
||||
console.error('[ChatWorkspace] 创建对话失败:', error);
|
||||
return null;
|
||||
} finally {
|
||||
setIsCreatingConversation(false);
|
||||
}
|
||||
}, [agent.id, isCreatingConversation]);
|
||||
|
||||
// 初始化:自动创建对话
|
||||
useEffect(() => {
|
||||
if (!currentConversationId && !isCreatingConversation) {
|
||||
createConversation();
|
||||
}
|
||||
}, [currentConversationId, isCreatingConversation, createConversation]);
|
||||
|
||||
// 滚动到底部
|
||||
const scrollToBottom = useCallback(() => {
|
||||
setTimeout(() => {
|
||||
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
|
||||
}, 100);
|
||||
}, []);
|
||||
|
||||
// 切换侧边栏
|
||||
const toggleSidebar = useCallback(() => {
|
||||
setSidebarOpen(prev => !prev);
|
||||
}, []);
|
||||
|
||||
// 新建对话
|
||||
const handleNewChat = useCallback(async () => {
|
||||
const convId = await createConversation();
|
||||
if (convId) {
|
||||
setMessages([]);
|
||||
setInputValue('');
|
||||
setSidebarOpen(false);
|
||||
}
|
||||
}, [createConversation]);
|
||||
|
||||
// 发送消息
|
||||
const handleSend = useCallback(async () => {
|
||||
const content = inputValue.trim();
|
||||
if (!content || isStreaming) return;
|
||||
|
||||
// 确保有对话 ID
|
||||
let convId = currentConversationId;
|
||||
if (!convId) {
|
||||
convId = await createConversation();
|
||||
if (!convId) {
|
||||
console.error('[ChatWorkspace] 创建对话失败');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加用户消息
|
||||
const userMessage: Message = {
|
||||
id: `user-${Date.now()}`,
|
||||
role: 'user',
|
||||
content,
|
||||
createdAt: new Date(),
|
||||
};
|
||||
setMessages(prev => [...prev, userMessage]);
|
||||
setInputValue('');
|
||||
|
||||
// 重置 textarea 高度
|
||||
if (textareaRef.current) {
|
||||
textareaRef.current.style.height = 'auto';
|
||||
}
|
||||
|
||||
// 添加 AI 消息占位
|
||||
const aiMessageId = `ai-${Date.now()}`;
|
||||
const aiMessage: Message = {
|
||||
id: aiMessageId,
|
||||
role: 'assistant',
|
||||
content: '',
|
||||
thinking: '',
|
||||
createdAt: new Date(),
|
||||
};
|
||||
setMessages(prev => [...prev, aiMessage]);
|
||||
|
||||
// 调用流式API
|
||||
const result = await sendStreamMessage(content, {
|
||||
conversationId: convId,
|
||||
agentId: agent.id,
|
||||
enableDeepThinking: deepThinkingEnabled,
|
||||
});
|
||||
|
||||
// 更新对话标题
|
||||
if (conversations.find(c => c.id === convId)?.title === '新对话') {
|
||||
const title = content.length > 20 ? content.slice(0, 20) + '...' : content;
|
||||
setConversations(prev =>
|
||||
prev.map(c =>
|
||||
c.id === convId
|
||||
? { ...c, title, updatedAt: new Date() }
|
||||
: c
|
||||
)
|
||||
);
|
||||
}
|
||||
}, [inputValue, isStreaming, currentConversationId, agent.id, deepThinkingEnabled, conversations, sendStreamMessage, createConversation]);
|
||||
|
||||
// 处理键盘事件
|
||||
const handleKeyDown = useCallback((e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
handleSend();
|
||||
}
|
||||
}, [handleSend]);
|
||||
|
||||
// 自动调整 textarea 高度
|
||||
const handleInputChange = useCallback((e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
||||
setInputValue(e.target.value);
|
||||
e.target.style.height = 'auto';
|
||||
e.target.style.height = e.target.scrollHeight + 'px';
|
||||
}, []);
|
||||
|
||||
// 更新流式消息
|
||||
useEffect(() => {
|
||||
if (streamContent || streamThinking) {
|
||||
setMessages(prev => {
|
||||
const lastMsg = prev[prev.length - 1];
|
||||
if (lastMsg && lastMsg.role === 'assistant') {
|
||||
return [
|
||||
...prev.slice(0, -1),
|
||||
{
|
||||
...lastMsg,
|
||||
content: streamContent,
|
||||
thinking: streamThinking,
|
||||
},
|
||||
];
|
||||
}
|
||||
return prev;
|
||||
});
|
||||
}
|
||||
}, [streamContent, streamThinking]);
|
||||
|
||||
// 消息变化时滚动
|
||||
useEffect(() => {
|
||||
scrollToBottom();
|
||||
}, [messages, scrollToBottom]);
|
||||
|
||||
// 切换深度思考
|
||||
const toggleDeepThinking = useCallback(() => {
|
||||
setDeepThinkingEnabled(prev => !prev);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="chat-workspace">
|
||||
{/* 移动端遮罩 */}
|
||||
{sidebarOpen && (
|
||||
<div className="mobile-overlay" onClick={toggleSidebar} />
|
||||
)}
|
||||
|
||||
{/* 左侧边栏 */}
|
||||
<aside className={`workspace-sidebar ${sidebarOpen ? 'open' : ''}`}>
|
||||
{/* 边栏头部 */}
|
||||
<div className="sidebar-header">
|
||||
<button className="back-btn" onClick={onBack}>
|
||||
<ChevronLeft size={20} />
|
||||
<span>返回大厅</span>
|
||||
</button>
|
||||
<button className="close-sidebar-btn" onClick={toggleSidebar}>
|
||||
<X size={20} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* 新建对话按钮 */}
|
||||
<div className="sidebar-new">
|
||||
<button className="new-chat-btn" onClick={handleNewChat}>
|
||||
<Plus size={16} />
|
||||
新建对话
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* 历史记录 */}
|
||||
<div className="sidebar-history">
|
||||
<div className="history-group">
|
||||
<div className="history-label">Today</div>
|
||||
{conversations.map(conv => (
|
||||
<button
|
||||
key={conv.id}
|
||||
className={`history-item ${currentConversationId === conv.id ? 'active' : ''}`}
|
||||
onClick={() => {
|
||||
if (currentConversationId !== conv.id) {
|
||||
setCurrentConversationId(conv.id);
|
||||
setMessages([]); // 清空消息,后续可加载历史消息
|
||||
setInputValue('');
|
||||
}
|
||||
setSidebarOpen(false);
|
||||
}}
|
||||
>
|
||||
{conv.title}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 用户信息 */}
|
||||
<div className="sidebar-user">
|
||||
<div className="user-avatar">U</div>
|
||||
<div className="user-info">
|
||||
<div className="user-name">Dr. Wang</div>
|
||||
<div className="user-plan">专业版会员</div>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
{/* 主对话区 */}
|
||||
<main className="workspace-main">
|
||||
{/* 头部 */}
|
||||
<header className="workspace-header">
|
||||
<div className="header-left">
|
||||
<button className="menu-btn" onClick={toggleSidebar}>
|
||||
<Menu size={20} />
|
||||
</button>
|
||||
<div
|
||||
className="agent-icon-box"
|
||||
style={{ backgroundColor: themeColor }}
|
||||
>
|
||||
<AgentIcon size={20} color="white" />
|
||||
</div>
|
||||
<div className="agent-info">
|
||||
<h2 className="agent-name">{agent.name}</h2>
|
||||
<div className="agent-status">
|
||||
<span className="status-dot" />
|
||||
<span className="status-text">Online</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="header-right">
|
||||
<button className="header-action" title="导出对话">
|
||||
<Download size={16} />
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{/* 对话区域 - 自定义布局 */}
|
||||
<div className="workspace-chat-container">
|
||||
{/* 消息区域 */}
|
||||
<div className="workspace-messages">
|
||||
{/* 欢迎消息(左上角,类似消息气泡) */}
|
||||
{messages.length === 0 && (
|
||||
<div className="welcome-card-container">
|
||||
<div className="welcome-icon" style={{ backgroundColor: themeColor }}>
|
||||
<AgentIcon size={20} color="white" />
|
||||
</div>
|
||||
<div className="welcome-card">
|
||||
<p className="welcome-text">{welcomePrompt}</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 加载中提示 */}
|
||||
{!currentConversationId && isCreatingConversation && (
|
||||
<div className="loading-container">
|
||||
<div className="loading-spinner">正在初始化对话...</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 消息列表 */}
|
||||
{currentConversationId && messages.map((msg, index) => (
|
||||
<div key={msg.id} className={`message-item ${msg.role}`}>
|
||||
{msg.role === 'assistant' && (
|
||||
<div className="message-avatar" style={{ backgroundColor: themeColor }}>
|
||||
<AgentIcon size={20} color="white" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="message-content-wrapper">
|
||||
{/* 深度思考块 */}
|
||||
{msg.role === 'assistant' && (msg.thinking || isThinking) && index === messages.length - 1 && (
|
||||
<ThinkingBlock
|
||||
content={streamThinking || msg.thinking || ''}
|
||||
isThinking={isThinking}
|
||||
defaultExpanded={true}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* 消息内容 */}
|
||||
<div className={`message-bubble ${msg.role}`}>
|
||||
{msg.content}
|
||||
{msg.role === 'assistant' && isStreaming && index === messages.length - 1 && (
|
||||
<span className="typing-cursor">▊</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{msg.role === 'user' && (
|
||||
<div className="message-avatar user-avatar">U</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
|
||||
<div ref={messagesEndRef} />
|
||||
</div>
|
||||
|
||||
{/* 输入区域(靠下) */}
|
||||
<div className="workspace-input-area">
|
||||
{/* 深度思考按钮 */}
|
||||
<div className="input-toolbar">
|
||||
<button
|
||||
className={`deep-thinking-btn ${deepThinkingEnabled ? 'active' : ''}`}
|
||||
onClick={toggleDeepThinking}
|
||||
>
|
||||
<Lightbulb size={14} />
|
||||
深度思考
|
||||
</button>
|
||||
<button className="attachment-btn">
|
||||
<Paperclip size={16} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* 输入框 */}
|
||||
<div className="input-box">
|
||||
<textarea
|
||||
ref={textareaRef}
|
||||
className="chat-textarea"
|
||||
placeholder="输入问题,或使用 / 呼出快捷指令..."
|
||||
rows={1}
|
||||
value={inputValue}
|
||||
onChange={handleInputChange}
|
||||
onKeyDown={handleKeyDown}
|
||||
disabled={isStreaming}
|
||||
/>
|
||||
<button
|
||||
className="send-btn"
|
||||
onClick={handleSend}
|
||||
disabled={!inputValue.trim() || isStreaming}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
||||
<circle cx="12" cy="12" r="10"></circle>
|
||||
<path d="m16 12-4-4-4 4"></path>
|
||||
<path d="M12 16V8"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* 底部提示 */}
|
||||
<p className="input-hint">内容由 AI 生成,需经过专业人员核实。支持 Markdown 公式与表格。</p>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ChatWorkspace;
|
||||
|
||||
8
frontend-v2/src/modules/aia/components/index.ts
Normal file
8
frontend-v2/src/modules/aia/components/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* AIA 模块组件导出
|
||||
*/
|
||||
|
||||
export { AgentHub } from './AgentHub';
|
||||
export { AgentCard } from './AgentCard';
|
||||
export { ChatWorkspace } from './ChatWorkspace';
|
||||
|
||||
172
frontend-v2/src/modules/aia/constants.ts
Normal file
172
frontend-v2/src/modules/aia/constants.ts
Normal file
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* AIA 模块常量配置
|
||||
*
|
||||
* 12个智能体模块配置(100%还原原型图V11)
|
||||
*/
|
||||
|
||||
import type { AgentConfig, PhaseConfig } from './types';
|
||||
|
||||
/**
|
||||
* 阶段配置
|
||||
*/
|
||||
export const PHASES: PhaseConfig[] = [
|
||||
{ phase: 1, name: '选题优化智能体', theme: 'blue' },
|
||||
{ phase: 2, name: '方案设计智能体', theme: 'blue' },
|
||||
{ phase: 3, name: '方案预评审', theme: 'yellow' },
|
||||
{ phase: 4, name: '数据处理与统计分析', theme: 'teal', isTool: true },
|
||||
{ phase: 5, name: '写作助手', theme: 'purple' },
|
||||
];
|
||||
|
||||
/**
|
||||
* 12个智能体配置
|
||||
*/
|
||||
export const AGENTS: AgentConfig[] = [
|
||||
// Phase 1: 选题优化智能体 (3个,每行3个)
|
||||
{
|
||||
id: 'TOPIC_01',
|
||||
name: '科学问题梳理',
|
||||
icon: 'list-tree',
|
||||
description: '从科学问题的清晰度、系统性、可验证性等角度使用科学理论对您的科学问题进行全面的评价。',
|
||||
theme: 'blue',
|
||||
phase: 1,
|
||||
order: 1,
|
||||
},
|
||||
{
|
||||
id: 'TOPIC_02',
|
||||
name: 'PICO 梳理',
|
||||
icon: 'target',
|
||||
description: '基于科学问题梳理研究对象、干预(暴露)、对照和结局指标,并评价并给出合理化的建议。',
|
||||
theme: 'blue',
|
||||
phase: 1,
|
||||
order: 2,
|
||||
},
|
||||
{
|
||||
id: 'TOPIC_03',
|
||||
name: '选题评价',
|
||||
icon: 'clipboard-check',
|
||||
description: '从创新性、临床价值、科学性和可行性等方面使用科学理论对您的临床问题进行全面的评价。',
|
||||
theme: 'blue',
|
||||
phase: 1,
|
||||
order: 3,
|
||||
},
|
||||
|
||||
// Phase 2: 方案设计智能体 (4个,每行3个)
|
||||
{
|
||||
id: 'DESIGN_04',
|
||||
name: '观察指标设计',
|
||||
icon: 'eye',
|
||||
description: '基于研究设计和因果关系提供可能的观察指标集。',
|
||||
theme: 'blue',
|
||||
phase: 2,
|
||||
order: 4,
|
||||
},
|
||||
{
|
||||
id: 'DESIGN_05',
|
||||
name: '病例报告表设计',
|
||||
icon: 'table',
|
||||
description: '基于研究方案设计梳理观察指标集并给出建议的病例报告表框架。',
|
||||
theme: 'blue',
|
||||
phase: 2,
|
||||
order: 5,
|
||||
},
|
||||
{
|
||||
id: 'DESIGN_06',
|
||||
name: '样本量计算',
|
||||
icon: 'calculator',
|
||||
description: '基于研究阶段和研究设计为研究提供科学合理的样本量估算结果。',
|
||||
theme: 'blue',
|
||||
phase: 2,
|
||||
order: 6,
|
||||
},
|
||||
{
|
||||
id: 'DESIGN_07',
|
||||
name: '临床研究方案撰写',
|
||||
icon: 'file-text',
|
||||
description: '基于科学问题、PICOS等信息,给出一个初步的临床研究设计方案,请尽量多给一些信息和需求。',
|
||||
theme: 'blue',
|
||||
phase: 2,
|
||||
order: 7,
|
||||
},
|
||||
|
||||
// Phase 3: 方案预评审 (1个)
|
||||
{
|
||||
id: 'REVIEW_08',
|
||||
name: '方法学评审智能体',
|
||||
icon: 'shield-check',
|
||||
description: '从研究问题、研究方案和临床意义方面,对研究进行临床研究方法学的全面评价。',
|
||||
theme: 'yellow',
|
||||
phase: 3,
|
||||
order: 8,
|
||||
},
|
||||
|
||||
// Phase 4: 数据处理与统计分析 (2个,工具类)
|
||||
{
|
||||
id: 'TOOL_09',
|
||||
name: '数据评价与预处理',
|
||||
icon: 'database',
|
||||
description: '对现有数据的质量进行自动评价,并给出数据质量报告,包括缺失值、异常值、定量分析等。',
|
||||
theme: 'teal',
|
||||
phase: 4,
|
||||
order: 9,
|
||||
isTool: true,
|
||||
toolUrl: '/dc',
|
||||
},
|
||||
{
|
||||
id: 'TOOL_10',
|
||||
name: '智能统计分析',
|
||||
icon: 'bar-chart-2',
|
||||
description: '内置3条智能研究路径(队列研究、预测模型、RCT研究),以及近百种统计分析工具。',
|
||||
theme: 'teal',
|
||||
phase: 4,
|
||||
order: 10,
|
||||
isTool: true,
|
||||
toolUrl: '/dc/analysis',
|
||||
},
|
||||
|
||||
// Phase 5: 写作助手 (2个)
|
||||
{
|
||||
id: 'WRITING_11',
|
||||
name: '论文润色',
|
||||
icon: 'pen-tool',
|
||||
description: '结合目标杂志,提供专业化的润色服务,给出合理化的修改建议。',
|
||||
theme: 'purple',
|
||||
phase: 5,
|
||||
order: 11,
|
||||
},
|
||||
{
|
||||
id: 'WRITING_12',
|
||||
name: '论文翻译',
|
||||
icon: 'languages',
|
||||
description: '结合目标杂志,提供专业化的翻译并进行润色,给出合理化的修改建议。',
|
||||
theme: 'purple',
|
||||
phase: 5,
|
||||
order: 12,
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* 智能体欢迎语配置
|
||||
*/
|
||||
export const AGENT_PROMPTS: Record<string, string> = {
|
||||
'TOPIC_01': '你好!我是**科学问题梳理助手**。请告诉我你感兴趣的研究方向,我将从科学性、创新性等维度帮你梳理。',
|
||||
'TOPIC_02': '你好!我是**PICO梳理助手**。请描述你的研究想法,我来帮你拆解为 P (人群)、I (干预)、C (对照)、O (结局)。',
|
||||
'TOPIC_03': '你好!我是**选题评价助手**。请提供你的初步选题,我将从创新性、临床价值等方面进行评估。',
|
||||
'DESIGN_04': '你好!我是**观察指标设计助手**。请告诉我你的研究目的,我来帮你推荐主要和次要观察指标。',
|
||||
'DESIGN_05': '你好!我是**CRF设计助手**。我可以帮你构建病例报告表的框架。',
|
||||
'DESIGN_06': '你好!需要计算样本量吗?请告诉我研究类型(如RCT、队列研究)和主要指标的预期值。',
|
||||
'DESIGN_07': '你好!欢迎来到**方案设计工作台**。我们将基于科学问题和PICOS信息,共同撰写一份完整的临床研究方案。',
|
||||
'REVIEW_08': '你好!我是**方法学评审助手**。请上传你的方案草稿,我将模拟审稿人视角进行方法学审查。',
|
||||
'WRITING_11': 'Please paste the text you want to polish. I will check grammar, flow, and academic tone.',
|
||||
'WRITING_12': '你好!请贴入需要翻译的段落,我将为你提供地道的学术英语翻译。',
|
||||
};
|
||||
|
||||
/**
|
||||
* 品牌配色
|
||||
*/
|
||||
export const BRAND_COLORS = {
|
||||
blue: '#4F6EF2',
|
||||
teal: '#0D9488',
|
||||
purple: '#9333EA',
|
||||
yellow: '#CA8A04',
|
||||
} as const;
|
||||
|
||||
@@ -1,30 +1,50 @@
|
||||
import Placeholder from '@/shared/components/Placeholder'
|
||||
/**
|
||||
* AIA - AI Intelligent Assistant 模块入口
|
||||
*
|
||||
* 视图管理:
|
||||
* - Hub: 智能体大厅(12个模块展示)
|
||||
* - Chat: 沉浸式对话工作台
|
||||
*/
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { AgentHub } from './components/AgentHub';
|
||||
import { ChatWorkspace } from './components/ChatWorkspace';
|
||||
import type { AgentConfig } from './types';
|
||||
|
||||
const AIAModule: React.FC = () => {
|
||||
const [currentView, setCurrentView] = useState<'hub' | 'chat'>('hub');
|
||||
const [selectedAgent, setSelectedAgent] = useState<AgentConfig | null>(null);
|
||||
const [initialQuery, setInitialQuery] = useState<string | undefined>();
|
||||
|
||||
// 选择智能体,进入对话
|
||||
const handleAgentSelect = (agent: AgentConfig & { initialQuery?: string }) => {
|
||||
setSelectedAgent(agent);
|
||||
setInitialQuery(agent.initialQuery);
|
||||
setCurrentView('chat');
|
||||
};
|
||||
|
||||
// 返回大厅
|
||||
const handleBack = () => {
|
||||
setCurrentView('hub');
|
||||
setSelectedAgent(null);
|
||||
setInitialQuery(undefined);
|
||||
};
|
||||
|
||||
const AIAModule = () => {
|
||||
return (
|
||||
<Placeholder
|
||||
title="AI智能问答模块"
|
||||
description="后续基于新架构重写,提供更好的用户体验"
|
||||
moduleName="AIA - AI Intelligent Assistant"
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default AIAModule
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<>
|
||||
{currentView === 'hub' && (
|
||||
<AgentHub onAgentSelect={handleAgentSelect} />
|
||||
)}
|
||||
|
||||
{currentView === 'chat' && selectedAgent && (
|
||||
<ChatWorkspace
|
||||
agent={selectedAgent}
|
||||
initialQuery={initialQuery}
|
||||
onBack={handleBack}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default AIAModule;
|
||||
|
||||
210
frontend-v2/src/modules/aia/styles/agent-card.css
Normal file
210
frontend-v2/src/modules/aia/styles/agent-card.css
Normal 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);
|
||||
}
|
||||
|
||||
292
frontend-v2/src/modules/aia/styles/agent-hub.css
Normal file
292
frontend-v2/src/modules/aia/styles/agent-hub.css
Normal 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;
|
||||
}
|
||||
}
|
||||
|
||||
644
frontend-v2/src/modules/aia/styles/chat-workspace.css
Normal file
644
frontend-v2/src/modules/aia/styles/chat-workspace.css
Normal 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;
|
||||
}
|
||||
|
||||
61
frontend-v2/src/modules/aia/types.ts
Normal file
61
frontend-v2/src/modules/aia/types.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* AIA 模块类型定义
|
||||
*/
|
||||
|
||||
/**
|
||||
* 智能体阶段主题色
|
||||
*/
|
||||
export type AgentTheme = 'blue' | 'yellow' | 'teal' | 'purple';
|
||||
|
||||
/**
|
||||
* 智能体配置
|
||||
*/
|
||||
export interface AgentConfig {
|
||||
id: string;
|
||||
name: string;
|
||||
icon: string;
|
||||
description: string;
|
||||
theme: AgentTheme;
|
||||
phase: number;
|
||||
order: number;
|
||||
isTool?: boolean; // 是否为工具类(跳转外部)
|
||||
toolUrl?: string; // 工具跳转地址
|
||||
}
|
||||
|
||||
/**
|
||||
* 阶段配置
|
||||
*/
|
||||
export interface PhaseConfig {
|
||||
phase: number;
|
||||
name: string;
|
||||
theme: AgentTheme;
|
||||
isTool?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 视图状态
|
||||
*/
|
||||
export type ViewState = 'hub' | 'chat';
|
||||
|
||||
/**
|
||||
* 会话
|
||||
*/
|
||||
export interface Conversation {
|
||||
id: string;
|
||||
agentId: string;
|
||||
title: string;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
export interface Message {
|
||||
id: string;
|
||||
role: 'user' | 'assistant';
|
||||
content: string;
|
||||
thinking?: string;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user