Browse Source

修复点击进入聊天记录

李富豪 5 months ago
parent
commit
4f955401c6
3 changed files with 31 additions and 18 deletions
  1. 5 6
      app/components/home.tsx
  2. 25 12
      app/components/sidebar.tsx
  3. 1 0
      next.config.mjs

+ 5 - 6
app/components/home.tsx

@@ -244,8 +244,7 @@ function Screen() {
   const isAuth = location.pathname === Path.Auth;
 
   const isMobileScreen = useMobileScreen();
-  const shouldTightBorder =
-    getClientConfig()?.isApp || (config.tightBorder && !isMobileScreen);
+  const shouldTightBorder = getClientConfig()?.isApp || (config.tightBorder && !isMobileScreen);
 
   useEffect(() => {
     loadAsyncGoogleFont();
@@ -327,10 +326,10 @@ export function Home() {
   }
 
   useEffect(() => {
-    const loginRes = {};
-    if (loginRes) {
-      return localStorage.setItem('userInfo', JSON.stringify(loginRes));
-    }
+    // const loginRes = { "nickName": "建科咨询虚拟账号", "userId": "2222331845498970571", "token": "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjAyMDE4Mzg0LTFmNjctNDhkYi05NjNiLTJkOGNhMDMxNTkzMiJ9.zTkTv8gDgJN7tfyxJko_zG1VsESlZACeYkpdMbITqnIpIfvHkZo8l8_Kcv6zo77GnuDyzdpOEt-GzPufD2Ye8A" };
+    // if (loginRes) {
+    //   return localStorage.setItem('userInfo', JSON.stringify(loginRes));
+    // }
     const originUrl = window.location.origin;
     const fullUrl = window.location.href;
     const urlParams = new URLSearchParams(new URL(fullUrl).search);

+ 25 - 12
app/components/sidebar.tsx

@@ -395,7 +395,6 @@ export const SideBar = (props: { className?: string }) => {
         const appId = '1881269958412521255';
         url = `/bigmodel/api/dialog/list/${appId}`;
       }
-
       const res = await api.get(url);
       const list = res.data.map((item: any) => {
         return {
@@ -542,15 +541,17 @@ export const SideBar = (props: { className?: string }) => {
           <SideBarHeader
             title={getType() === 'bigModel' ?
               <div style={{ display: 'flex', alignItems: 'center' }}>
-                {isMobileScreen && <div>
-                  <Button
-                    type='text'
-                    icon={<MenuOutlined />}
-                    onClick={() => {
-                      globalStore.setShowMenu(!globalStore.showMenu);
-                    }}
-                  />
-                </div>}
+                {
+                  isMobileScreen && <div>
+                    <Button
+                      type='text'
+                      icon={<MenuOutlined />}
+                      onClick={() => {
+                        globalStore.setShowMenu(!globalStore.showMenu);
+                      }}
+                    />
+                  </div>
+                }
                 问答历史
               </div>
               :
@@ -574,6 +575,7 @@ export const SideBar = (props: { className?: string }) => {
                   chatStore.updateCurrentSession((value) => {
                     value.appId = globalStore.selectedAppId;
                   });
+                  globalStore.setShowMenu(false);
                   if (getType() === 'bigModel') {
                     navigate({ pathname: '/newChat' });
                   } else {
@@ -618,7 +620,12 @@ export const SideBar = (props: { className?: string }) => {
           </SideBarHeader>
           <Menu
             style={{ border: 'none' }}
-            onClick={async ({ key }) => {
+            onClick={async (info) => {
+              const key = info.key;
+              // @ts-ignore
+              const props = info.item.props;
+              const { showMenu, chatMode, appId } = props;
+              globalStore.setShowMenu(false);
               let url = ``;
               if (getType() === 'bigModel') {
                 if (chatStore.chatMode === 'LOCAL') {
@@ -656,7 +663,13 @@ export const SideBar = (props: { className?: string }) => {
                 value.messages = list;
               });
               if (getType() === 'bigModel') {
-                navigate({ pathname: '/newChat' });
+                const search = `?showMenu=${showMenu}&chatMode=${chatMode}&appId=${appId}`;
+                if (appId) {
+                  navigate({
+                    pathname: '/knowledgeChat',
+                    search: search,
+                  })
+                }
               } else {
                 navigate({ pathname: '/newDeepseekChat' });
               }

+ 1 - 0
next.config.mjs

@@ -93,6 +93,7 @@ if (mode !== "export") {
       {
         source: "/bigmodel-api/:path*",
         destination: "http://192.168.3.27:8091/:path*",
+        // destination: "http://192.168.3.123:8091/:path*",
       },
       {
         source: "/deepseek-api/:path*",