-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💄 style: fix mobile agent settings not show correctly (#6203)
* fix agent setting mobile * improve code * improve style for desktop * fix inbox issue * fix chat page issue * fix desktop style * refactor the store code * fix navigation issue
- Loading branch information
Showing
28 changed files
with
220 additions
and
111 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
3 changes: 1 addition & 2 deletions
3
src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/index.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
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
45 changes: 0 additions & 45 deletions
45
src/app/[variants]/(main)/chat/settings/features/EditPage.tsx
This file was deleted.
Oops, something went wrong.
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,7 +1,97 @@ | ||
import EditPage from './features/EditPage'; | ||
'use client'; | ||
|
||
const Page = () => { | ||
return <EditPage />; | ||
}; | ||
import { TabsNav } from '@lobehub/ui'; | ||
import isEqual from 'fast-deep-equal'; | ||
import { memo, useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
export default Page; | ||
import PageTitle from '@/components/PageTitle'; | ||
import { INBOX_SESSION_ID } from '@/const/session'; | ||
import { AgentSettingsProvider } from '@/features/AgentSetting'; | ||
import AgentChat from '@/features/AgentSetting/AgentChat'; | ||
import AgentMeta from '@/features/AgentSetting/AgentMeta'; | ||
import AgentModal from '@/features/AgentSetting/AgentModal'; | ||
import AgentPlugin from '@/features/AgentSetting/AgentPlugin'; | ||
import AgentPrompt from '@/features/AgentSetting/AgentPrompt'; | ||
import AgentTTS from '@/features/AgentSetting/AgentTTS'; | ||
import { useAgentStore } from '@/store/agent'; | ||
import { agentSelectors } from '@/store/agent/selectors'; | ||
import { ChatSettingsTabs } from '@/store/global/initialState'; | ||
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig'; | ||
import { useSessionStore } from '@/store/session'; | ||
import { sessionMetaSelectors } from '@/store/session/selectors'; | ||
|
||
const EditPage = memo(() => { | ||
const { t } = useTranslation('setting'); | ||
const [tab, setTab] = useState(ChatSettingsTabs.Prompt); | ||
|
||
const [id, updateAgentMeta, title] = useSessionStore((s) => [ | ||
s.activeId, | ||
s.updateSessionMeta, | ||
sessionMetaSelectors.currentAgentTitle(s), | ||
]); | ||
const [useFetchAgentConfig, updateAgentConfig] = useAgentStore((s) => [ | ||
s.useFetchAgentConfig, | ||
s.updateAgentConfig, | ||
]); | ||
|
||
const config = useAgentStore(agentSelectors.currentAgentConfig, isEqual); | ||
const meta = useSessionStore(sessionMetaSelectors.currentAgentMeta, isEqual); | ||
|
||
const { isLoading } = useFetchAgentConfig(id); | ||
const { enablePlugins } = useServerConfigStore(featureFlagsSelectors); | ||
|
||
return ( | ||
<> | ||
<PageTitle title={t('header.sessionWithName', { name: title })} /> | ||
|
||
<TabsNav | ||
items={[ | ||
{ | ||
key: ChatSettingsTabs.Prompt, | ||
label: t('settingAgent.prompt.title'), | ||
}, | ||
(id !== INBOX_SESSION_ID && { | ||
key: ChatSettingsTabs.Meta, | ||
label: t('settingAgent.title'), | ||
}) as any, | ||
{ | ||
key: ChatSettingsTabs.Chat, | ||
label: t('settingChat.title'), | ||
}, | ||
{ | ||
key: ChatSettingsTabs.Modal, | ||
label: t('settingModel.title'), | ||
}, | ||
{ | ||
key: ChatSettingsTabs.TTS, | ||
label: t('settingTTS.title'), | ||
}, | ||
(enablePlugins && { | ||
key: ChatSettingsTabs.Plugin, | ||
label: t('settingPlugin.title'), | ||
}) as any, | ||
]} | ||
onChange={(value) => setTab(value as ChatSettingsTabs)} | ||
variant={'compact'} | ||
/> | ||
<AgentSettingsProvider | ||
config={config} | ||
id={id} | ||
loading={isLoading} | ||
meta={meta} | ||
onConfigChange={updateAgentConfig} | ||
onMetaChange={updateAgentMeta} | ||
> | ||
{tab === ChatSettingsTabs.Prompt && <AgentPrompt modal />} | ||
{tab === ChatSettingsTabs.Meta && <AgentMeta />} | ||
{tab === ChatSettingsTabs.Chat && <AgentChat />} | ||
{tab === ChatSettingsTabs.Modal && <AgentModal />} | ||
{tab === ChatSettingsTabs.TTS && <AgentTTS />} | ||
{tab === ChatSettingsTabs.Plugin && <AgentPlugin />} | ||
</AgentSettingsProvider> | ||
</> | ||
); | ||
}); | ||
|
||
export default EditPage; |
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
Oops, something went wrong.