Explorar el Código

新增招聘直接聊天助手分支

sunsheng hace 4 meses
padre
commit
65af73b49d

+ 3 - 2
app/client/platforms/deepSeek.ts

@@ -20,10 +20,11 @@ export class DeepSeekApi implements LLMApi {
   public apiPath: string;
 
   constructor() {
+    // 蓝色模型纯聊天 不走知识库 就是直接和AI对话
     // this.baseURL = 'http://192.168.3.209:18078';
     this.baseURL = '/deepseek-api';
-    // this.apiPath = this.baseURL + '/vllm/ai/chat';//线上地址
-    this.apiPath = this.baseURL + '/vllm/chat'; // 测试地址 
+    this.apiPath = this.baseURL + '/vllm/ai/chat';//线上地址 
+    // this.apiPath = this.baseURL + '/vllm/chat'; // 测试地址 
   }
 
   async chat(options: ChatOptions) {

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

@@ -299,6 +299,7 @@
 
 .chat-body-main-title {
   cursor: pointer;
+  color: #FFFFFF !important;
 
   &:hover {
     text-decoration: none;

+ 102 - 89
app/components/chat.tsx

@@ -8,7 +8,7 @@ import React, {
   Fragment,
   RefObject,
 } from "react";
-import { HomeOutlined, MenuOutlined,FormOutlined } from '@ant-design/icons';
+import { HomeOutlined, MenuOutlined, FormOutlined } from '@ant-design/icons';
 import SendWhiteIcon from "../icons/send-white.svg";
 import BrainIcon from "../icons/brain.svg";
 import RenameIcon from "../icons/rename.svg";
@@ -678,8 +678,8 @@ export function ChatActions(props: {
       setGuessList([]);
     }
   }, [props.isClickStop])
-  
-  const [activeKey, setActiveKey]= useState('0'); // 控制手风琴是否展示
+
+  const [activeKey, setActiveKey] = useState('0'); // 控制手风琴是否展示
 
   return (
     <div className={styles["chat-input-actions"]}>
@@ -688,53 +688,53 @@ export function ChatActions(props: {
         <Collapse
           accordion={true}
           activeKey={activeKey}
-          onChange={(key)=>{setActiveKey(key[0])}}
+          onChange={(key) => { setActiveKey(key[0]) }}
           bordered={false}
-          style={{ width: '100%',backgroundColor:'#fff' }}
+          style={{ width: '100%', backgroundColor: '#fff' }}
           expandIconPosition="end"
           items={[
             {
               key: '1',
-              label:<span style={{ color: '#8096ca' }}>你还可以尝试提问:</span>,
+              label: <span style={{ color: '#8096ca' }}>你还可以尝试提问:</span>,
               children: <div style={{ color: '#8096ca', fontSize: 13, overflowX: 'auto' }}>
-                  {/* <div>
+                {/* <div>
                     你还可以尝试提问:
                   </div> */}
-                  
-                  {
-                    guessList.length === 0 ?
-                      <Space style={{ margin: '10px 0' }}>
-                        <Skeleton.Button size="small" active={true} />
-                        <Skeleton.Button size="small" active={true} />
-                        <Skeleton.Button size="small" active={true} />
-                      </Space>
-                      :
-                      <div style={{ display: 'flex', margin: '10px 0', overflowX: 'auto' }}>
-                        {
-                          guessList.map((item, index) => {
-                            return (
-                              <div
-                                style={{
-                                  padding: '5px 10px',
-                                  background: '#f2f4f8',
-                                  borderRadius: 5,
-                                  margin: '0 10px 10px 0',
-                                  cursor: 'pointer',
-                                }}
-                                onClick={() => {
-                                  props.setUserInput(item);
-                                  props.doSubmit(item)
-                                  setActiveKey('')
-                                }}
-                                key={index}
-                              >
-                                {item}
-                              </div>
-                            )
-                          })
-                        }
-                      </div>
-                  }
+
+                {
+                  guessList.length === 0 ?
+                    <Space style={{ margin: '10px 0' }}>
+                      <Skeleton.Button size="small" active={true} />
+                      <Skeleton.Button size="small" active={true} />
+                      <Skeleton.Button size="small" active={true} />
+                    </Space>
+                    :
+                    <div style={{ display: 'flex', margin: '10px 0', overflowX: 'auto' }}>
+                      {
+                        guessList.map((item, index) => {
+                          return (
+                            <div
+                              style={{
+                                padding: '5px 10px',
+                                background: '#f2f4f8',
+                                borderRadius: 5,
+                                margin: '0 10px 10px 0',
+                                cursor: 'pointer',
+                              }}
+                              onClick={() => {
+                                props.setUserInput(item);
+                                props.doSubmit(item)
+                                setActiveKey('')
+                              }}
+                              key={index}
+                            >
+                              {item}
+                            </div>
+                          )
+                        })
+                      }
+                    </div>
+                }
               </div>
             }
           ]}
@@ -1139,7 +1139,7 @@ function _Chat() {
       let url = null;
       if (selectedFruit === 'LOCAL') {
         url = '/deepseek/api/free//presets';
-      } 
+      }
       // else {
       //   url = '/bigmodel/api/presets';
       // }
@@ -1174,7 +1174,8 @@ function _Chat() {
     if (chatMode) {
       setSelectedFruit(chatMode as "ONLINE" | "LOCAL");
       // const appId = params.get('appId');
-      const appId = '2924812721300312064';
+      // const appId = '2924812721300312064'; // 测试ID
+      const appId = '2959949063168331776'; // 生产ID
       if (appId) {
         setAppValue(appId);
         globalStore.setSelectedAppId(appId);
@@ -1776,9 +1777,9 @@ function _Chat() {
     const [pageLoading, setPageLoading] = useState(false);
     const [list, setList] = useState([]);
 
-/**
-* 初始化函数,用于加载页面数据
-*/
+    /**
+    * 初始化函数,用于加载页面数据
+    */
     const init = async () => {
       setPageLoading(true);
       try {
@@ -1865,14 +1866,23 @@ function _Chat() {
           <div style={{ display: 'flex', alignItems: 'center' }}
             className={`window-header-title ${styles["chat-body-title"]}`}>
             {
-              <div style={{ marginRight: 10 }}>
-                <Button
-                  type='text'
-                  icon={<MenuOutlined />}
-                  onClick={() => {
-                    globalStore.setShowMenu(!globalStore.showMenu);
-                  }}
-                />
+              <div style={{ display: 'flex', alignItems: 'center' }}
+                className={`window-header-title ${styles["chat-body-title"]}`}>
+                <div>
+                  <img style={{ marginTop: '10%', marginRight: '10px', height: 42 }} src={faviconSrc.src} />
+                  {/* <Favicon className="window-header-icon" /> */}
+                </div>
+                <div>
+                  <div
+                    className={`window-header-main-title ${styles["chat-body-main-title"]}`}
+                  // onClickCapture={() => setIsEditingMessage(true)}
+                  >
+                    建科·小智
+                  </div>
+                  <div className={`window-header-sub-title ${styles["chat-body-main-title"]}`}>
+                    {Locale.Chat.SubTitle(session.messages.length)}
+                  </div>
+                </div>
               </div>
             }
             {/* 获取应用列表头部展示在页面最上面 */}
@@ -1928,12 +1938,12 @@ function _Chat() {
             }
           </div>
           <div className="window-actions">
-            <div className="window-action-button" onClick={()=>{
-                localStorage.clear();
-                window.location.reload();
+            <div className="window-action-button" onClick={() => {
+              localStorage.clear();
+              window.location.reload();
             }}>
               <IconButton text='新聊天' icon={<FormOutlined />} />
-              
+
             </div>
             {/* {showMaxIcon && (
             <div className="window-action-button">
@@ -2219,36 +2229,39 @@ function _Chat() {
                 <p style={{ textAlign: 'center' }}>
                   {getDesc()}
                 </p>
-                <p>我猜您可能想问:</p>
-                {
-                  questionList.map((item, index) => {
-                    return (
-                      <div
-                        style={{
-                          padding: '10px',
-                          marginBottom: '10px',
-                          border: '1px solid #e6e8f1',
-                          borderRadius: '10px',
-                          fontSize: '16px',
-                          display: 'flex',
-                          justifyContent: 'space-between',
-                          alignItems: 'center',
-                          cursor: 'pointer'
-                        }}
-                        onClick={() => {
-                          setUserInput(item)
-                          doSubmit(item)
-                        }}
-                        key={index}
-                      >
-                        <div>
-                          {item}
+                <div style={{ background: '#fff', padding: 10, borderRadius: 10, boxShadow: '0 2px 8px rgba(0,0,0,.1)' }}>
+                  <p>我猜您可能想问:</p>
+                  {
+                    questionList.map((item, index) => {
+                      return (
+                        <div
+                          style={{
+                            padding: '10px',
+                            marginBottom: '10px',
+                            border: '1px solid #e6e8f1',
+                            borderRadius: '10px',
+                            fontSize: '16px',
+                            display: 'flex',
+                            justifyContent: 'space-between',
+                            alignItems: 'center',
+                            cursor: 'pointer'
+                          }}
+                          onClick={() => {
+                            setUserInput(item)
+                            doSubmit(item)
+                          }}
+                          key={index}
+                        >
+                          <div>
+                            {item}
+                          </div>
+                          <RightOutlined />
                         </div>
-                        <RightOutlined />
-                      </div>
-                    )
-                  })
-                }
+                      )
+                    })
+                  }
+                </div>
+
               </div>
             </>
         }
@@ -2344,7 +2357,7 @@ function _Chat() {
           />
         </label>
       </div>
-      <div style={{ paddingBottom: 12, textAlign: 'center', background:'rgba(155, 155, 255, .2)',backdropFilter: 'blur(1px)', color: '#000', fontSize: 12 }}>
+      <div style={{ paddingBottom: 12, textAlign: 'center', background: 'rgba(155, 155, 255, .2)', backdropFilter: 'blur(1px)', color: '#000', fontSize: 12 }}>
         内容由AI生成,仅供参考
       </div>
       {showExport && (

+ 35 - 35
app/components/home.tsx

@@ -29,46 +29,46 @@ import api from "../api/api";
 
 export function Loading() {
   /** second版本注释掉进度条 */
-  // const [progress, setProgress] = useState(1);
-  //
-  // useEffect(() => {
-  //   let isMounted = true;
-  //
-  //   const intervalId = setInterval(() => {
-  //     if (isMounted && progress < 100) {
-  //       // 每隔一段时间增加1%进度
-  //       setProgress(prevProgress => prevProgress + 1);
-  //     }
-  //   }, 30);// 每10毫秒更新1%进度
-  //
-  //   return () => {
-  //     isMounted = false;
-  //     clearInterval(intervalId);
-  //   };
-  // }, [progress]);
+  const [progress, setProgress] = useState(1);
+  
+  useEffect(() => {
+    let isMounted = true;
+  
+    const intervalId = setInterval(() => {
+      if (isMounted && progress < 100) {
+        // 每隔一段时间增加1%进度
+        setProgress(prevProgress => prevProgress + 1);
+      }
+    }, 30);// 每10毫秒更新1%进度
+  
+    return () => {
+      isMounted = false;
+      clearInterval(intervalId);
+    };
+  }, [progress]);
 
   return (
     <div className={styles["loading-content"] + " no-dark"}>
       <img src={loadingIcon.src} />
       {/* seceond版本注释掉进度条 */}
-      {/* <div style={{ width: '60%', height: 15, background: '#F5F6F9', borderRadius: 8, marginTop: '20%', position: 'relative' }}> */}
-      {/*   <div */}
-      {/*     style={{ */}
-      {/*       width: `${progress}%`, */}
-      {/*       height: 15, */}
-      {/*       background: '#265C7D', */}
-      {/*       borderRadius: 8, */}
-      {/*       display: 'flex', */}
-      {/*       justifyContent: 'flex-end', */}
-      {/*       alignItems: 'center', */}
-      {/*       position: 'absolute' */}
-      {/*     }} */}
-      {/*   > */}
-      {/*     <div style={{ color: '#FFFFFF', fontSize: 12, lineHeight: 12, marginRight: 4 }}> */}
-      {/*       {progress}% */}
-      {/*     </div> */}
-      {/*   </div> */}
-      {/* </div> */}
+      <div style={{ width: '60%', height: 15, background: '#F5F6F9', borderRadius: 8, marginTop: '20%', position: 'relative' }}>
+        <div
+          style={{
+            width: `${progress}%`,
+            height: 15,
+            background: '#265C7D',
+            borderRadius: 8,
+            display: 'flex',
+            justifyContent: 'flex-end',
+            alignItems: 'center',
+            position: 'absolute'
+          }}
+        >
+          <div style={{ color: '#FFFFFF', fontSize: 12, lineHeight: 12, marginRight: 4 }}>
+            {progress}%
+          </div>
+        </div>
+      </div>
     </div>
   );
 }

+ 1 - 1
app/styles/window.scss

@@ -4,7 +4,7 @@
     display: flex;
     justify-content: space-between;
     align-items: center;
-    background: hsla(0, 0%, 100%, .2);
+    background: hsla(0, 0%, 100%, .1);
     -webkit-backdrop-filter: blur(2px);
     backdrop-filter: blur(2px);
     border-bottom: 1px solid rgba(55, 155, 255, .5);;