Browse Source

deepseek首页对接

李富豪 9 tháng trước cách đây
mục cha
commit
a9a7488cd4

+ 28 - 10
app/components/DeepSeekChat.tsx

@@ -19,6 +19,8 @@ import ConfirmIcon from "../icons/confirm.svg";
 import CancelIcon from "../icons/cancel.svg";
 import SizeIcon from "../icons/size.svg";
 import avatar from "../icons/aiIcon.png";
+import sdsk from "../icons/sdsk.png";
+import hlw from "../icons/hlw.png";
 
 import {
   SubmitKey,
@@ -1489,21 +1491,37 @@ function _Chat() {
               })}
             </div>
           )}
-          <IconButton
-            style={{ background: '#4360ee' }}
-            icon={<SendWhiteIcon />}
-            text='发送'
-            className={styles["chat-input-send"]}
-            type="primary"
-            onClick={() => doSubmit(userInput)}
-          />
         </label>
+        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginTop: 10 }}>
+          <div style={{ display: 'flex', alignItems: 'center' }}>
+            <div
+              style={{ padding: '0 10px', height: 30, borderRadius: 30, fontSize: 12, background: '#f3f4f6', display: 'flex', justifyContent: 'center', alignItems: 'center', marginRight: 20 }}
+            >
+              <img src={sdsk.src} style={{ height: 23 }} />
+              <div style={{ marginLeft: 5 }}>
+                深度思考(R1)
+              </div>
+            </div>
+            <div
+              style={{ padding: '0 10px', height: 30, borderRadius: 30, fontSize: 12, background: '#f3f4f6', display: 'flex', justifyContent: 'center', alignItems: 'center' }}
+            >
+              <img src={hlw.src} style={{ height: 23 }} />
+              <div style={{ marginLeft: 5 }}>
+                联网搜索
+              </div>
+            </div>
+          </div>
+          <div
+            style={{ width: 35, height: 35, borderRadius: '50%', background: '#4357d2', display: 'flex', justifyContent: 'center', alignItems: 'center' }}
+            onClick={() => doSubmit(userInput)}
+          >
+            <SendWhiteIcon />
+          </div>
+        </div>
       </div>
-
       {showExport && (
         <ExportMessageModal onClose={() => setShowExport(false)} />
       )}
-
       {isEditingMessage && (
         <EditMessageModal
           onClose={() => {

+ 28 - 10
app/components/DeepSeekHomeChat.tsx

@@ -19,6 +19,8 @@ import ConfirmIcon from "../icons/confirm.svg";
 import CancelIcon from "../icons/cancel.svg";
 import SizeIcon from "../icons/size.svg";
 import avatar from "../icons/aiIcon.png";
+import sdsk from "../icons/sdsk.png";
+import hlw from "../icons/hlw.png";
 
 import {
   SubmitKey,
@@ -1467,21 +1469,37 @@ function _Chat() {
               })}
             </div>
           )}
-          <IconButton
-            style={{ background: '#4360ee' }}
-            icon={<SendWhiteIcon />}
-            text='发送'
-            className={styles["chat-input-send"]}
-            type="primary"
-            onClick={() => doSubmit(userInput)}
-          />
         </label>
+        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginTop: 10 }}>
+          <div style={{ display: 'flex', alignItems: 'center' }}>
+            <div
+              style={{ padding: '0 10px', height: 30, borderRadius: 30, fontSize: 12, background: '#f3f4f6', display: 'flex', justifyContent: 'center', alignItems: 'center', marginRight: 20 }}
+            >
+              <img src={sdsk.src} style={{ height: 23 }} />
+              <div style={{ marginLeft: 5 }}>
+                深度思考(R1)
+              </div>
+            </div>
+            <div
+              style={{ padding: '0 10px', height: 30, borderRadius: 30, fontSize: 12, background: '#f3f4f6', display: 'flex', justifyContent: 'center', alignItems: 'center' }}
+            >
+              <img src={hlw.src} style={{ height: 23 }} />
+              <div style={{ marginLeft: 5 }}>
+                联网搜索
+              </div>
+            </div>
+          </div>
+          <div
+            style={{ width: 35, height: 35, borderRadius: '50%', background: '#4357d2', display: 'flex', justifyContent: 'center', alignItems: 'center' }}
+            onClick={() => doSubmit(userInput)}
+          >
+            <SendWhiteIcon />
+          </div>
+        </div>
       </div>
