diff --git a/src/app/(main)/chat/[id]/Drawer/Profile.tsx b/src/app/(main)/chat/[id]/Drawer/Profile.tsx
index 88247d6..3c17ce8 100644
--- a/src/app/(main)/chat/[id]/Drawer/Profile.tsx
+++ b/src/app/(main)/chat/[id]/Drawer/Profile.tsx
@@ -18,12 +18,6 @@ import { useModels } from '@/hooks/services/chat';
import { toast } from 'sonner';
import { useTranslations } from 'next-intl';
-const genderMap = {
- 0: '/icons/male.svg',
- 1: '/icons/female.svg',
- 2: '/icons/gender-neutral.svg',
-};
-
const ChatProfilePersona = React.memo(({ onActiveTab }: ProfileProps) => {
const t = useTranslations('chat.drawer');
const tCommon = useTranslations('common');
@@ -32,9 +26,7 @@ const ChatProfilePersona = React.memo(({ onActiveTab }: ProfileProps) => {
const items = [
{
label: t('profile.gender'),
- value: (
-
- ),
+ value: tCommon(`gender_${0}`),
},
{
label: t('profile.age'),
@@ -63,7 +55,7 @@ const ChatProfilePersona = React.memo(({ onActiveTab }: ProfileProps) => {
onClick={() => onActiveTab('mask_list')}
className="bg-surface-element-normal cursor-pointer rounded-m flex items-center justify-between gap-4 px-4 py-3"
>
-
{t('profile.nickname')}
+ {t('profile.preset')}
{'John Doe'}
diff --git a/src/app/(main)/chat/[id]/stream-chat.ts b/src/app/(main)/chat/[id]/stream-chat.ts
index 4a7c0f7..454ad26 100644
--- a/src/app/(main)/chat/[id]/stream-chat.ts
+++ b/src/app/(main)/chat/[id]/stream-chat.ts
@@ -144,7 +144,9 @@ export const useStreamChatStore = create
((set, get) => ({
async connect(user) {
const { client, queryChannels, fetchUserChatSetting } = get();
set({ user });
- if (client) return;
+ if (client) {
+ return;
+ }
const { data } = await getUserToken(user);
const streamClient = new StreamChat(process.env.NEXT_PUBLIC_STREAM_CHAT_API_KEY || '');
await protect(() =>
diff --git a/src/i18n/en-US.ts b/src/i18n/en-US.ts
index 3985ea7..b61aca1 100644
--- a/src/i18n/en-US.ts
+++ b/src/i18n/en-US.ts
@@ -1,11 +1,13 @@
export default {
- hello: 'Hello',
common: {
search: 'Search',
cancel: 'Cancel',
edit: 'Edit',
select: 'Select',
default: 'Default',
+ gender_0: 'Male',
+ gender_1: 'Female',
+ gender_2: 'Other',
},
bottomBar: {
explore: 'Explore',
@@ -39,7 +41,7 @@ export default {
background: 'Background',
model: 'Chat Model',
profile: {
- nickname: 'Nickname',
+ preset: 'Preset',
gender: 'Gender',
age: 'Age',
whoAmI: 'Who am I',
diff --git a/src/i18n/zh-CN.ts b/src/i18n/zh-CN.ts
index 9dec178..ee0f19a 100644
--- a/src/i18n/zh-CN.ts
+++ b/src/i18n/zh-CN.ts
@@ -1,11 +1,13 @@
export default {
- hello: '你好',
common: {
search: '搜索',
cancel: '取消',
edit: '编辑',
select: '选择',
default: '默认',
+ gender_0: '男性',
+ gender_1: '女性',
+ gender_2: '其他',
},
bottomBar: {
explore: '首页',
@@ -39,7 +41,7 @@ export default {
background: '背景',
model: '聊天模型',
profile: {
- nickname: '昵称',
+ preset: '预设',
gender: '性别',
age: '年龄',
whoAmI: '我是谁',
diff --git a/src/layout/BasicLayout/Topbar.tsx b/src/layout/BasicLayout/Topbar.tsx
index 00aefb3..32fe44a 100644
--- a/src/layout/BasicLayout/Topbar.tsx
+++ b/src/layout/BasicLayout/Topbar.tsx
@@ -77,47 +77,35 @@ function Topbar() {
const rightDomRender = () => {
if (!response || isLoading) return null;
- const items = [
- {
- dom: ,
- },
- {
- hide: !user,
- dom: ,
- },
- {
- hide: !user,
- dom: (
+ return (
+
+
+ {user &&
}
+ {user && (
- {user!.nickname?.slice(0, 1)}
+ {user?.nickname?.slice(0, 1)}
- ),
- },
- {
- hide: user,
- dom: (
+ )}
+ {!user && (
- ),
- },
- ].filter((item) => !item.hide);
-
- return
{items.map((item) => item.dom)}
;
+ )}
+
+ );
};
// 移动端根据配置决定是否隐藏 Topbar
- const isMobile = response && !response.sm;
- if (isMobile && routeConfig.hideOnMobile) {
+ if (response?.isMobile && routeConfig.hideOnMobile) {
return null;
}
diff --git a/src/layout/BasicLayout/index.tsx b/src/layout/BasicLayout/index.tsx
index aaa70f0..c951c7c 100644
--- a/src/layout/BasicLayout/index.tsx
+++ b/src/layout/BasicLayout/index.tsx
@@ -52,13 +52,13 @@ export default function ConditionalLayout({ children }: ConditionalLayoutProps)
return (
- {response?.sm &&
}
+ {response?.isPC &&
}
{children}
- {response && !response.sm && }
+ {response?.isMobile && }
{/*
*/}
{/*
*/}
diff --git a/src/layout/ProfileLayout/index.tsx b/src/layout/ProfileLayout/index.tsx
index 50d77ab..30c0956 100644
--- a/src/layout/ProfileLayout/index.tsx
+++ b/src/layout/ProfileLayout/index.tsx
@@ -28,7 +28,7 @@ export default function ProfileLayout(props: ProfileLayoutProps) {
{rightDom}
{children}
- {bottomButton && response && !response.sm && (
+ {bottomButton && response?.isMobile && (
{bottomButton}
)}