feat(ui): 创建共享 UI 组件包
将 web 和 desktop 的重复代码抽取到 @ai-assistant/ui 包: - 添加可配置的 API 客户端 (configureApiClient) - 迁移共享组件: ChatMessage, ChatInput, Sidebar, FileBrowser, ConfigPanel - 迁移共享 hook: useChat - 添加 responsive prop 支持响应式布局 - 更新 web/desktop 依赖并删除重复代码
This commit is contained in:
@@ -4,16 +4,21 @@
|
||||
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { Wifi, WifiOff } from 'lucide-react';
|
||||
import { useChat } from '../hooks/useChat';
|
||||
import { ChatMessage, StreamingMessage, TypingIndicator } from '../components/ChatMessage';
|
||||
import { ChatInput } from '../components/ChatInput';
|
||||
import {
|
||||
useChat,
|
||||
ChatMessage,
|
||||
StreamingMessage,
|
||||
TypingIndicator,
|
||||
ChatInput,
|
||||
} from '@ai-assistant/ui';
|
||||
|
||||
interface ChatPageProps {
|
||||
sessionId: string;
|
||||
onSessionNotFound?: () => void;
|
||||
responsive?: boolean;
|
||||
}
|
||||
|
||||
export function ChatPage({ sessionId, onSessionNotFound }: ChatPageProps) {
|
||||
export function ChatPage({ sessionId, onSessionNotFound, responsive = false }: ChatPageProps) {
|
||||
const {
|
||||
messages,
|
||||
isConnected,
|
||||
@@ -86,6 +91,7 @@ export function ChatPage({ sessionId, onSessionNotFound }: ChatPageProps) {
|
||||
onCancel={cancelProcessing}
|
||||
isLoading={isLoading}
|
||||
disabled={!isConnected}
|
||||
responsive={responsive}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user