Browse Source

增加登陆跳转

李富豪 5 months ago
parent
commit
778fbe129d
1 changed files with 125 additions and 112 deletions
  1. 125 112
      app/components/chat.tsx

+ 125 - 112
app/components/chat.tsx

@@ -1763,120 +1763,133 @@ function _Chat() {
     <div className={styles.chat} key={session.id}>
       {
         !location.search.includes('showMenu=false') &&
-        <div className="window-header" data-tauri-drag-region>
-          <div style={{ display: 'flex', alignItems: 'center' }}
-            className={`window-header-title ${styles["chat-body-title"]}`}>
-            <div>
-              {
-                isMobileScreen &&
-                <IconButton
-                  style={{ padding: 0, marginRight: 20 }}
-                  icon={<LeftIcon />}
-                  text={Locale.NewChat.Return}
-                  onClick={() => navigate('/knowledgeChat')}
-                />
-              }
-            </div>
-            <div>
-              <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
-                <Select
-                  style={{ width: '100%', height: 38, marginRight: 5 }}
-                  value={selectedFruit}
-                  onChange={(value: "ONLINE" | "LOCAL") => {
-                    chatStore.clearSessions();
-                    chatStore.updateCurrentSession((values) => {
-                      values.appId = globalStore.selectedAppId;
-                    });
-                    navigate({ pathname: '/newChat' });
-                    setSelectedFruit(value);
-                    chatStore.setChatMode(value);
-                  }}
-                >
-                  {fruits.map(fruit => (
-                    <Select.Option key={fruit.id} value={fruit.id}>
-                      {fruit.name}
-                    </Select.Option>
-                  ))}
-                </Select>
-                {
-                  appList.length > 0 ?
-                    <Select
-                      style={{ width: '100%', height: 38, marginRight: 5 }}
-                      placeholder='请选择'
-                      options={appList}
-                      value={appValue}
-                      onChange={(value) => {
-                        setAppValue(value);
-                        globalStore.setSelectedAppId(value);
-                        chatStore.clearSessions();
-                        chatStore.updateCurrentSession((values) => {
-                          values.appId = value;
-                        });
-                        useChatStore.setState({
-                          message: {
-                            content: '',
-                            role: 'assistant',
-                          }
-                        });
-                        setSendStatus(false);
-                      }}
-                    />
-                    :
-                    null
-                }
-              </div>
-            </div>
-          </div>
-          <div className="window-actions">
-            <div className="window-action-button">
-              <Popover
-                trigger="click"
-                title="分享该应用"
-                content={() => {
-                  const url = `${window.location.origin}/#/knowledgeChat?showMenu=false&chatMode=${selectedFruit}&appId=${appValue}`
-                  return <div>
-                    <div style={{ marginBottom: 10 }}>
-                      {url}
-                    </div>
-                    <Button onClick={() => {
-                      navigator.clipboard.writeText(url);
-                      message.success('分享链接已复制到剪贴板');
-                    }}>
-                      复制
-                    </Button>
-                  </div>
-                }
-                }>
-                <IconButton
-                  icon={<ExportIcon />}
-                  bordered
-                  title='分享该应用'
-                />
-              </Popover>
-            </div>
-            {/* {showMaxIcon && (
-            <div className="window-action-button">
-              <IconButton
-                icon={config.tightBorder ? <MinIcon /> : <MaxIcon />}
-                bordered
-                title={Locale.Chat.Actions.FullScreen}
-                aria={Locale.Chat.Actions.FullScreen}
-                onClick={() => {
-                  config.update(
-                    (config) => (config.tightBorder = !config.tightBorder),
-                  );
-                }}
-              />
-            </div>
-          )} */}
+        <></>
+        // <div className="window-header" data-tauri-drag-region>
+        //   <div style={{ display: 'flex', alignItems: 'center' }}
+        //     className={`window-header-title ${styles["chat-body-title"]}`}>
+        //     <div>
+        //       {
+        //         isMobileScreen &&
+        //         <IconButton
+        //           style={{ padding: 0, marginRight: 20 }}
+        //           icon={<LeftIcon />}
+        //           text={Locale.NewChat.Return}
+        //           onClick={() => navigate('/knowledgeChat')}
+        //         />
+        //       }
+        //     </div>
+        //     <div>
+        //       <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
+        //         <Select
+        //           style={{ width: '100%', height: 38, marginRight: 5 }}
+        //           value={selectedFruit}
+        //           onChange={(value: "ONLINE" | "LOCAL") => {
+        //             chatStore.clearSessions();
+        //             chatStore.updateCurrentSession((values) => {
+        //               values.appId = globalStore.selectedAppId;
+        //             });
+        //             navigate({ pathname: '/newChat' });
+        //             setSelectedFruit(value);
+        //             chatStore.setChatMode(value);
+        //           }}
+        //         >
+        //           {fruits.map(fruit => (
+        //             <Select.Option key={fruit.id} value={fruit.id}>
+        //               {fruit.name}
+        //             </Select.Option>
+        //           ))}
+        //         </Select>
+        //         {
+        //           appList.length > 0 ?
+        //             <Select
+        //               style={{ width: '100%', height: 38, marginRight: 5 }}
+        //               placeholder='请选择'
+        //               options={appList}
+        //               value={appValue}
+        //               onChange={(value) => {
+        //                 setAppValue(value);
+        //                 globalStore.setSelectedAppId(value);
+        //                 chatStore.clearSessions();
+        //                 chatStore.updateCurrentSession((values) => {
+        //                   values.appId = value;
+        //                 });
+        //                 useChatStore.setState({
+        //                   message: {
+        //                     content: '',
+        //                     role: 'assistant',
+        //                   }
+        //                 });
+        //                 setSendStatus(false);
+        //               }}
+        //             />
+        //             :
+        //             null
+        //         }
+        //       </div>
+        //     </div>
+        //   </div>
+        //   <div className="window-actions">
+        //     <div className="window-action-button">
+        //       <Popover
+        //         trigger="click"
+        //         title="分享该应用"
+        //         content={() => {
+        //           const url = `${window.location.origin}/#/knowledgeChat?showMenu=false&chatMode=${selectedFruit}&appId=${appValue}`
+        //           return <div>
+        //             <div style={{ marginBottom: 10 }}>
+        //               {url}
+        //             </div>
+        //             <Button onClick={() => {
+        //               navigator.clipboard.writeText(url);
+        //               message.success('分享链接已复制到剪贴板');
+        //             }}>
+        //               复制
+        //             </Button>
+        //           </div>
+        //         }
+        //         }>
+        //         <IconButton
+        //           icon={<ExportIcon />}
+        //           bordered
+        //           title='分享该应用'
+        //         />
+        //       </Popover>
+        //     </div>
+        //     {/* {showMaxIcon && (
+        //     <div className="window-action-button">
+        //       <IconButton
+        //         icon={config.tightBorder ? <MinIcon /> : <MaxIcon />}
+        //         bordered
+        //         title={Locale.Chat.Actions.FullScreen}
+        //         aria={Locale.Chat.Actions.FullScreen}
+        //         onClick={() => {
+        //           config.update(
+        //             (config) => (config.tightBorder = !config.tightBorder),
+        //           );
+        //         }}
+        //       />
+        //     </div>
+        //   )} */}
+        //   </div>
+        //   {/* <PromptToast
+        //   showToast={!hitBottom}
+        //   showModal={showPromptModal}
+        //   setShowModal={setShowPromptModal}
+        // /> */}
+        // </div>
+      }
+      <div className="window-header" data-tauri-drag-region>
+        <div></div>
+        <div className="window-actions">
+          <div className="window-action-button">
+            <Button type="primary" ghost onClick={() => {
+              window.open('https://www.baidu.com', "_self");
+            }}>
+              登录
+            </Button>
           </div>
-          {/* <PromptToast
-          showToast={!hitBottom}
-          showModal={showPromptModal}
-          setShowModal={setShowPromptModal}
-        /> */}
         </div>
-      }
+      </div>
       <div
         className={styles["chat-body"]}
         ref={scrollRef}