mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-15 15:41:05 +00:00
redirect (#5440)
This commit is contained in:
@@ -363,7 +363,6 @@
|
||||
"core.chat.Speaking": "I'm Listening, Please Speak...",
|
||||
"core.chat.Type a message": "Enter a Question, Press [Enter] to Send / Press [Ctrl(Alt/Shift) + Enter] for New Line",
|
||||
"core.chat.Unpin": "Unpin",
|
||||
"core.chat.You need to a chat app": "You Do Not Have an Available App",
|
||||
"core.chat.error.Chat error": "Chat Error",
|
||||
"core.chat.error.Messages empty": "API Content is Empty, Possibly Due to Text Being Too Long",
|
||||
"core.chat.error.Select dataset empty": "You Have Not Selected a Dataset",
|
||||
|
@@ -363,7 +363,6 @@
|
||||
"core.chat.Speaking": "我在听,请说...",
|
||||
"core.chat.Type a message": "输入问题,发送 [Enter]/换行 [Ctrl(Alt/Shift) + Enter]",
|
||||
"core.chat.Unpin": "取消置顶",
|
||||
"core.chat.You need to a chat app": "你没有可用的应用",
|
||||
"core.chat.error.Chat error": "对话出现异常",
|
||||
"core.chat.error.Messages empty": "接口内容为空,可能文本超长了~",
|
||||
"core.chat.error.Select dataset empty": "你没有选择知识库",
|
||||
|
@@ -363,7 +363,6 @@
|
||||
"core.chat.Speaking": "我在聽,請說...",
|
||||
"core.chat.Type a message": "輸入問題,按 [Enter] 傳送 / 按 [Ctrl(Alt/Shift) + Enter] 換行",
|
||||
"core.chat.Unpin": "取消釘選",
|
||||
"core.chat.You need to a chat app": "您沒有可用的應用程式",
|
||||
"core.chat.error.Chat error": "對話發生錯誤",
|
||||
"core.chat.error.Messages empty": "API 內容為空,可能是文字過長",
|
||||
"core.chat.error.Select dataset empty": "您尚未選擇知識庫",
|
||||
|
@@ -25,7 +25,7 @@ import type { StartChatFnProps } from '@/components/core/chat/ChatContainer/type
|
||||
import { streamFetch } from '@/web/common/api/fetch';
|
||||
import { getChatTitleFromChatMessage } from '@fastgpt/global/core/chat/utils';
|
||||
import { GPTMessages2Chats } from '@fastgpt/global/core/chat/adapt';
|
||||
import { useLocalStorageState, useMemoizedFn } from 'ahooks';
|
||||
import { useLocalStorageState, useMemoizedFn, useMount } from 'ahooks';
|
||||
import { useChatStore } from '@/web/core/chat/context/useChatStore';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { getInitChatInfo } from '@/web/core/chat/api';
|
||||
@@ -51,6 +51,7 @@ import { ChatRecordContext } from '@/web/core/chat/context/chatRecordContext';
|
||||
import { HUGGING_FACE_ICON } from '@fastgpt/global/common/system/constants';
|
||||
import { getModelFromList } from '@fastgpt/global/core/ai/model';
|
||||
import MyPopover from '@fastgpt/web/components/common/MyPopover';
|
||||
import { ChatSidebarPaneEnum } from '../constants';
|
||||
|
||||
type Props = {
|
||||
myApps: AppListItemType[];
|
||||
@@ -73,9 +74,11 @@ const HomeChatWindow = ({ myApps }: Props) => {
|
||||
const { isPc } = useSystem();
|
||||
|
||||
const { userInfo } = useUserStore();
|
||||
const { llmModelList, defaultModels } = useSystemStore();
|
||||
const { llmModelList, defaultModels, feConfigs } = useSystemStore();
|
||||
const { chatId, appId, outLinkAuthData } = useChatStore();
|
||||
|
||||
const onHomeClick = useContextSelector(ChatSettingContext, (v) => v.handlePaneChange);
|
||||
|
||||
const isOpenSlider = useContextSelector(ChatContext, (v) => v.isOpenSlider);
|
||||
const forbidLoadChat = useContextSelector(ChatContext, (v) => v.forbidLoadChat);
|
||||
const onCloseSlider = useContextSelector(ChatContext, (v) => v.onCloseSlider);
|
||||
@@ -168,6 +171,12 @@ const HomeChatWindow = ({ myApps }: Props) => {
|
||||
}
|
||||
);
|
||||
|
||||
useMount(() => {
|
||||
if (!feConfigs?.isPlus) {
|
||||
onHomeClick(ChatSidebarPaneEnum.RECENTLY_USED_APPS);
|
||||
}
|
||||
});
|
||||
|
||||
// 使用类似AppChatWindow的对话逻辑
|
||||
const onStartChat = useMemoizedFn(
|
||||
async ({
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import React, { useCallback } from 'react';
|
||||
import type { BoxProps } from '@chakra-ui/react';
|
||||
import { Flex, Box, HStack, Image, Skeleton } from '@chakra-ui/react';
|
||||
import { Flex, Box, HStack, Image } from '@chakra-ui/react';
|
||||
import { motion, AnimatePresence } from 'framer-motion';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
@@ -10,8 +10,6 @@ import MyDivider from '@fastgpt/web/components/common/MyDivider';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import UserAvatarPopover from '@/pageComponents/chat/UserAvatarPopover';
|
||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||
import MyPopover from '@fastgpt/web/components/common/MyPopover';
|
||||
import SelectOneResource from '@/components/common/folder/SelectOneResource';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import type {
|
||||
GetResourceFolderListProps,
|
||||
@@ -280,45 +278,49 @@ const NavigationSection = () => {
|
||||
<AnimatePresence mode="wait">
|
||||
{isCollapsed ? (
|
||||
<AnimatedSection show={true}>
|
||||
<Flex flexDir="column" gap={2}>
|
||||
<ActionButton
|
||||
icon="core/chat/sidebar/home"
|
||||
isCollapsed={true}
|
||||
isActive={isHomeActive}
|
||||
onClick={() => onHomeClick(ChatSidebarPaneEnum.HOME)}
|
||||
/>
|
||||
|
||||
<ActionButton
|
||||
icon="common/app"
|
||||
isCollapsed={true}
|
||||
isActive={isTeamAppsActive}
|
||||
onClick={() => onHomeClick(ChatSidebarPaneEnum.TEAM_APPS)}
|
||||
/>
|
||||
</Flex>
|
||||
<ActionButton
|
||||
icon="core/chat/sidebar/home"
|
||||
isCollapsed={true}
|
||||
isActive={isHomeActive}
|
||||
onClick={() => onHomeClick(ChatSidebarPaneEnum.HOME)}
|
||||
/>
|
||||
</AnimatedSection>
|
||||
) : (
|
||||
<AnimatedSection show={true}>
|
||||
<Flex flexDir="column" gap={2}>
|
||||
<ActionButton
|
||||
icon="core/chat/sidebar/home"
|
||||
text={t('chat:sidebar.home')}
|
||||
isCollapsed={false}
|
||||
isActive={isHomeActive}
|
||||
onClick={() => onHomeClick(ChatSidebarPaneEnum.HOME)}
|
||||
/>
|
||||
|
||||
<ActionButton
|
||||
icon="common/app"
|
||||
text={t('chat:sidebar.team_apps')}
|
||||
isCollapsed={false}
|
||||
isActive={isTeamAppsActive}
|
||||
onClick={() => onHomeClick(ChatSidebarPaneEnum.TEAM_APPS)}
|
||||
/>
|
||||
</Flex>
|
||||
<ActionButton
|
||||
icon="core/chat/sidebar/home"
|
||||
text={t('chat:sidebar.home')}
|
||||
isCollapsed={false}
|
||||
isActive={isHomeActive}
|
||||
onClick={() => onHomeClick(ChatSidebarPaneEnum.HOME)}
|
||||
/>
|
||||
</AnimatedSection>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
)}
|
||||
|
||||
<AnimatePresence mode="wait">
|
||||
{isCollapsed ? (
|
||||
<AnimatedSection show={true}>
|
||||
<ActionButton
|
||||
icon="common/app"
|
||||
isCollapsed={true}
|
||||
isActive={isTeamAppsActive}
|
||||
onClick={() => onHomeClick(ChatSidebarPaneEnum.TEAM_APPS)}
|
||||
/>
|
||||
</AnimatedSection>
|
||||
) : (
|
||||
<AnimatedSection show={true}>
|
||||
<ActionButton
|
||||
icon="common/app"
|
||||
text={t('chat:sidebar.team_apps')}
|
||||
isCollapsed={false}
|
||||
isActive={isTeamAppsActive}
|
||||
onClick={() => onHomeClick(ChatSidebarPaneEnum.TEAM_APPS)}
|
||||
/>
|
||||
</AnimatedSection>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
|
@@ -2,7 +2,7 @@ import { create, createJSONStorage, devtools, persist, immer } from '@fastgpt/we
|
||||
import { getNanoid } from '@fastgpt/global/common/string/tools';
|
||||
import { type OutLinkChatAuthProps } from '@fastgpt/global/support/permission/chat';
|
||||
import type { ChatSourceEnum } from '@fastgpt/global/core/chat/constants';
|
||||
import { ChatSidebarPaneEnum } from '@/pageComponents/chat/constants';
|
||||
import type { ChatSidebarPaneEnum } from '@/pageComponents/chat/constants';
|
||||
|
||||
type State = {
|
||||
source?: `${ChatSourceEnum}`;
|
||||
@@ -17,7 +17,7 @@ type State = {
|
||||
chatId: string;
|
||||
setChatId: (e?: string) => any;
|
||||
|
||||
lastPane: ChatSidebarPaneEnum;
|
||||
lastPane?: ChatSidebarPaneEnum;
|
||||
setLastPane: (e: ChatSidebarPaneEnum) => any;
|
||||
|
||||
outLinkAuthData: OutLinkChatAuthProps;
|
||||
@@ -115,7 +115,7 @@ export const useChatStore = create<State>()(
|
||||
state.lastChatAppId = e;
|
||||
});
|
||||
},
|
||||
lastPane: ChatSidebarPaneEnum.HOME,
|
||||
lastPane: undefined,
|
||||
setLastPane(e) {
|
||||
set((state) => {
|
||||
state.lastPane = e;
|
||||
|
Reference in New Issue
Block a user