diff --git a/src/const/meta.ts b/src/const/meta.ts new file mode 100644 index 000000000000..3d9f724dd6cc --- /dev/null +++ b/src/const/meta.ts @@ -0,0 +1,3 @@ +export const DEFAULT_AVATAR = 'πŸ€–'; +export const DEFAULT_USER_AVATAR = 'πŸ˜€'; +export const DEFAULT_BACKGROUND_COLOR = 'rgba(0,0,0,0)'; diff --git a/src/pages/chat/SessionList/List/SessionItem.tsx b/src/pages/chat/SessionList/List/SessionItem.tsx index 97c99a32dab1..024b0798ddde 100644 --- a/src/pages/chat/SessionList/List/SessionItem.tsx +++ b/src/pages/chat/SessionList/List/SessionItem.tsx @@ -7,7 +7,6 @@ import { Flexbox } from 'react-layout-kit'; import { shallow } from 'zustand/shallow'; import { chatSelectors, sessionSelectors, useSessionStore } from '@/store/session'; -import { DEFAULT_TITLE } from '@/store/session/slices/agentConfig'; import { useSettings } from '@/store/settings'; import { useStyles } from './style'; @@ -96,7 +95,7 @@ const SessionItem: FC = memo(({ id, active = true, loading }) } loading={loading} style={{ color: theme.colorText }} - title={title || t(DEFAULT_TITLE)} + title={title || t('defaultSession')} /> { const [backgroundColor, updateAgentMeta] = useSessionStore( diff --git a/src/store/session/slices/agentConfig/initialState.ts b/src/store/session/slices/agentConfig/initialState.ts index a553b1be2497..47596d246981 100644 --- a/src/store/session/slices/agentConfig/initialState.ts +++ b/src/store/session/slices/agentConfig/initialState.ts @@ -16,12 +16,6 @@ export const initialLobeAgentConfig: LobeAgentConfig = { systemRole: '', }; -export const DEFAULT_AVATAR = 'πŸ€–'; - -export const DEFAULT_BACKGROUND_COLOR = 'rgba(0,0,0,0)'; - -export const DEFAULT_TITLE = 'defaultSession'; - export const initialAgentConfigState: AgentConfigState = { // // loading 中间态 autocompleteLoading: { diff --git a/src/store/session/slices/agentConfig/selectors.ts b/src/store/session/slices/agentConfig/selectors.ts index b95a32cccb00..47e3dab129bf 100644 --- a/src/store/session/slices/agentConfig/selectors.ts +++ b/src/store/session/slices/agentConfig/selectors.ts @@ -1,10 +1,11 @@ +import { DEFAULT_AVATAR, DEFAULT_BACKGROUND_COLOR } from '@/const/meta'; import { SessionStore } from '@/store/session'; import { LanguageModel } from '@/types/llm'; import { MetaData } from '@/types/meta'; import { LobeAgentConfig } from '@/types/session'; import { sessionSelectors } from '../session'; -import { DEFAULT_AVATAR, DEFAULT_BACKGROUND_COLOR, initialLobeAgentConfig } from './initialState'; +import { initialLobeAgentConfig } from './initialState'; const currentAgentMeta = (s: SessionStore): MetaData => { const session = sessionSelectors.currentSession(s); diff --git a/src/store/session/slices/chat/selectors/chat.ts b/src/store/session/slices/chat/selectors/chat.ts index 87592124c2b1..fd0d9f92cc1d 100644 --- a/src/store/session/slices/chat/selectors/chat.ts +++ b/src/store/session/slices/chat/selectors/chat.ts @@ -1,9 +1,9 @@ +import { DEFAULT_USER_AVATAR } from '@/const/meta'; import { agentSelectors } from '@/store/session'; import { useSettings } from '@/store/settings'; import { ChatMessage } from '@/types/chatMessage'; import type { SessionStore } from '../../../store'; -import { DEFAULT_AVATAR } from '../../agentConfig'; import { sessionSelectors } from '../../session'; import { organizeChats } from './utils'; @@ -14,7 +14,7 @@ export const currentChats = (s: SessionStore): ChatMessage[] => { return organizeChats(session, { assistant: agentSelectors.currentAgentAvatar(s), - user: useSettings.getState().settings.avatar || DEFAULT_AVATAR, + user: useSettings.getState().settings.avatar || DEFAULT_USER_AVATAR, }); }; diff --git a/src/store/session/slices/session/selectors/chat.ts b/src/store/session/slices/session/selectors/chat.ts index 128bb5414be2..1849dca0a88e 100644 --- a/src/store/session/slices/session/selectors/chat.ts +++ b/src/store/session/slices/session/selectors/chat.ts @@ -1,4 +1,4 @@ -import { DEFAULT_AVATAR } from '@/store/session/slices/agentConfig'; +import { DEFAULT_AVATAR } from '@/const/meta'; import { MetaData } from '@/types/meta'; export const getAgentAvatar = (s: MetaData) => s.avatar || DEFAULT_AVATAR;