Skip to content

Commit 83aa3a8

Browse files
authored
redirect (#5440)
1 parent 3cbcb1e commit 83aa3a8

File tree

6 files changed

+52
-44
lines changed

6 files changed

+52
-44
lines changed

packages/web/i18n/en/common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@
363363
"core.chat.Speaking": "I'm Listening, Please Speak...",
364364
"core.chat.Type a message": "Enter a Question, Press [Enter] to Send / Press [Ctrl(Alt/Shift) + Enter] for New Line",
365365
"core.chat.Unpin": "Unpin",
366-
"core.chat.You need to a chat app": "You Do Not Have an Available App",
367366
"core.chat.error.Chat error": "Chat Error",
368367
"core.chat.error.Messages empty": "API Content is Empty, Possibly Due to Text Being Too Long",
369368
"core.chat.error.Select dataset empty": "You Have Not Selected a Dataset",

packages/web/i18n/zh-CN/common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@
363363
"core.chat.Speaking": "我在听,请说...",
364364
"core.chat.Type a message": "输入问题,发送 [Enter]/换行 [Ctrl(Alt/Shift) + Enter]",
365365
"core.chat.Unpin": "取消置顶",
366-
"core.chat.You need to a chat app": "你没有可用的应用",
367366
"core.chat.error.Chat error": "对话出现异常",
368367
"core.chat.error.Messages empty": "接口内容为空,可能文本超长了~",
369368
"core.chat.error.Select dataset empty": "你没有选择知识库",

packages/web/i18n/zh-Hant/common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@
363363
"core.chat.Speaking": "我在聽,請說...",
364364
"core.chat.Type a message": "輸入問題,按 [Enter] 傳送 / 按 [Ctrl(Alt/Shift) + Enter] 換行",
365365
"core.chat.Unpin": "取消釘選",
366-
"core.chat.You need to a chat app": "您沒有可用的應用程式",
367366
"core.chat.error.Chat error": "對話發生錯誤",
368367
"core.chat.error.Messages empty": "API 內容為空,可能是文字過長",
369368
"core.chat.error.Select dataset empty": "您尚未選擇知識庫",

projects/app/src/pageComponents/chat/ChatWindow/HomeChatWindow.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import type { StartChatFnProps } from '@/components/core/chat/ChatContainer/type
2525
import { streamFetch } from '@/web/common/api/fetch';
2626
import { getChatTitleFromChatMessage } from '@fastgpt/global/core/chat/utils';
2727
import { GPTMessages2Chats } from '@fastgpt/global/core/chat/adapt';
28-
import { useLocalStorageState, useMemoizedFn } from 'ahooks';
28+
import { useLocalStorageState, useMemoizedFn, useMount } from 'ahooks';
2929
import { useChatStore } from '@/web/core/chat/context/useChatStore';
3030
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
3131
import { getInitChatInfo } from '@/web/core/chat/api';
@@ -51,6 +51,7 @@ import { ChatRecordContext } from '@/web/core/chat/context/chatRecordContext';
5151
import { HUGGING_FACE_ICON } from '@fastgpt/global/common/system/constants';
5252
import { getModelFromList } from '@fastgpt/global/core/ai/model';
5353
import MyPopover from '@fastgpt/web/components/common/MyPopover';
54+
import { ChatSidebarPaneEnum } from '../constants';
5455

5556
type Props = {
5657
myApps: AppListItemType[];
@@ -73,9 +74,11 @@ const HomeChatWindow = ({ myApps }: Props) => {
7374
const { isPc } = useSystem();
7475

7576
const { userInfo } = useUserStore();
76-
const { llmModelList, defaultModels } = useSystemStore();
77+
const { llmModelList, defaultModels, feConfigs } = useSystemStore();
7778
const { chatId, appId, outLinkAuthData } = useChatStore();
7879

80+
const onHomeClick = useContextSelector(ChatSettingContext, (v) => v.handlePaneChange);
81+
7982
const isOpenSlider = useContextSelector(ChatContext, (v) => v.isOpenSlider);
8083
const forbidLoadChat = useContextSelector(ChatContext, (v) => v.forbidLoadChat);
8184
const onCloseSlider = useContextSelector(ChatContext, (v) => v.onCloseSlider);
@@ -168,6 +171,12 @@ const HomeChatWindow = ({ myApps }: Props) => {
168171
}
169172
);
170173

174+
useMount(() => {
175+
if (!feConfigs?.isPlus) {
176+
onHomeClick(ChatSidebarPaneEnum.RECENTLY_USED_APPS);
177+
}
178+
});
179+
171180
// 使用类似AppChatWindow的对话逻辑
172181
const onStartChat = useMemoizedFn(
173182
async ({

projects/app/src/pageComponents/chat/SliderApps.tsx

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React, { useCallback, useState } from 'react';
1+
import React, { useCallback } from 'react';
22
import type { BoxProps } from '@chakra-ui/react';
3-
import { Flex, Box, HStack, Image, Skeleton } from '@chakra-ui/react';
3+
import { Flex, Box, HStack, Image } from '@chakra-ui/react';
44
import { motion, AnimatePresence } from 'framer-motion';
55
import { useRouter } from 'next/router';
66
import { useTranslation } from 'next-i18next';
@@ -10,8 +10,6 @@ import MyDivider from '@fastgpt/web/components/common/MyDivider';
1010
import { useUserStore } from '@/web/support/user/useUserStore';
1111
import UserAvatarPopover from '@/pageComponents/chat/UserAvatarPopover';
1212
import MyBox from '@fastgpt/web/components/common/MyBox';
13-
import MyPopover from '@fastgpt/web/components/common/MyPopover';
14-
import SelectOneResource from '@/components/common/folder/SelectOneResource';
1513
import MyIcon from '@fastgpt/web/components/common/Icon';
1614
import type {
1715
GetResourceFolderListProps,
@@ -280,45 +278,49 @@ const NavigationSection = () => {
280278
<AnimatePresence mode="wait">
281279
{isCollapsed ? (
282280
<AnimatedSection show={true}>
283-
<Flex flexDir="column" gap={2}>
284-
<ActionButton
285-
icon="core/chat/sidebar/home"
286-
isCollapsed={true}
287-
isActive={isHomeActive}
288-
onClick={() => onHomeClick(ChatSidebarPaneEnum.HOME)}
289-
/>
290-
291-
<ActionButton
292-
icon="common/app"
293-
isCollapsed={true}
294-
isActive={isTeamAppsActive}
295-
onClick={() => onHomeClick(ChatSidebarPaneEnum.TEAM_APPS)}
296-
/>
297-
</Flex>
281+
<ActionButton
282+
icon="core/chat/sidebar/home"
283+
isCollapsed={true}
284+
isActive={isHomeActive}
285+
onClick={() => onHomeClick(ChatSidebarPaneEnum.HOME)}
286+
/>
298287
</AnimatedSection>
299288
) : (
300289
<AnimatedSection show={true}>
301-
<Flex flexDir="column" gap={2}>
302-
<ActionButton
303-
icon="core/chat/sidebar/home"
304-
text={t('chat:sidebar.home')}
305-
isCollapsed={false}
306-
isActive={isHomeActive}
307-
onClick={() => onHomeClick(ChatSidebarPaneEnum.HOME)}
308-
/>
309-
310-
<ActionButton
311-
icon="common/app"
312-
text={t('chat:sidebar.team_apps')}
313-
isCollapsed={false}
314-
isActive={isTeamAppsActive}
315-
onClick={() => onHomeClick(ChatSidebarPaneEnum.TEAM_APPS)}
316-
/>
317-
</Flex>
290+
<ActionButton
291+
icon="core/chat/sidebar/home"
292+
text={t('chat:sidebar.home')}
293+
isCollapsed={false}
294+
isActive={isHomeActive}
295+
onClick={() => onHomeClick(ChatSidebarPaneEnum.HOME)}
296+
/>
318297
</AnimatedSection>
319298
)}
320299
</AnimatePresence>
321300
)}
301+
302+
<AnimatePresence mode="wait">
303+
{isCollapsed ? (
304+
<AnimatedSection show={true}>
305+
<ActionButton
306+
icon="common/app"
307+
isCollapsed={true}
308+
isActive={isTeamAppsActive}
309+
onClick={() => onHomeClick(ChatSidebarPaneEnum.TEAM_APPS)}
310+
/>
311+
</AnimatedSection>
312+
) : (
313+
<AnimatedSection show={true}>
314+
<ActionButton
315+
icon="common/app"
316+
text={t('chat:sidebar.team_apps')}
317+
isCollapsed={false}
318+
isActive={isTeamAppsActive}
319+
onClick={() => onHomeClick(ChatSidebarPaneEnum.TEAM_APPS)}
320+
/>
321+
</AnimatedSection>
322+
)}
323+
</AnimatePresence>
322324
</Flex>
323325
);
324326
};

projects/app/src/web/core/chat/context/useChatStore.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { create, createJSONStorage, devtools, persist, immer } from '@fastgpt/we
22
import { getNanoid } from '@fastgpt/global/common/string/tools';
33
import { type OutLinkChatAuthProps } from '@fastgpt/global/support/permission/chat';
44
import type { ChatSourceEnum } from '@fastgpt/global/core/chat/constants';
5-
import { ChatSidebarPaneEnum } from '@/pageComponents/chat/constants';
5+
import type { ChatSidebarPaneEnum } from '@/pageComponents/chat/constants';
66

77
type State = {
88
source?: `${ChatSourceEnum}`;
@@ -17,7 +17,7 @@ type State = {
1717
chatId: string;
1818
setChatId: (e?: string) => any;
1919

20-
lastPane: ChatSidebarPaneEnum;
20+
lastPane?: ChatSidebarPaneEnum;
2121
setLastPane: (e: ChatSidebarPaneEnum) => any;
2222

2323
outLinkAuthData: OutLinkChatAuthProps;
@@ -115,7 +115,7 @@ export const useChatStore = create<State>()(
115115
state.lastChatAppId = e;
116116
});
117117
},
118-
lastPane: ChatSidebarPaneEnum.HOME,
118+
lastPane: undefined,
119119
setLastPane(e) {
120120
set((state) => {
121121
state.lastPane = e;

0 commit comments

Comments
 (0)