@lobehub/chat 0.152.0 → 0.152.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/locales/ar/common.json +14 -0
- package/locales/ar/setting.json +4 -1
- package/locales/bg-BG/common.json +14 -0
- package/locales/bg-BG/setting.json +4 -1
- package/locales/de-DE/common.json +14 -0
- package/locales/de-DE/setting.json +4 -1
- package/locales/en-US/common.json +14 -0
- package/locales/en-US/setting.json +4 -1
- package/locales/es-ES/common.json +14 -0
- package/locales/es-ES/setting.json +4 -1
- package/locales/fr-FR/common.json +14 -0
- package/locales/fr-FR/setting.json +4 -1
- package/locales/it-IT/common.json +14 -0
- package/locales/it-IT/setting.json +4 -1
- package/locales/ja-JP/common.json +14 -0
- package/locales/ja-JP/setting.json +4 -1
- package/locales/ko-KR/common.json +14 -0
- package/locales/ko-KR/setting.json +4 -1
- package/locales/nl-NL/common.json +14 -0
- package/locales/nl-NL/setting.json +4 -1
- package/locales/pl-PL/common.json +14 -0
- package/locales/pl-PL/setting.json +4 -1
- package/locales/pt-BR/common.json +14 -0
- package/locales/pt-BR/setting.json +4 -1
- package/locales/ru-RU/common.json +14 -0
- package/locales/ru-RU/setting.json +4 -1
- package/locales/tr-TR/common.json +14 -0
- package/locales/tr-TR/setting.json +4 -1
- package/locales/vi-VN/common.json +14 -0
- package/locales/vi-VN/setting.json +4 -1
- package/locales/zh-CN/common.json +14 -0
- package/locales/zh-CN/setting.json +4 -1
- package/locales/zh-TW/common.json +14 -0
- package/locales/zh-TW/setting.json +4 -1
- package/package.json +1 -1
- package/src/app/(main)/(mobile)/me/features/AvatarBanner.tsx +52 -0
- package/src/app/(main)/(mobile)/me/features/Cate.tsx +34 -0
- package/src/app/(main)/(mobile)/me/features/ExtraCate.tsx +26 -0
- package/src/app/(main)/(mobile)/me/features/useExtraCate.tsx +68 -0
- package/src/app/(main)/(mobile)/me/layout.tsx +11 -0
- package/src/app/(main)/(mobile)/me/loading.tsx +17 -0
- package/src/app/(main)/(mobile)/me/page.tsx +31 -0
- package/src/app/(main)/@nav/_layout/Desktop/BottomActions.tsx +7 -120
- package/src/app/(main)/@nav/_layout/Desktop/index.tsx +7 -2
- package/src/app/(main)/@nav/_layout/Mobile.tsx +3 -3
- package/src/app/(main)/@nav/features/UserAvatar.tsx +24 -0
- package/src/app/(main)/@nav/features/UserPanel/LangButton.tsx +55 -0
- package/src/app/(main)/@nav/features/UserPanel/Popover.tsx +34 -0
- package/src/app/(main)/@nav/features/UserPanel/ThemeButton.tsx +70 -0
- package/src/app/(main)/@nav/features/UserPanel/UserInfo.tsx +35 -0
- package/src/app/(main)/@nav/features/UserPanel/index.tsx +69 -0
- package/src/app/(main)/@nav/features/UserPanel/useMenu.tsx +144 -0
- package/src/app/(main)/@nav/features/UserPanel/useNewVersion.tsx +12 -0
- package/src/app/(main)/chat/(mobile)/features/SessionHeader.tsx +1 -1
- package/src/app/(main)/chat/_layout/Desktop/index.tsx +6 -8
- package/src/app/(main)/chat/_layout/Mobile/index.tsx +5 -3
- package/src/app/(main)/chat/_layout/type.ts +5 -0
- package/src/app/(main)/chat/features/SettingButton.tsx +5 -2
- package/src/app/(main)/chat/layout.ts +5 -2
- package/src/app/(main)/chat/settings/{(desktop) → _layout/Desktop}/Header.tsx +2 -0
- package/src/app/(main)/chat/settings/_layout/Desktop/index.tsx +32 -0
- package/src/app/(main)/chat/settings/{(mobile) → _layout/Mobile}/Header.tsx +3 -2
- package/src/app/(main)/chat/settings/_layout/Mobile/index.tsx +15 -0
- package/src/app/(main)/chat/settings/error.tsx +5 -0
- package/src/app/(main)/chat/settings/features/HeaderContent.tsx +15 -9
- package/src/app/(main)/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +2 -0
- package/src/app/(main)/chat/settings/features/SubmitAgentButton/index.tsx +16 -8
- package/src/app/(main)/chat/settings/layout.tsx +9 -2
- package/src/app/(main)/chat/settings/loading.tsx +3 -0
- package/src/app/(main)/chat/settings/not-found.tsx +3 -0
- package/src/app/(main)/chat/settings/page.tsx +2 -9
- package/src/app/(main)/market/@detail/default.tsx +12 -0
- package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Header.tsx +30 -21
- package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/index.tsx +10 -4
- package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/style.ts +7 -11
- package/src/app/(main)/market/@detail/loading.tsx +1 -0
- package/src/app/(main)/market/_layout/Desktop/{AgentDetail.tsx → DetailSidebar.tsx} +17 -12
- package/src/app/(main)/market/_layout/Desktop/Header.tsx +3 -6
- package/src/app/(main)/market/_layout/Desktop/Hero.tsx +39 -0
- package/src/app/(main)/market/_layout/Desktop/index.tsx +24 -44
- package/src/app/(main)/market/{(mobile)/features/AgentDetail.tsx → _layout/Mobile/DetailModal.tsx} +9 -7
- package/src/app/(main)/market/_layout/Mobile/Header.tsx +2 -2
- package/src/app/(main)/market/_layout/Mobile/index.tsx +17 -9
- package/src/app/(main)/market/_layout/type.ts +6 -0
- package/src/app/(main)/market/features/AgentCard/AgentCardBanner.tsx +10 -9
- package/src/app/(main)/market/features/AgentCard/index.tsx +133 -58
- package/src/app/(main)/market/features/AgentList.tsx +94 -0
- package/src/app/(main)/market/features/AgentSearchBar.tsx +42 -0
- package/src/app/(main)/market/features/ShareAgentButton/Inner.tsx +9 -7
- package/src/app/(main)/market/features/ShareAgentButton/index.tsx +22 -15
- package/src/app/(main)/market/features/TagList.tsx +65 -0
- package/src/app/(main)/market/layout.tsx +11 -0
- package/src/app/(main)/market/loading.tsx +2 -2
- package/src/app/(main)/market/page.tsx +22 -12
- package/src/app/(main)/settings/@category/default.tsx +16 -0
- package/src/app/(main)/settings/@category/features/CategoryContent.tsx +35 -0
- package/src/app/(main)/settings/@category/features/UpgradeAlert.tsx +38 -0
- package/src/app/(main)/settings/_layout/Desktop/Header.tsx +78 -23
- package/src/app/(main)/settings/_layout/Desktop/SideBar.tsx +39 -27
- package/src/app/(main)/settings/_layout/Desktop/index.tsx +41 -17
- package/src/app/(main)/settings/_layout/Mobile/{SubSettingHeader.tsx → Header.tsx} +3 -1
- package/src/app/(main)/settings/_layout/Mobile/index.tsx +7 -18
- package/src/app/(main)/settings/_layout/type.ts +6 -0
- package/src/app/(main)/settings/about/features/AboutList.tsx +122 -0
- package/src/app/(main)/settings/about/features/Analytics.tsx +42 -0
- package/src/app/(main)/settings/about/layout.tsx +26 -0
- package/src/app/(main)/settings/about/loading.tsx +5 -0
- package/src/app/(main)/settings/about/page.tsx +20 -25
- package/src/app/(main)/settings/agent/layout.tsx +35 -0
- package/src/app/(main)/settings/agent/loading.tsx +4 -2
- package/src/app/(main)/settings/agent/page.tsx +25 -12
- package/src/app/(main)/settings/common/{Common.tsx → features/Common.tsx} +7 -5
- package/src/app/(main)/settings/common/{Theme.tsx → features/Theme/index.tsx} +8 -6
- package/src/app/(main)/settings/common/page.tsx +21 -4
- package/src/app/(main)/settings/error.tsx +5 -0
- package/src/app/(main)/settings/features/Footer.tsx +2 -0
- package/src/app/(main)/settings/features/UpgradeAlert.tsx +21 -13
- package/src/app/(main)/settings/hooks/useCategory.tsx +54 -0
- package/src/app/(main)/settings/hooks/useSyncSettings.ts +2 -2
- package/src/app/(main)/settings/layout.ts +4 -1
- package/src/app/(main)/settings/llm/Anthropic/index.tsx +4 -10
- package/src/app/(main)/settings/llm/Azure/index.tsx +3 -1
- package/src/app/(main)/settings/llm/Bedrock/index.tsx +3 -1
- package/src/app/(main)/settings/llm/Google/index.tsx +4 -2
- package/src/app/(main)/settings/llm/Groq/index.tsx +3 -1
- package/src/app/(main)/settings/llm/Minimax/index.tsx +3 -9
- package/src/app/(main)/settings/llm/Mistral/index.tsx +3 -9
- package/src/app/(main)/settings/llm/Moonshot/index.tsx +3 -1
- package/src/app/(main)/settings/llm/Ollama/index.tsx +3 -1
- package/src/app/(main)/settings/llm/OpenAI/index.tsx +2 -0
- package/src/app/(main)/settings/llm/OpenRouter/index.tsx +3 -9
- package/src/app/(main)/settings/llm/Perplexity/index.tsx +3 -9
- package/src/app/(main)/settings/llm/TogetherAI/index.tsx +3 -9
- package/src/app/(main)/settings/llm/ZeroOne/index.tsx +3 -9
- package/src/app/(main)/settings/llm/Zhipu/index.tsx +3 -10
- package/src/app/(main)/settings/llm/components/Checker.tsx +2 -0
- package/src/app/(main)/settings/llm/components/Footer.tsx +26 -0
- package/src/app/(main)/settings/llm/components/ProviderConfig/index.tsx +16 -1
- package/src/app/(main)/settings/llm/page.tsx +57 -3
- package/src/app/(main)/settings/loading.tsx +9 -0
- package/src/app/(main)/settings/not-found.tsx +3 -0
- package/src/app/(main)/settings/page.tsx +2 -14
- package/src/app/(main)/settings/sync/{DeviceInfo → features/DeviceInfo}/Card.tsx +6 -5
- package/src/app/(main)/settings/sync/features/DeviceInfo/DeviceName.tsx +63 -0
- package/src/app/(main)/settings/sync/{components → features/DeviceInfo}/SystemIcon.tsx +6 -14
- package/src/app/(main)/settings/sync/{DeviceInfo → features/DeviceInfo}/index.tsx +22 -36
- package/src/app/(main)/settings/sync/{WebRTC → features/WebRTC}/ChannelNameInput.tsx +3 -3
- package/src/app/(main)/settings/sync/{WebRTC → features/WebRTC}/index.tsx +10 -9
- package/src/app/(main)/settings/sync/page.tsx +19 -11
- package/src/app/(main)/settings/tts/features/OpenAI.tsx +54 -0
- package/src/app/(main)/settings/tts/{TTS/index.tsx → features/STT.tsx} +11 -27
- package/src/app/(main)/settings/tts/page.tsx +17 -11
- package/src/app/@modal/(.)settings/about/layout.tsx +1 -0
- package/src/app/@modal/(.)settings/about/page.tsx +1 -0
- package/src/app/@modal/(.)settings/agent/layout.tsx +1 -0
- package/src/app/@modal/(.)settings/agent/page.tsx +1 -0
- package/src/app/@modal/(.)settings/common/page.tsx +1 -0
- package/src/app/@modal/(.)settings/layout.tsx +28 -0
- package/src/app/@modal/(.)settings/llm/page.tsx +1 -0
- package/src/app/@modal/(.)settings/loading.tsx +5 -0
- package/src/app/@modal/(.)settings/sync/page.tsx +1 -0
- package/src/app/@modal/(.)settings/tts/page.tsx +1 -0
- package/src/app/@modal/_layout/SettingModalLayout.tsx +59 -0
- package/src/app/@modal/chat/(.)settings/features/CategoryContent.tsx +36 -0
- package/src/app/@modal/chat/(.)settings/features/useCategory.tsx +62 -0
- package/src/app/@modal/chat/(.)settings/layout.tsx +55 -0
- package/src/app/@modal/chat/(.)settings/loading.tsx +5 -0
- package/src/app/@modal/chat/(.)settings/page.tsx +40 -0
- package/src/app/@modal/default.tsx +1 -0
- package/src/app/@modal/layout.tsx +30 -0
- package/src/app/@modal/loading.tsx +5 -0
- package/src/app/layout.tsx +11 -3
- package/src/components/BrandWatermark/index.tsx +39 -0
- package/src/components/Cell/Divider.tsx +19 -0
- package/src/components/Cell/index.tsx +38 -0
- package/src/components/Menu/index.tsx +97 -0
- package/src/components/SkeletonLoading/index.tsx +21 -0
- package/src/const/url.ts +1 -0
- package/src/features/AgentSetting/AgentChat/index.tsx +135 -0
- package/src/features/AgentSetting/AgentMeta/index.tsx +4 -3
- package/src/features/AgentSetting/AgentModal/index.tsx +95 -0
- package/src/features/AgentSetting/AgentPlugin/index.tsx +65 -66
- package/src/features/AgentSetting/AgentPrompt/index.tsx +101 -47
- package/src/features/AgentSetting/AgentTTS/index.tsx +4 -0
- package/src/features/AgentSetting/StoreUpdater.tsx +2 -0
- package/src/features/AgentSetting/index.tsx +6 -6
- package/src/features/AgentSetting/store/index.ts +2 -0
- package/src/features/AvatarWithUpload/index.tsx +2 -0
- package/src/features/ChatInput/STT/browser.tsx +1 -1
- package/src/features/ChatInput/STT/openai.tsx +1 -1
- package/src/features/Conversation/components/InboxWelcome/AgentsSuggest.tsx +2 -2
- package/src/hooks/useQuery.ts +7 -0
- package/src/hooks/useQueryRoute.ts +16 -0
- package/src/locales/default/common.ts +14 -0
- package/src/locales/default/setting.ts +3 -0
- package/src/locales/resources.ts +1 -0
- package/src/server/redirectHard.ts +9 -0
- package/src/server/translation.ts +20 -0
- package/src/services/__tests__/chat.test.ts +1 -1
- package/src/store/global/initialState.ts +1 -0
- package/src/store/market/action.ts +1 -1
- package/src/store/session/slices/session/action.ts +1 -1
- package/src/utils/difference.ts +2 -1
- package/src/app/(main)/@nav/_layout/Desktop/Avatar.tsx +0 -11
- package/src/app/(main)/chat/settings/(desktop)/index.tsx +0 -23
- package/src/app/(main)/chat/settings/(mobile)/index.tsx +0 -16
- package/src/app/(main)/market/(desktop)/index.tsx +0 -20
- package/src/app/(main)/market/(mobile)/features/AgentCard.tsx +0 -31
- package/src/app/(main)/market/(mobile)/index.tsx +0 -25
- package/src/app/(main)/market/components/Loading.tsx +0 -13
- package/src/app/(main)/market/features/AgentCard/AgentCardItem.tsx +0 -54
- package/src/app/(main)/market/features/AgentCard/style.ts +0 -33
- package/src/app/(main)/market/features/AgentDetailContent/index.tsx +0 -12
- package/src/app/(main)/market/features/AgentSearchBar/index.tsx +0 -40
- package/src/app/(main)/market/features/PageTitle/index.tsx +0 -13
- package/src/app/(main)/market/features/TagList/Inner.tsx +0 -28
- package/src/app/(main)/market/features/TagList/index.tsx +0 -23
- package/src/app/(main)/market/layout.ts +0 -8
- package/src/app/(main)/settings/(desktop)/index.tsx +0 -23
- package/src/app/(main)/settings/(mobile)/features/AvatarBanner.tsx +0 -68
- package/src/app/(main)/settings/(mobile)/features/ExtraList.tsx +0 -65
- package/src/app/(main)/settings/(mobile)/index.tsx +0 -53
- package/src/app/(main)/settings/about/AboutList.tsx +0 -53
- package/src/app/(main)/settings/about/Analytics.tsx +0 -40
- package/src/app/(main)/settings/about/style.ts +0 -22
- package/src/app/(main)/settings/agent/Agent.tsx +0 -29
- package/src/app/(main)/settings/common/index.tsx +0 -24
- package/src/app/(main)/settings/common/loading.tsx +0 -3
- package/src/app/(main)/settings/features/SettingList/index.tsx +0 -47
- package/src/app/(main)/settings/llm/index.tsx +0 -59
- package/src/app/(main)/settings/llm/layout.tsx +0 -11
- package/src/app/(main)/settings/llm/loading.tsx +0 -3
- package/src/app/(main)/settings/sync/DeviceInfo/DeviceName.tsx +0 -66
- package/src/app/(main)/settings/sync/PageTitle.tsx +0 -11
- package/src/app/(main)/settings/sync/layout.tsx +0 -12
- package/src/app/(main)/settings/sync/loading.tsx +0 -3
- package/src/app/(main)/settings/tts/loading.tsx +0 -3
- package/src/features/AgentSetting/AgentConfig/index.tsx +0 -202
- package/src/features/AgentSetting/AgentConfig/useSyncConfig.ts +0 -23
- /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Comment.tsx +0 -0
- /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Loading.tsx +0 -0
- /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/TokenTag.tsx +0 -0
- /package/src/app/(main)/settings/{features/SettingList → about/features}/Item.tsx +0 -0
- /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/ThemeSwatchesNeutral.tsx +0 -0
- /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/ThemeSwatchesPrimary.tsx +0 -0
- /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/index.ts +0 -0
- /package/src/app/(main)/settings/sync/{Alert.tsx → features/Alert.tsx} +0 -0
- /package/src/app/(main)/settings/sync/{components → features/WebRTC}/SyncSwitch/index.css +0 -0
- /package/src/app/(main)/settings/sync/{components → features/WebRTC}/SyncSwitch/index.tsx +0 -0
- /package/src/app/(main)/settings/sync/{util.ts → features/WebRTC/generateRandomRoomName.ts} +0 -0
- /package/src/app/(main)/settings/tts/{TTS/options.ts → features/const.ts} +0 -0
- /package/src/features/AgentSetting/{AgentConfig → AgentModal}/ModelSelect.tsx +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useRouter } from 'next/navigation';
|
|
2
|
+
import qs, { type ParsedQuery } from 'query-string';
|
|
3
|
+
|
|
4
|
+
import { useQuery } from '@/hooks/useQuery';
|
|
5
|
+
|
|
6
|
+
export const useQueryRoute = () => {
|
|
7
|
+
const router = useRouter();
|
|
8
|
+
const parseQuery = useQuery();
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
push: (url: string, query?: ParsedQuery) =>
|
|
12
|
+
router.push(qs.stringifyUrl({ query: { ...parseQuery, ...query }, url })),
|
|
13
|
+
replace: (url: string, query?: ParsedQuery) =>
|
|
14
|
+
router.replace(qs.stringifyUrl({ query: { ...parseQuery, ...query }, url })),
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -133,6 +133,7 @@ export default {
|
|
|
133
133
|
tab: {
|
|
134
134
|
chat: '会话',
|
|
135
135
|
market: '发现',
|
|
136
|
+
me: '我',
|
|
136
137
|
setting: '设置',
|
|
137
138
|
},
|
|
138
139
|
telemetry: {
|
|
@@ -151,4 +152,17 @@ export default {
|
|
|
151
152
|
hasNew: '有可用更新',
|
|
152
153
|
newVersion: '有新版本可用:{{version}}',
|
|
153
154
|
},
|
|
155
|
+
userPanel: {
|
|
156
|
+
billing: '账单管理',
|
|
157
|
+
discord: '社区支持',
|
|
158
|
+
docs: '使用文档',
|
|
159
|
+
email: '邮件支持',
|
|
160
|
+
feedback: '反馈与建议',
|
|
161
|
+
help: '帮助中心',
|
|
162
|
+
plans: '订阅方案',
|
|
163
|
+
profile: '账户管理',
|
|
164
|
+
setting: '应用设置',
|
|
165
|
+
usages: '用量统计',
|
|
166
|
+
warn: '此入口即将下线,后续请从左上角头像唤起本菜单',
|
|
167
|
+
},
|
|
154
168
|
};
|
package/src/locales/resources.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
|
|
3
|
+
import { get } from 'lodash-es';
|
|
4
|
+
import { cookies } from 'next/headers';
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
|
|
8
|
+
import { DEFAULT_LANG, LOBE_LOCALE_COOKIE } from '@/const/locale';
|
|
9
|
+
import { NS, normalizeLocale } from '@/locales/resources';
|
|
10
|
+
|
|
11
|
+
export const translation = async (ns: NS) => {
|
|
12
|
+
const cookieStore = cookies();
|
|
13
|
+
const defaultLang = cookieStore.get(LOBE_LOCALE_COOKIE);
|
|
14
|
+
const lng = defaultLang?.value || DEFAULT_LANG;
|
|
15
|
+
const filepath = join(process.cwd(), `locales/${normalizeLocale(lng)}/${ns}.json`);
|
|
16
|
+
const file = readFileSync(filepath, 'utf8');
|
|
17
|
+
const i18ns = JSON.parse(file);
|
|
18
|
+
|
|
19
|
+
return { t: (key: string) => get(i18ns, key) };
|
|
20
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LobeChatPluginManifest } from '@lobehub/chat-plugin-sdk';
|
|
2
2
|
import { act } from '@testing-library/react';
|
|
3
|
-
import { merge } from 'lodash';
|
|
3
|
+
import { merge } from 'lodash-es';
|
|
4
4
|
import { describe, expect, it, vi } from 'vitest';
|
|
5
5
|
|
|
6
6
|
import { DEFAULT_AGENT_CONFIG } from '@/const/settings';
|
|
@@ -28,7 +28,7 @@ export const createMarketAction: StateCreator<
|
|
|
28
28
|
set({ currentIdentifier: identifier });
|
|
29
29
|
},
|
|
30
30
|
deactivateAgent: () => {
|
|
31
|
-
set({ currentIdentifier:
|
|
31
|
+
set({ currentIdentifier: '' }, false, 'deactivateAgent');
|
|
32
32
|
},
|
|
33
33
|
setSearchKeywords: (keywords) => {
|
|
34
34
|
set({ searchKeywords: keywords });
|
package/src/utils/difference.ts
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { Flexbox } from 'react-layout-kit';
|
|
5
|
-
|
|
6
|
-
import SafeSpacing from '@/components/SafeSpacing';
|
|
7
|
-
import ClientResponsiveContent from '@/components/client/ClientResponsiveContent';
|
|
8
|
-
import { HEADER_HEIGHT } from '@/const/layoutTokens';
|
|
9
|
-
|
|
10
|
-
import EditPage from '../features/EditPage';
|
|
11
|
-
import Header from './Header';
|
|
12
|
-
|
|
13
|
-
const Desktop = memo(() => (
|
|
14
|
-
<>
|
|
15
|
-
<Header />
|
|
16
|
-
<Flexbox align={'center'} flex={1} gap={16} padding={24} style={{ overflow: 'scroll' }}>
|
|
17
|
-
<SafeSpacing height={HEADER_HEIGHT - 16} />
|
|
18
|
-
<EditPage />
|
|
19
|
-
</Flexbox>
|
|
20
|
-
</>
|
|
21
|
-
));
|
|
22
|
-
|
|
23
|
-
export default ClientResponsiveContent({ Desktop, Mobile: () => import('../(mobile)') });
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
|
|
5
|
-
import MobileContentLayout from '@/components/server/MobileNavLayout';
|
|
6
|
-
|
|
7
|
-
import EditPage from '../features/EditPage';
|
|
8
|
-
import Header from './Header';
|
|
9
|
-
|
|
10
|
-
const ChatSettings = memo(() => (
|
|
11
|
-
<MobileContentLayout header={<Header />} withNav={false}>
|
|
12
|
-
<EditPage />
|
|
13
|
-
</MobileContentLayout>
|
|
14
|
-
));
|
|
15
|
-
|
|
16
|
-
export default ChatSettings;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { SpotlightCard, SpotlightCardProps } from '@lobehub/ui';
|
|
4
|
-
import { FC, memo, useEffect } from 'react';
|
|
5
|
-
|
|
6
|
-
import ClientResponsiveContent from '@/components/client/ClientResponsiveContent';
|
|
7
|
-
import { useMarketStore } from '@/store/market';
|
|
8
|
-
|
|
9
|
-
import AgentCard from '../features/AgentCard';
|
|
10
|
-
|
|
11
|
-
const Desktop = memo(() => {
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
// refs: https://github.com/pmndrs/zustand/blob/main/docs/integrations/persisting-store-data.md#hashydrated
|
|
14
|
-
useMarketStore.persist.rehydrate();
|
|
15
|
-
}, []);
|
|
16
|
-
|
|
17
|
-
return <AgentCard CardRender={SpotlightCard as FC<SpotlightCardProps>} />;
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export default ClientResponsiveContent({ Desktop, Mobile: () => import('../(mobile)') });
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { SpotlightCardProps } from '@lobehub/ui';
|
|
2
|
-
import { createStyles } from 'antd-style';
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { Flexbox } from 'react-layout-kit';
|
|
5
|
-
|
|
6
|
-
const useStyles = createStyles(({ css, token, isDarkMode }) => ({
|
|
7
|
-
container: css`
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
background: ${token.colorBgContainer};
|
|
10
|
-
border: 1px solid ${isDarkMode ? token.colorFillTertiary : token.colorFillSecondary};
|
|
11
|
-
border-radius: ${token.borderRadiusLG}px;
|
|
12
|
-
`,
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
const AgentCard = memo<SpotlightCardProps>(({ items, renderItem, gap = 16, ...props }) => {
|
|
16
|
-
const { styles } = useStyles();
|
|
17
|
-
return (
|
|
18
|
-
<Flexbox gap={gap} {...props}>
|
|
19
|
-
{items.map((item, index) => {
|
|
20
|
-
const children = renderItem(item);
|
|
21
|
-
return (
|
|
22
|
-
<div className={styles.container} key={index}>
|
|
23
|
-
{children}
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
})}
|
|
27
|
-
</Flexbox>
|
|
28
|
-
);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export default AgentCard;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import dynamic from 'next/dynamic';
|
|
4
|
-
import { memo, useEffect } from 'react';
|
|
5
|
-
|
|
6
|
-
import { useMarketStore } from '@/store/market';
|
|
7
|
-
|
|
8
|
-
import AgentCard from '../features/AgentCard';
|
|
9
|
-
import CardRender from './features/AgentCard';
|
|
10
|
-
|
|
11
|
-
const DetailModal = dynamic(() => import('./features/AgentDetail'), { ssr: false });
|
|
12
|
-
|
|
13
|
-
export default memo(() => {
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
// refs: https://github.com/pmndrs/zustand/blob/main/docs/integrations/persisting-store-data.md#hashydrated
|
|
16
|
-
useMarketStore.persist.rehydrate();
|
|
17
|
-
}, []);
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<>
|
|
21
|
-
<AgentCard CardRender={CardRender} mobile />
|
|
22
|
-
<DetailModal />
|
|
23
|
-
</>
|
|
24
|
-
);
|
|
25
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Skeleton } from 'antd';
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { Flexbox } from 'react-layout-kit';
|
|
4
|
-
|
|
5
|
-
const Loading = memo(() => {
|
|
6
|
-
return (
|
|
7
|
-
<Flexbox>
|
|
8
|
-
<Skeleton paragraph={{ rows: 8 }} />
|
|
9
|
-
</Flexbox>
|
|
10
|
-
);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export default Loading;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Avatar, Tag } from '@lobehub/ui';
|
|
2
|
-
import { useHover } from 'ahooks';
|
|
3
|
-
import { Typography } from 'antd';
|
|
4
|
-
import { useThemeMode } from 'antd-style';
|
|
5
|
-
import { startCase } from 'lodash-es';
|
|
6
|
-
import { memo, useRef } from 'react';
|
|
7
|
-
import { Flexbox } from 'react-layout-kit';
|
|
8
|
-
|
|
9
|
-
import { useMarketStore } from '@/store/market';
|
|
10
|
-
import { AgentsMarketIndexItem } from '@/types/market';
|
|
11
|
-
|
|
12
|
-
import AgentCardBanner from './AgentCardBanner';
|
|
13
|
-
import { useStyles } from './style';
|
|
14
|
-
|
|
15
|
-
const { Paragraph } = Typography;
|
|
16
|
-
|
|
17
|
-
const AgentCardItem = memo<AgentsMarketIndexItem>(({ meta, identifier }) => {
|
|
18
|
-
const ref = useRef(null);
|
|
19
|
-
const isHovering = useHover(ref);
|
|
20
|
-
const onAgentCardClick = useMarketStore((s) => s.activateAgent);
|
|
21
|
-
const { styles, theme } = useStyles();
|
|
22
|
-
const { isDarkMode } = useThemeMode();
|
|
23
|
-
|
|
24
|
-
const { avatar, title, description, tags, backgroundColor } = meta;
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<Flexbox className={styles.container} onClick={() => onAgentCardClick(identifier)}>
|
|
28
|
-
<AgentCardBanner meta={meta} style={{ opacity: isDarkMode ? 0.9 : 0.4 }} />
|
|
29
|
-
<Flexbox className={styles.inner} gap={8} ref={ref}>
|
|
30
|
-
<Avatar
|
|
31
|
-
animation={isHovering}
|
|
32
|
-
avatar={avatar}
|
|
33
|
-
background={backgroundColor || theme.colorFillTertiary}
|
|
34
|
-
size={56}
|
|
35
|
-
/>
|
|
36
|
-
<Paragraph className={styles.title} ellipsis={{ rows: 1, tooltip: title }}>
|
|
37
|
-
{title}
|
|
38
|
-
</Paragraph>
|
|
39
|
-
<Paragraph className={styles.desc} ellipsis={{ rows: 2, tooltip: description }}>
|
|
40
|
-
{description}
|
|
41
|
-
</Paragraph>
|
|
42
|
-
<Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}>
|
|
43
|
-
{(tags as string[]).filter(Boolean).map((tag: string, index) => (
|
|
44
|
-
<Tag key={index} style={{ margin: 0 }}>
|
|
45
|
-
{startCase(tag).trim()}
|
|
46
|
-
</Tag>
|
|
47
|
-
))}
|
|
48
|
-
</Flexbox>
|
|
49
|
-
</Flexbox>
|
|
50
|
-
</Flexbox>
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export default AgentCardItem;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { createStyles } from 'antd-style';
|
|
2
|
-
|
|
3
|
-
export const useStyles = createStyles(({ css, token, responsive }) => ({
|
|
4
|
-
container: css`
|
|
5
|
-
position: relative;
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
border-radius: 11px;
|
|
8
|
-
${responsive.mobile} {
|
|
9
|
-
border-radius: unset;
|
|
10
|
-
}
|
|
11
|
-
`,
|
|
12
|
-
desc: css`
|
|
13
|
-
color: ${token.colorTextDescription};
|
|
14
|
-
`,
|
|
15
|
-
inner: css`
|
|
16
|
-
padding: 16px;
|
|
17
|
-
`,
|
|
18
|
-
lazy: css`
|
|
19
|
-
min-height: 232px;
|
|
20
|
-
`,
|
|
21
|
-
subTitle: css`
|
|
22
|
-
font-size: 24px;
|
|
23
|
-
font-weight: 600;
|
|
24
|
-
${responsive.mobile} {
|
|
25
|
-
font-size: 20px;
|
|
26
|
-
}
|
|
27
|
-
`,
|
|
28
|
-
title: css`
|
|
29
|
-
margin-bottom: 0 !important;
|
|
30
|
-
font-size: 16px;
|
|
31
|
-
font-weight: 600;
|
|
32
|
-
`,
|
|
33
|
-
}));
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { SearchBar } from '@lobehub/ui';
|
|
4
|
-
import { memo, useCallback, useState } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { Flexbox } from 'react-layout-kit';
|
|
7
|
-
|
|
8
|
-
import { useIsMobile } from '@/hooks/useIsMobile';
|
|
9
|
-
import { useMarketStore } from '@/store/market';
|
|
10
|
-
|
|
11
|
-
const AgentSearchBar = memo<{ mobile?: boolean }>(({ mobile: controlledMobile }) => {
|
|
12
|
-
const { t } = useTranslation('market');
|
|
13
|
-
const [keywords, setKeywords] = useMarketStore((s) => [s.searchKeywords, s.setSearchKeywords]);
|
|
14
|
-
const [value, setValue] = useState(keywords);
|
|
15
|
-
const isMobile = useIsMobile();
|
|
16
|
-
const mobile = controlledMobile ?? isMobile;
|
|
17
|
-
|
|
18
|
-
const handleSearch = useCallback(() => {
|
|
19
|
-
setKeywords(value);
|
|
20
|
-
}, [value, setKeywords]);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<Flexbox flex={'none'} paddingBlock={mobile ? 8 : 0}>
|
|
24
|
-
<SearchBar
|
|
25
|
-
allowClear
|
|
26
|
-
enableShortKey={!mobile}
|
|
27
|
-
onChange={(e) => setValue(e.target.value)}
|
|
28
|
-
onPressEnter={handleSearch}
|
|
29
|
-
onSubmit={handleSearch}
|
|
30
|
-
placeholder={t('search.placeholder')}
|
|
31
|
-
shortKey={'k'}
|
|
32
|
-
spotlight={!mobile}
|
|
33
|
-
type={mobile ? 'block' : 'ghost'}
|
|
34
|
-
value={value}
|
|
35
|
-
/>
|
|
36
|
-
</Flexbox>
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export default AgentSearchBar;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
|
|
6
|
-
import PageTitle from '@/components/PageTitle';
|
|
7
|
-
|
|
8
|
-
const Title = memo(() => {
|
|
9
|
-
const { t } = useTranslation('common');
|
|
10
|
-
|
|
11
|
-
return <PageTitle title={t('tab.market')} />;
|
|
12
|
-
});
|
|
13
|
-
export default Title;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Button } from 'antd';
|
|
2
|
-
import isEqual from 'fast-deep-equal';
|
|
3
|
-
import { startCase } from 'lodash-es';
|
|
4
|
-
import { memo } from 'react';
|
|
5
|
-
|
|
6
|
-
import { agentMarketSelectors, useMarketStore } from '@/store/market';
|
|
7
|
-
|
|
8
|
-
const Inner = memo(() => {
|
|
9
|
-
const agentTagList = useMarketStore(agentMarketSelectors.getAgentTagList, isEqual);
|
|
10
|
-
const [keywords, setSearchKeywords] = useMarketStore((s) => [
|
|
11
|
-
s.searchKeywords,
|
|
12
|
-
s.setSearchKeywords,
|
|
13
|
-
]);
|
|
14
|
-
|
|
15
|
-
return agentTagList.map((item) => (
|
|
16
|
-
<Button
|
|
17
|
-
key={item}
|
|
18
|
-
onClick={() => setSearchKeywords(item)}
|
|
19
|
-
shape={'round'}
|
|
20
|
-
size={'small'}
|
|
21
|
-
type={keywords === item ? 'primary' : 'default'}
|
|
22
|
-
>
|
|
23
|
-
{startCase(item)}
|
|
24
|
-
</Button>
|
|
25
|
-
));
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export default Inner;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Skeleton } from 'antd';
|
|
2
|
-
import { Suspense, memo } from 'react';
|
|
3
|
-
import { Flexbox } from 'react-layout-kit';
|
|
4
|
-
|
|
5
|
-
import Inner from './Inner';
|
|
6
|
-
|
|
7
|
-
const TagList = memo(() => {
|
|
8
|
-
return (
|
|
9
|
-
<Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}>
|
|
10
|
-
<Suspense
|
|
11
|
-
fallback={Array.from({ length: 5 })
|
|
12
|
-
.fill('')
|
|
13
|
-
.map((_, index) => (
|
|
14
|
-
<Skeleton.Button key={index} shape={'round'} size={'small'} />
|
|
15
|
-
))}
|
|
16
|
-
>
|
|
17
|
-
<Inner />
|
|
18
|
-
</Suspense>
|
|
19
|
-
</Flexbox>
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export default TagList;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import dynamic from 'next/dynamic';
|
|
4
|
-
import { FC, memo } from 'react';
|
|
5
|
-
|
|
6
|
-
import MobileSwitchLoading from '@/features/MobileSwitchLoading';
|
|
7
|
-
import { useIsMobile } from '@/hooks/useIsMobile';
|
|
8
|
-
|
|
9
|
-
import Common from '../common';
|
|
10
|
-
import { SettingsCommonProps } from '../common/Common';
|
|
11
|
-
|
|
12
|
-
const Mobile: FC = dynamic(() => import('../(mobile)'), {
|
|
13
|
-
loading: MobileSwitchLoading,
|
|
14
|
-
ssr: false,
|
|
15
|
-
}) as FC;
|
|
16
|
-
|
|
17
|
-
const Desktop = memo<SettingsCommonProps>((props) => {
|
|
18
|
-
const mobile = useIsMobile();
|
|
19
|
-
|
|
20
|
-
return mobile ? <Mobile /> : <Common {...props} />;
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export default Desktop;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { DivProps } from '@lobehub/ui';
|
|
2
|
-
import { createStyles } from 'antd-style';
|
|
3
|
-
import Image from 'next/image';
|
|
4
|
-
import { memo } from 'react';
|
|
5
|
-
import { Flexbox } from 'react-layout-kit';
|
|
6
|
-
|
|
7
|
-
import { DEFAULT_USER_AVATAR_URL } from '@/const/meta';
|
|
8
|
-
|
|
9
|
-
export const useStyles = createStyles(({ css, token }) => ({
|
|
10
|
-
banner: css`
|
|
11
|
-
position: relative;
|
|
12
|
-
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
|
|
15
|
-
height: 172px;
|
|
16
|
-
min-height: 172px;
|
|
17
|
-
max-height: 172px;
|
|
18
|
-
`,
|
|
19
|
-
bannerBox: css`
|
|
20
|
-
position: relative;
|
|
21
|
-
|
|
22
|
-
width: 100%;
|
|
23
|
-
height: 100%;
|
|
24
|
-
|
|
25
|
-
background: ${token.colorBgLayout};
|
|
26
|
-
|
|
27
|
-
mask-image: linear-gradient(to bottom, #fff, transparent);
|
|
28
|
-
`,
|
|
29
|
-
bannerImg: css`
|
|
30
|
-
position: absolute;
|
|
31
|
-
top: -50%;
|
|
32
|
-
filter: blur(100px) saturate(2);
|
|
33
|
-
`,
|
|
34
|
-
}));
|
|
35
|
-
|
|
36
|
-
interface AgentCardBannerProps extends DivProps {
|
|
37
|
-
avatar: string;
|
|
38
|
-
size?: number;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const AvatarBanner = memo<AgentCardBannerProps>(
|
|
42
|
-
({ avatar, className, size = 200, children, ...props }) => {
|
|
43
|
-
const { styles, cx } = useStyles();
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<Flexbox
|
|
47
|
-
align={'center'}
|
|
48
|
-
className={cx(styles.banner, className)}
|
|
49
|
-
justify={'center'}
|
|
50
|
-
{...props}
|
|
51
|
-
>
|
|
52
|
-
<Flexbox align={'center'} className={styles.bannerBox} justify={'center'}>
|
|
53
|
-
<Image
|
|
54
|
-
alt={'banner'}
|
|
55
|
-
className={styles.bannerImg}
|
|
56
|
-
height={size}
|
|
57
|
-
src={avatar || DEFAULT_USER_AVATAR_URL}
|
|
58
|
-
unoptimized
|
|
59
|
-
width={size}
|
|
60
|
-
/>
|
|
61
|
-
</Flexbox>
|
|
62
|
-
{children}
|
|
63
|
-
</Flexbox>
|
|
64
|
-
);
|
|
65
|
-
},
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
export default AvatarBanner;
|