diff --git a/package.json b/package.json index e59f1aa..1a58105 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "axios": "^1.15.0", "highlight.js": "^11.11.1", "katex": "^0.16.45", + "lucide-react": "^1.9.0", "react": "^19.2.4", "react-dom": "^19.2.4", "react-markdown": "^10.1.0", diff --git a/src/components/StreamMessage.tsx b/src/components/StreamMessage.tsx index f3dcea8..3868e84 100644 --- a/src/components/StreamMessage.tsx +++ b/src/components/StreamMessage.tsx @@ -1,6 +1,6 @@ import { useState } from "react"; -import { CheckOutlined, CopyOutlined } from "@ant-design/icons"; import { Button, message } from "antd"; +import { Check, Copy } from "lucide-react"; import ReactMarkdown from "react-markdown"; import remarkGfm from "remark-gfm"; import remarkMath from "remark-math"; @@ -47,7 +47,7 @@ function MarkdownPreBlock(props: { children: ReactNode }) { {(!collapsed || isMobile) && ( - - @@ -696,10 +730,10 @@ export default function HomePage() { width={260} collapsedWidth={72} theme="light" - className="!min-h-0 !h-full !overflow-hidden !bg-[var(--ds-bg-sider)] !border-r !border-[var(--ds-border)]" + className="!min-h-0 !h-full !overflow-hidden !bg-[var(--ds-bg-sider)]" >
-
+
@@ -733,11 +767,11 @@ export default function HomePage() { className="text-neutral-500 hover:bg-black/5!" icon={ isMobile ? ( - + ) : collapsed ? ( - + ) : ( - + ) } onClick={() => { @@ -770,203 +804,223 @@ export default function HomePage() {
-
+
- {messages.map((item) => ( -
+ {!activeSessionId && messages.length === 0 ? ( +

你好,我是 ChatOne

+ ) : ( + messages.map((item) => (
- {item.role === "user" && ( -
- {item.content} -
- )} - {item.role === "assistant" && item.thinking && ( - - - 已思考(用时约 2 秒) - - ), - children: ( - - {item.thinking} - - ), - }, - ]} - /> - )} - {item.role === "assistant" && - (item.content ? ( - - ) : ( -
- - - - - +
+ {item.role === "user" && ( +
+ {item.content}
- ))} - {item.role === "assistant" && item.content && ( - <> -

- 本回答由 AI 生成,内容仅供参考,请仔细甄别。 -

-
- -
+ + )} + {item.role === "user" && ( +
+
- - )} - {item.role === "user" && ( -
-
- )} + )} +
-
- ))} + )) + )}
-
- setInputValue(e.target.value)} - onPressEnter={(e) => { - if (e.shiftKey) return; - e.preventDefault(); - void sendMessage(); - }} - placeholder="给 ChatOne 发送消息" - variant="borderless" - autoSize={{ minRows: 2, maxRows: 8 }} - className="!px-1 !text-[15px] placeholder:text-neutral-400" - /> -
-
- - -
-
- + )} +
+ setInputValue(e.target.value)} + onPressEnter={(e) => { + if (e.shiftKey) return; + e.preventDefault(); + void sendMessage(); + }} + placeholder="给 ChatOne 发送消息" + variant="borderless" + autoSize={{ minRows: 2, maxRows: 8 }} + className="!px-1 !text-[15px] placeholder:text-neutral-400" + /> +
+
+ + +
+
+
diff --git a/yarn.lock b/yarn.lock index 61b3ba1..401548e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2932,6 +2932,11 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" +lucide-react@^1.9.0: + version "1.9.0" + resolved "https://registry.npmmirror.com/lucide-react/-/lucide-react-1.9.0.tgz#3c8324e6b574131624c1869cbd38829d9c659627" + integrity sha512-6qVAmbgCjcJz7sAGSPSSJ++RAwjlK2XCbRrZKv63Ciko1KT8jX0//CXxgI3jg2HlJu8tADqdYlNDebmYjeoruA== + magic-string@^0.30.21: version "0.30.21" resolved "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.21.tgz#56763ec09a0fa8091df27879fd94d19078c00d91"