diff --git a/web/src/app/AppLayout.tsx b/web/src/app/AppLayout.tsx index 76f8aad..e018204 100644 --- a/web/src/app/AppLayout.tsx +++ b/web/src/app/AppLayout.tsx @@ -4,6 +4,7 @@ import { useState } from 'react' import { NavLink, Outlet } from 'react-router-dom' import { Button } from '../components/ui/button' +import { SessionList } from '../features/chat/SessionList' import { cn } from '../lib/utils' function Navigation({ onNavigate }: { onNavigate?: () => void }) { @@ -22,6 +23,7 @@ function Navigation({ onNavigate }: { onNavigate?: () => void }) { 文档资料库 +
严格知识库模式回答必须引用已索引资料
diff --git a/web/src/app/router.tsx b/web/src/app/router.tsx index 6e71c75..44ac9fd 100644 --- a/web/src/app/router.tsx +++ b/web/src/app/router.tsx @@ -1,7 +1,7 @@ import { Navigate, createBrowserRouter } from 'react-router-dom' import { AppLayout } from './AppLayout' -import { PlaceholderPage } from './PlaceholderPage' +import { ChatPage } from '../features/chat/ChatPage' import { DocumentsPage } from '../features/documents/DocumentsPage' export const router = createBrowserRouter([ @@ -10,8 +10,8 @@ export const router = createBrowserRouter([ element: , children: [ { index: true, element: }, - { path: 'chat', element: }, - { path: 'chat/:sessionId', element: }, + { path: 'chat', element: }, + { path: 'chat/:sessionId', element: }, { path: 'documents', element: }, { path: 'documents/:documentId', element: }, ], diff --git a/web/src/features/chat/ChatComposer.tsx b/web/src/features/chat/ChatComposer.tsx new file mode 100644 index 0000000..ba9334c --- /dev/null +++ b/web/src/features/chat/ChatComposer.tsx @@ -0,0 +1,22 @@ +import { SendHorizontal, Square } from 'lucide-react' +import { useState } from 'react' + +import { Button } from '../../components/ui/button' + +type Props = { streaming: boolean; onSend: (query: string) => void; onCancel: () => void } + +export function ChatComposer({ streaming, onSend, onCancel }: Props) { + const [query, setQuery] = useState('') + function submit() { + const value = query.trim() + if (!value || streaming) return + setQuery(''); onSend(value) + } + return ( +
+