-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into testgru-src-utils-server-geo.ts-1739055523439
- Loading branch information
1 parent
621cc12
commit 4342b53
Showing
15 changed files
with
274 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@lobehub/chat", | ||
"version": "1.52.4", | ||
"version": "1.53.5", | ||
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.", | ||
"keywords": [ | ||
"framework", | ||
|
@@ -126,7 +126,7 @@ | |
"@lobehub/charts": "^1.12.0", | ||
"@lobehub/chat-plugin-sdk": "^1.32.4", | ||
"@lobehub/chat-plugins-gateway": "^1.9.0", | ||
"@lobehub/icons": "^1.61.1", | ||
"@lobehub/icons": "^1.69.0", | ||
"@lobehub/tts": "^1.28.0", | ||
"@lobehub/ui": "^1.164.10", | ||
"@neondatabase/serverless": "^0.10.4", | ||
|
@@ -291,7 +291,7 @@ | |
"fs-extra": "^11.2.0", | ||
"glob": "^11.0.0", | ||
"gray-matter": "^4.0.3", | ||
"happy-dom": "^16.5.2", | ||
"happy-dom": "^17.0.0", | ||
"husky": "^9.1.7", | ||
"just-diff": "^6.0.2", | ||
"lint-staged": "^15.3.0", | ||
|
@@ -319,7 +319,7 @@ | |
"vitest": "~1.2.2", | ||
"vitest-canvas-mock": "^0.3.3" | ||
}, | ||
"packageManager": "[email protected].4", | ||
"packageManager": "[email protected].5", | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client'; | ||
|
||
import { useLayoutEffect } from 'react'; | ||
|
||
import { useQueryRoute } from '@/hooks/useQueryRoute'; | ||
|
||
/** | ||
* @description: Chat Settings Modal (intercepting routes fallback when hard refresh) | ||
* @example: /chat/settings/modal?tab=prompt => /chat/settings | ||
* @refs: https://github.com/lobehub/lobe-chat/discussions/2295#discussioncomment-9290942 | ||
*/ | ||
|
||
const ChatSettingsModalFallback = () => { | ||
const router = useQueryRoute(); | ||
|
||
useLayoutEffect(() => { | ||
router.replace('/chat/settings', { query: { tab: '' } }); | ||
}, []); | ||
|
||
return null; | ||
}; | ||
|
||
export default ChatSettingsModalFallback; |
61 changes: 61 additions & 0 deletions
61
src/app/[variants]/@modal/chat/(.)settings/modal/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
'use client'; | ||
|
||
import { Skeleton } from 'antd'; | ||
import isEqual from 'fast-deep-equal'; | ||
import dynamic from 'next/dynamic'; | ||
import { PropsWithChildren, memo } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import ModalLayout from '@/app/[variants]/@modal/_layout/ModalLayout'; | ||
import StoreUpdater from '@/features/AgentSetting/StoreUpdater'; | ||
import { Provider, createStore } from '@/features/AgentSetting/store'; | ||
import { useChatSettingsTab } from '@/hooks/useChatSettingsTab'; | ||
import { useAgentStore } from '@/store/agent'; | ||
import { agentSelectors } from '@/store/agent/slices/chat'; | ||
import { ChatSettingsTabs } from '@/store/global/initialState'; | ||
import { useSessionStore } from '@/store/session'; | ||
import { sessionMetaSelectors } from '@/store/session/selectors'; | ||
|
||
import SettingModalLayout from '../../../_layout/SettingModalLayout'; | ||
|
||
const CategoryContent = dynamic(() => import('./features/CategoryContent'), { | ||
loading: () => <Skeleton paragraph={{ rows: 6 }} title={false} />, | ||
ssr: false, | ||
}); | ||
|
||
const Layout = memo<PropsWithChildren>(({ children }) => { | ||
const tab = useChatSettingsTab(); | ||
const { t } = useTranslation('setting'); | ||
const id = useSessionStore((s) => s.activeId); | ||
const config = useAgentStore(agentSelectors.currentAgentConfig, isEqual); | ||
const meta = useSessionStore(sessionMetaSelectors.currentAgentMeta, isEqual); | ||
const [updateAgentConfig] = useAgentStore((s) => [s.updateAgentConfig]); | ||
const [updateAgentMeta] = useSessionStore((s) => [ | ||
s.updateSessionMeta, | ||
sessionMetaSelectors.currentAgentTitle(s), | ||
]); | ||
|
||
return ( | ||
<ModalLayout> | ||
<SettingModalLayout | ||
activeTitle={t(`agentTab.${tab as ChatSettingsTabs}`)} | ||
category={<CategoryContent />} | ||
desc={t('header.sessionDesc')} | ||
title={t('header.session')} | ||
> | ||
<Provider createStore={createStore}> | ||
<StoreUpdater | ||
config={config} | ||
id={id} | ||
meta={meta} | ||
onConfigChange={updateAgentConfig} | ||
onMetaChange={updateAgentMeta} | ||
/> | ||
{children} | ||
</Provider> | ||
</SettingModalLayout> | ||
</ModalLayout> | ||
); | ||
}); | ||
|
||
export default Layout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { Skeleton } from 'antd'; | ||
|
||
export default () => { | ||
return <Skeleton paragraph={{ rows: 6 }} style={{ paddingBlock: 16 }} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
'use client'; | ||
|
||
import dynamic from 'next/dynamic'; | ||
|
||
import { useChatSettingsTab } from '@/hooks/useChatSettingsTab'; | ||
import { ChatSettingsTabs } from '@/store/global/initialState'; | ||
|
||
import Skeleton from './loading'; | ||
|
||
const loading = () => <Skeleton />; | ||
|
||
const AgentMeta = dynamic(() => import('@/features/AgentSetting/AgentMeta'), { | ||
loading, | ||
ssr: false, | ||
}); | ||
const AgentChat = dynamic(() => import('@/features/AgentSetting/AgentChat'), { | ||
loading, | ||
ssr: false, | ||
}); | ||
const AgentPrompt = dynamic(() => import('@/features/AgentSetting/AgentPrompt'), { | ||
loading, | ||
ssr: false, | ||
}); | ||
const AgentPlugin = dynamic(() => import('@/features/AgentSetting/AgentPlugin'), { | ||
loading, | ||
ssr: false, | ||
}); | ||
const AgentModal = dynamic(() => import('@/features/AgentSetting/AgentModal'), { | ||
loading, | ||
ssr: false, | ||
}); | ||
const AgentTTS = dynamic(() => import('@/features/AgentSetting/AgentTTS'), { loading, ssr: false }); | ||
|
||
/** | ||
* @description: Agent Settings Modal (intercepting route: /chat/settings/modal ) | ||
* @refs: https://github.com/lobehub/lobe-chat/discussions/2295#discussioncomment-9290942 | ||
*/ | ||
|
||
const Page = () => { | ||
const tab = useChatSettingsTab(); | ||
|
||
return ( | ||
<> | ||
{tab === ChatSettingsTabs.Meta && <AgentMeta />} | ||
{tab === ChatSettingsTabs.Prompt && <AgentPrompt modal />} | ||
{tab === ChatSettingsTabs.Chat && <AgentChat />} | ||
{tab === ChatSettingsTabs.Modal && <AgentModal />} | ||
{tab === ChatSettingsTabs.TTS && <AgentTTS />} | ||
{tab === ChatSettingsTabs.Plugin && <AgentPlugin />} | ||
</> | ||
); | ||
}; | ||
|
||
Page.displayName = 'AgentSettingModal'; | ||
|
||
export default Page; |
Oops, something went wrong.