From 918816a2db92e121014a8836805fe6173c8c894a Mon Sep 17 00:00:00 2001 From: rdmclin2 Date: Sun, 21 Apr 2024 17:28:17 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20feat:=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E6=A8=A1=E5=BC=8F=E5=92=8C=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E7=9A=84=E8=BE=93=E5=85=A5=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/app/chat/ChatBot/index.tsx | 23 ------------ src/app/chat/ChatBot/style.ts | 12 ------- src/app/chat/VirtualIdol/index.tsx | 35 ------------------- src/app/chat/page.tsx | 20 ++++++++--- src/app/chat/{VirtualIdol => }/style.ts | 9 +++-- src/features/Actions/Edit.tsx | 4 +-- src/features/Actions/Video.tsx | 29 +++++++++++++++ src/features/ChatInfo/index.tsx | 2 -- src/features/ChatInput/MessageInput/index.tsx | 33 +++++++---------- 10 files changed, 67 insertions(+), 102 deletions(-) delete mode 100644 src/app/chat/ChatBot/index.tsx delete mode 100644 src/app/chat/ChatBot/style.ts delete mode 100644 src/app/chat/VirtualIdol/index.tsx rename src/app/chat/{VirtualIdol => }/style.ts (69%) create mode 100644 src/features/Actions/Video.tsx diff --git a/package.json b/package.json index 87af5b3..5989dbd 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "immer": "^10.0.4", "js-tiktoken": "^1.0.10", "lodash-es": "^4.17.21", - "lucide-react": "^0.294.0", + "lucide-react": "^0.308.0", "mmd-parser": "^1.0.4", "next": "^14.1.4", "next-pwa": "^5.6.0", diff --git a/src/app/chat/ChatBot/index.tsx b/src/app/chat/ChatBot/index.tsx deleted file mode 100644 index b55b54f..0000000 --- a/src/app/chat/ChatBot/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -'use client'; - -import React, { memo } from 'react'; - -import ChatInput from '@/features/ChatInput'; -import ChatList from '@/features/ChatList'; - -import { useStyles } from './style'; - -const Index = () => { - const { styles } = useStyles(); - - return ( -
-
- -
- -
- ); -}; - -export default memo(Index); diff --git a/src/app/chat/ChatBot/style.ts b/src/app/chat/ChatBot/style.ts deleted file mode 100644 index 0d9c586..0000000 --- a/src/app/chat/ChatBot/style.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { createStyles } from 'antd-style'; - -const useStyles = createStyles(({ css }) => ({ - chatBot: css` - display: flex; - flex-direction: column; - width: 100%; - height: 100%; - `, -})); - -export { useStyles }; diff --git a/src/app/chat/VirtualIdol/index.tsx b/src/app/chat/VirtualIdol/index.tsx deleted file mode 100644 index 49e29be..0000000 --- a/src/app/chat/VirtualIdol/index.tsx +++ /dev/null @@ -1,35 +0,0 @@ -'use client'; - -import React from 'react'; -import { Flexbox } from 'react-layout-kit'; - -import AgentViewer from '@/features/AgentViewer'; -import ChatDialog from '@/features/ChatDialog'; -import MessageInput from '@/features/ChatInput/MessageInput'; -import ImageViewer from '@/features/ImageViewer'; -import { useSessionStore } from '@/store/session'; - -import { useStyles } from './style'; - -const VirtualIdol = () => { - const [viewerMode] = useSessionStore((s) => [s.viewerMode]); - const { styles } = useStyles(); - - return ( - - - {viewerMode === true ? : } -
- -
请谨记:智能体所说的一切都是由 AI 生成的
-
-
- -
- ); -}; - -export default VirtualIdol; diff --git a/src/app/chat/page.tsx b/src/app/chat/page.tsx index 7da9e62..4460211 100644 --- a/src/app/chat/page.tsx +++ b/src/app/chat/page.tsx @@ -3,22 +3,34 @@ import React, { memo } from 'react'; import { Flexbox } from 'react-layout-kit'; -import ChatBot from '@/app/chat/ChatBot'; -import VirtualIdol from '@/app/chat/VirtualIdol'; +import AgentViewer from '@/features/AgentViewer'; +import ChatDialog from '@/features/ChatDialog'; import ChatHeader from '@/features/ChatHeader'; import ChatInfo from '@/features/ChatInfo'; +import MessageInput from '@/features/ChatInput/MessageInput'; +import ChatList from '@/features/ChatList'; import SessionList from '@/features/SessionList'; import { useSessionStore } from '@/store/session'; +import { useStyles } from './style'; + const Chat = () => { - const viewerMode = useSessionStore((s) => s.viewerMode); + const [viewerMode] = useSessionStore((s) => [s.viewerMode]); + const { styles } = useStyles(); return ( - {viewerMode ? : } + + {viewerMode === true ? : } + + +
请谨记:智能体所说的一切都是由 AI 生成的
+
+
+
diff --git a/src/app/chat/VirtualIdol/style.ts b/src/app/chat/style.ts similarity index 69% rename from src/app/chat/VirtualIdol/style.ts rename to src/app/chat/style.ts index d4c06be..632d55e 100644 --- a/src/app/chat/VirtualIdol/style.ts +++ b/src/app/chat/style.ts @@ -2,9 +2,12 @@ import { createStyles } from 'antd-style'; export const useStyles = createStyles(({ css, token }) => ({ docker: css` - display: inline-flex; - flex-direction: column; - align-items: center; + position: absolute; + bottom: 0; + left: 50%; + transform: translateX(-50%); + + max-width: 42vw; padding: 8px 12px; `, alert: css` diff --git a/src/features/Actions/Edit.tsx b/src/features/Actions/Edit.tsx index f585b33..bbe30ee 100644 --- a/src/features/Actions/Edit.tsx +++ b/src/features/Actions/Edit.tsx @@ -1,5 +1,5 @@ import { ActionIcon } from '@lobehub/ui'; -import { Edit2 } from 'lucide-react'; +import { SquarePen } from 'lucide-react'; import { useConfigStore } from '@/store/config'; @@ -8,7 +8,7 @@ export default () => { return ( { openPanel('role'); }} diff --git a/src/features/Actions/Video.tsx b/src/features/Actions/Video.tsx new file mode 100644 index 0000000..586cb9e --- /dev/null +++ b/src/features/Actions/Video.tsx @@ -0,0 +1,29 @@ +import { ActionIcon } from '@lobehub/ui'; +import { Video, VideoOff } from 'lucide-react'; + +import { useSessionStore } from '@/store/session'; + +export default () => { + const { viewerMode, setViewerMode } = useSessionStore((s) => ({ + setViewerMode: s.setViewerMode, + viewerMode: s.viewerMode, + })); + + return viewerMode ? ( + { + setViewerMode(false); + }} + title={'关闭视频通话'} + /> + ) : ( + { + setViewerMode(true); + }} + title={'视频通话'} + /> + ); +}; diff --git a/src/features/ChatInfo/index.tsx b/src/features/ChatInfo/index.tsx index 11d72d9..3d658ec 100644 --- a/src/features/ChatInfo/index.tsx +++ b/src/features/ChatInfo/index.tsx @@ -8,7 +8,6 @@ import AgentInfo from '@/components/AgentInfo'; import Dance from '@/features/Actions/Dance'; import Edit from '@/features/Actions/Edit'; import Log from '@/features/Actions/Log'; -import ViewerMode from '@/features/Actions/ViewerMode'; import Voice from '@/features/Actions/Voice'; import { sessionSelectors, useSessionStore } from '@/store/session'; @@ -44,7 +43,6 @@ const Header = () => { ]} agent={currentAgent} /> - , ); }; diff --git a/src/features/ChatInput/MessageInput/index.tsx b/src/features/ChatInput/MessageInput/index.tsx index 1adfbdb..c1bfed5 100644 --- a/src/features/ChatInput/MessageInput/index.tsx +++ b/src/features/ChatInput/MessageInput/index.tsx @@ -1,25 +1,17 @@ -import { Avatar, Input } from '@lobehub/ui'; -import { Button, Space } from 'antd'; -import { createStyles } from 'antd-style'; +import { SendOutlined } from '@ant-design/icons'; +import { Input } from '@lobehub/ui'; +import { Button } from 'antd'; import { InputRef } from 'antd/es/input/Input'; -import { memo, useRef } from 'react'; +import React, { memo, useRef } from 'react'; +import { Flexbox } from 'react-layout-kit'; -import { DEFAULT_USER_AVATAR } from '@/constants/common'; import Record from '@/features/Actions/Record'; +import Video from '@/features/Actions/Video'; import useChatInput from '@/hooks/useSendMessage'; import { useSessionStore } from '@/store/session'; import { isCommandPressed } from '@/utils/keyboard'; -const useStyles = createStyles(({ css }) => { - return { - textarea: css` - width: 400px; - `, - }; -}); - const InputArea = memo(() => { - const { styles } = useStyles(); const ref = useRef(null); const isChineseInput = useRef(false); const onSend = useChatInput(); @@ -31,11 +23,11 @@ const InputArea = memo(() => { ]); return ( - - + + { setMessageInput?.(e.target.value); }} @@ -69,12 +61,13 @@ const InputArea = memo(() => { if (loading) return; onSend(); }} + icon={} type="primary" > - 发送 + {/*发送*/} - - +