-
       {showExport && (
         <ExportMessageModal onClose={() => setShowExport(false)} />
       )}
-
       {isEditingMessage && (
         <EditMessageModal
           onClose={() => {

+ 0 - 1
app/components/chat.module.scss

@@ -634,7 +634,6 @@
 .chat-input-send {
   background-color: var(--primary);
   color: white;
-
   position: absolute;
   right: 30px;
   bottom: 32px;

+ 25 - 8
app/components/sidebar.tsx

@@ -2,6 +2,7 @@ import React, { useEffect, useRef, useMemo, useState, Fragment } from "react";
 import styles from "./home.module.scss";
 import DragIcon from "../icons/drag.svg";
 import faviconSrc from "../icons/favicon.png";
+import deepSeekSrc from "../icons/deepSeek.png";
 import { EditOutlined } from '@ant-design/icons';
 import { useAppConfig, useChatStore, useGlobalStore } from "../store";
 import {
@@ -205,13 +206,23 @@ export const SideBar = (props: { className?: string }) => {
   const [modalOpen, setModalOpen] = useState(false)
   const [form] = Form.useForm();
 
+  const getType = (): 'bigModel' | 'deepSeek' => {
+    if (['/knowledgeChat', '/newChat'].includes(location.pathname)) {
+      return 'bigModel';
+    } else if (['/deepseekChat', '/newDeepseekChat'].includes(location.pathname)) {
+      return 'deepSeek';
+    } else {
+      return 'bigModel';
+    }
+  }
+
   // 获取聊天列表
   const fetchChatList = async () => {
     try {
       let appId = '';
-      if (['/knowledgeChat', '/newChat'].includes(location.pathname)) {
+      if (getType() === 'bigModel') {
         appId = globalStore.selectedAppId;
-      } else if (['/deepseekChat', '/newDeepseekChat'].includes(location.pathname)) {
+      } else {
         appId = '1881269958412521255';
       }
       const res = await api.get(`/bigmodel/api/dialog/list/${appId}`);
@@ -307,9 +318,15 @@ export const SideBar = (props: { className?: string }) => {
       shouldNarrow={shouldNarrow}
       {...props}
     >
+      {
+        getType() === 'deepSeek' &&
+        <div>
+          <img style={{ width: '100%' }} src={deepSeekSrc.src} />
+        </div>
+      }
       <SideBarHeader
-        title="问答历史"
-        logo={<img style={{ height: 40, cursor: 'pointer' }} src={faviconSrc.src} />}
+        title={getType() === 'bigModel' ? '问答历史' : ''}
+        logo={getType() === 'bigModel' ? <img style={{ height: 40 }} src={faviconSrc.src} /> : ''}
       >
         <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
           <Button
@@ -328,9 +345,9 @@ export const SideBar = (props: { className?: string }) => {
               chatStore.updateCurrentSession((value) => {
                 value.appId = globalStore.selectedAppId;
               });
-              if (['/knowledgeChat', '/newChat'].includes(location.pathname)) {
+              if (getType() === 'bigModel') {
                 navigate({ pathname: '/newChat' });
-              } else if (['/deepseekChat', '/newDeepseekChat'].includes(location.pathname)) {
+              } else {
                 navigate({ pathname: '/newDeepseekChat' });
               }
               await fetchChatList()
@@ -366,9 +383,9 @@ export const SideBar = (props: { className?: string }) => {
             value.id = session.id;
             value.messages = list;
           });
-          if (['/knowledgeChat', '/newChat'].includes(location.pathname)) {
+          if (getType() === 'bigModel') {
             navigate({ pathname: '/newChat' });
-          } else if (['/deepseekChat', '/newDeepseekChat'].includes(location.pathname)) {
+          } else {
             navigate({ pathname: '/newDeepseekChat' });
           }
         }}

BIN
app/icons/deepSeek.png


BIN
app/icons/hlw.png


BIN
app/icons/sdsk.png