@lobehub/chat 0.157.2 → 0.158.1
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/.eslintignore +1 -2
- package/CHANGELOG.md +50 -0
- package/locales/ar/auth.json +2 -0
- package/locales/ar/common.json +2 -0
- package/locales/ar/metadata.json +18 -0
- package/locales/ar/plugin.json +5 -6
- package/locales/ar/tool.json +2 -1
- package/locales/bg-BG/auth.json +2 -0
- package/locales/bg-BG/common.json +2 -0
- package/locales/bg-BG/error.json +3 -3
- package/locales/bg-BG/metadata.json +18 -0
- package/locales/bg-BG/plugin.json +5 -6
- package/locales/bg-BG/tool.json +2 -1
- package/locales/de-DE/auth.json +2 -0
- package/locales/de-DE/common.json +2 -0
- package/locales/de-DE/metadata.json +18 -0
- package/locales/de-DE/plugin.json +5 -6
- package/locales/de-DE/tool.json +2 -1
- package/locales/en-US/auth.json +2 -0
- package/locales/en-US/common.json +3 -1
- package/locales/en-US/metadata.json +18 -0
- package/locales/en-US/plugin.json +5 -6
- package/locales/en-US/tool.json +2 -1
- package/locales/es-ES/auth.json +2 -0
- package/locales/es-ES/common.json +2 -0
- package/locales/es-ES/metadata.json +18 -0
- package/locales/es-ES/plugin.json +5 -6
- package/locales/es-ES/tool.json +2 -1
- package/locales/fr-FR/auth.json +2 -0
- package/locales/fr-FR/common.json +2 -0
- package/locales/fr-FR/metadata.json +18 -0
- package/locales/fr-FR/plugin.json +5 -6
- package/locales/fr-FR/tool.json +2 -1
- package/locales/it-IT/auth.json +2 -0
- package/locales/it-IT/common.json +2 -0
- package/locales/it-IT/metadata.json +18 -0
- package/locales/it-IT/plugin.json +5 -6
- package/locales/it-IT/tool.json +2 -1
- package/locales/ja-JP/auth.json +2 -0
- package/locales/ja-JP/common.json +2 -0
- package/locales/ja-JP/metadata.json +18 -0
- package/locales/ja-JP/plugin.json +5 -6
- package/locales/ja-JP/tool.json +2 -1
- package/locales/ko-KR/auth.json +2 -0
- package/locales/ko-KR/common.json +2 -0
- package/locales/ko-KR/metadata.json +18 -0
- package/locales/ko-KR/plugin.json +5 -6
- package/locales/ko-KR/tool.json +2 -1
- package/locales/nl-NL/auth.json +2 -0
- package/locales/nl-NL/common.json +51 -49
- package/locales/nl-NL/metadata.json +18 -0
- package/locales/nl-NL/plugin.json +63 -64
- package/locales/nl-NL/tool.json +2 -1
- package/locales/pl-PL/auth.json +2 -0
- package/locales/pl-PL/common.json +2 -0
- package/locales/pl-PL/error.json +3 -3
- package/locales/pl-PL/metadata.json +18 -0
- package/locales/pl-PL/plugin.json +98 -99
- package/locales/pl-PL/tool.json +2 -1
- package/locales/pt-BR/auth.json +2 -0
- package/locales/pt-BR/common.json +2 -0
- package/locales/pt-BR/metadata.json +18 -0
- package/locales/pt-BR/plugin.json +5 -6
- package/locales/pt-BR/tool.json +2 -1
- package/locales/ru-RU/auth.json +2 -0
- package/locales/ru-RU/common.json +2 -0
- package/locales/ru-RU/error.json +3 -3
- package/locales/ru-RU/metadata.json +18 -0
- package/locales/ru-RU/plugin.json +5 -6
- package/locales/ru-RU/tool.json +2 -1
- package/locales/tr-TR/auth.json +2 -0
- package/locales/tr-TR/common.json +2 -0
- package/locales/tr-TR/metadata.json +18 -0
- package/locales/tr-TR/plugin.json +5 -6
- package/locales/tr-TR/tool.json +2 -1
- package/locales/vi-VN/auth.json +2 -0
- package/locales/vi-VN/common.json +2 -0
- package/locales/vi-VN/metadata.json +18 -0
- package/locales/vi-VN/plugin.json +5 -6
- package/locales/vi-VN/tool.json +2 -1
- package/locales/zh-CN/auth.json +2 -0
- package/locales/zh-CN/common.json +2 -0
- package/locales/zh-CN/metadata.json +18 -0
- package/locales/zh-CN/plugin.json +5 -6
- package/locales/zh-CN/tool.json +2 -1
- package/locales/zh-TW/auth.json +2 -0
- package/locales/zh-TW/common.json +2 -0
- package/locales/zh-TW/metadata.json +18 -0
- package/locales/zh-TW/plugin.json +5 -6
- package/locales/zh-TW/tool.json +2 -1
- package/package.json +2 -1
- package/public/manifest.json +76 -16
- package/public/og/cover.png +0 -0
- package/public/screenshots/shot-1.desktop.png +0 -0
- package/public/screenshots/shot-1.mobile.png +0 -0
- package/public/screenshots/shot-2.desktop.png +0 -0
- package/public/screenshots/shot-2.mobile.png +0 -0
- package/public/screenshots/shot-3.desktop.png +0 -0
- package/public/screenshots/shot-3.mobile.png +0 -0
- package/public/screenshots/shot-4.desktop.png +0 -0
- package/public/screenshots/shot-4.mobile.png +0 -0
- package/public/screenshots/shot-5.desktop.png +0 -0
- package/public/screenshots/shot-5.mobile.png +0 -0
- package/src/app/(auth)/login/[[...login]]/page.tsx +14 -7
- package/src/app/(auth)/signup/[[...signup]]/page.tsx +14 -7
- package/src/app/(main)/(mobile)/me/(home)/__tests__/UserBanner.test.tsx +80 -0
- package/src/app/(main)/(mobile)/me/(home)/__tests__/useCategory.test.tsx +116 -0
- package/src/app/(main)/(mobile)/me/(home)/features/Category.tsx +15 -0
- package/src/app/(main)/(mobile)/me/(home)/features/UserBanner.tsx +37 -0
- package/src/app/(main)/(mobile)/me/(home)/features/useCategory.tsx +110 -0
- package/src/app/(main)/(mobile)/me/(home)/page.tsx +38 -0
- package/src/app/(main)/(mobile)/me/data/features/Category.tsx +48 -0
- package/src/app/(main)/(mobile)/me/data/features/Header.tsx +33 -0
- package/src/app/(main)/(mobile)/me/data/layout.tsx +13 -0
- package/src/app/(main)/(mobile)/me/data/loading.tsx +5 -0
- package/src/app/(main)/(mobile)/me/data/page.tsx +27 -0
- package/src/app/(main)/(mobile)/me/profile/features/Category.tsx +45 -0
- package/src/app/(main)/(mobile)/me/profile/features/Header.tsx +33 -0
- package/src/app/(main)/(mobile)/me/profile/layout.tsx +16 -0
- package/src/app/(main)/(mobile)/me/profile/loading.tsx +5 -0
- package/src/app/(main)/(mobile)/me/profile/page.tsx +28 -0
- package/src/app/(main)/(mobile)/me/settings/features/Category.tsx +15 -0
- package/src/app/(main)/(mobile)/me/settings/features/Header.tsx +33 -0
- package/src/app/(main)/(mobile)/me/settings/features/useCategory.tsx +57 -0
- package/src/app/(main)/(mobile)/me/settings/layout.tsx +13 -0
- package/src/app/(main)/(mobile)/me/settings/loading.tsx +5 -0
- package/src/app/(main)/(mobile)/me/settings/page.tsx +28 -0
- package/src/app/(main)/_layout/Mobile.tsx +5 -4
- package/src/app/(main)/chat/(workspace)/page.tsx +21 -1
- package/src/app/(main)/market/page.tsx +17 -8
- package/src/app/(main)/profile/[[...slugs]]/Client.tsx +74 -0
- package/src/app/(main)/profile/[[...slugs]]/page.tsx +21 -0
- package/src/app/(main)/profile/_layout/Mobile/Header.tsx +26 -0
- package/src/app/(main)/profile/_layout/Mobile/index.tsx +16 -0
- package/src/app/(main)/profile/layout.tsx +20 -0
- package/src/app/(main)/profile/loading.tsx +23 -0
- package/src/app/(main)/settings/_layout/Mobile/Header.tsx +2 -1
- package/src/app/(main)/settings/about/page.tsx +5 -2
- package/src/app/(main)/settings/agent/page.tsx +5 -3
- package/src/app/(main)/settings/common/page.tsx +5 -3
- package/src/app/(main)/settings/hooks/useCategory.tsx +7 -13
- package/src/app/(main)/settings/llm/page.tsx +5 -2
- package/src/app/(main)/settings/sync/page.tsx +5 -3
- package/src/app/(main)/settings/tts/page.tsx +5 -3
- package/src/app/(main)/welcome/page.tsx +19 -6
- package/src/app/@modal/layout.tsx +3 -0
- package/src/app/layout.tsx +1 -1
- package/src/app/metadata.ts +44 -54
- package/src/app/page.tsx +4 -4
- package/src/components/Cell/Divider.tsx +3 -2
- package/src/components/Cell/index.tsx +28 -18
- package/src/components/StructuredData/index.tsx +12 -0
- package/src/features/User/DataStatistics.tsx +3 -1
- package/src/features/User/UserLoginOrSignup.tsx +2 -2
- package/src/features/User/UserPanel/PanelContent.tsx +9 -3
- package/src/features/User/UserPanel/useMenu.tsx +45 -29
- package/src/features/User/__tests__/PanelContent.test.tsx +7 -0
- package/src/features/User/__tests__/useMenu.test.tsx +142 -0
- package/src/hooks/usePWAInstall.ts +18 -0
- package/src/layout/AuthProvider/Clerk/useAppearance.ts +5 -4
- package/src/locales/default/auth.ts +2 -0
- package/src/locales/default/common.ts +3 -1
- package/src/locales/default/index.ts +2 -0
- package/src/locales/default/metadata.ts +20 -0
- package/src/server/ld.ts +218 -0
- package/src/server/metadata.ts +96 -0
- package/src/server/translation.ts +11 -1
- package/src/store/user/slices/auth/selectors.ts +2 -1
- package/src/utils/genOG.ts +20 -0
- package/public/screenshots/screenshot-1.png +0 -0
- package/public/screenshots/screenshot-2.png +0 -0
- package/public/screenshots/screenshot-3.png +0 -0
- package/public/screenshots/screenshot-4.png +0 -0
- package/src/app/(auth)/login/[[...login]]/PageTitle.tsx +0 -13
- package/src/app/(auth)/profile/[[...slugs]]/PageTitle.tsx +0 -13
- package/src/app/(auth)/profile/[[...slugs]]/page.tsx +0 -14
- package/src/app/(auth)/signup/[[...signup]]/PageTitle.tsx +0 -13
- package/src/app/(main)/(mobile)/me/features/Cate.tsx +0 -33
- package/src/app/(main)/(mobile)/me/features/ExtraCate.tsx +0 -24
- package/src/app/(main)/(mobile)/me/features/useExtraCate.tsx +0 -62
- package/src/app/(main)/(mobile)/me/page.tsx +0 -32
- /package/public/icons/{maskable-icon-192x192.png → icon-192x192.maskable.png} +0 -0
- /package/public/icons/{maskable-icon-512x512.png → icon-512x512.maskable.png} +0 -0
- /package/src/app/(main)/(mobile)/me/{features → (home)/features}/Header.tsx +0 -0
- /package/src/app/(main)/(mobile)/me/{layout.tsx → (home)/layout.tsx} +0 -0
- /package/src/app/(main)/(mobile)/me/{loading.tsx → (home)/loading.tsx} +0 -0
package/src/server/ld.ts
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import urlJoin from 'url-join';
|
|
2
|
+
|
|
3
|
+
import { getServerConfig } from '@/config/server';
|
|
4
|
+
import { EMAIL_BUSINESS, EMAIL_SUPPORT, OFFICIAL_SITE, OFFICIAL_URL, X } from '@/const/url';
|
|
5
|
+
|
|
6
|
+
import pkg from '../../package.json';
|
|
7
|
+
|
|
8
|
+
const { SITE_URL = OFFICIAL_URL } = getServerConfig();
|
|
9
|
+
const LAST_MODIFIED = new Date().toISOString();
|
|
10
|
+
export const AUTHOR_LIST = {
|
|
11
|
+
arvinxx: {
|
|
12
|
+
avatar: 'https://avatars.githubusercontent.com/u/28616219?v=4',
|
|
13
|
+
desc: 'Founder, Design Engineer',
|
|
14
|
+
name: 'Arvin Xu',
|
|
15
|
+
url: 'https://github.com/arvinxx',
|
|
16
|
+
},
|
|
17
|
+
canisminor: {
|
|
18
|
+
avatar: 'https://avatars.githubusercontent.com/u/17870709?v=4',
|
|
19
|
+
desc: 'Founder, Design Engineer',
|
|
20
|
+
name: 'CanisMinor',
|
|
21
|
+
url: 'https://github.com/arvinxx',
|
|
22
|
+
},
|
|
23
|
+
lobehub: {
|
|
24
|
+
avatar: 'https://avatars.githubusercontent.com/u/131470832?v=4',
|
|
25
|
+
desc: 'Official Account',
|
|
26
|
+
name: 'LobeHub',
|
|
27
|
+
url: 'https://github.com/lobehub',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
class Ld {
|
|
32
|
+
generate({
|
|
33
|
+
image = '/og/cover.png',
|
|
34
|
+
url,
|
|
35
|
+
title,
|
|
36
|
+
description,
|
|
37
|
+
date,
|
|
38
|
+
webpage = {
|
|
39
|
+
enable: true,
|
|
40
|
+
},
|
|
41
|
+
}: {
|
|
42
|
+
date?: string;
|
|
43
|
+
description: string;
|
|
44
|
+
image?: string;
|
|
45
|
+
title: string;
|
|
46
|
+
url: string;
|
|
47
|
+
webpage?: {
|
|
48
|
+
enable?: boolean;
|
|
49
|
+
search?: boolean;
|
|
50
|
+
};
|
|
51
|
+
}) {
|
|
52
|
+
return {
|
|
53
|
+
'@context': 'https://schema.org',
|
|
54
|
+
'@graph': [
|
|
55
|
+
this.genWebSite(),
|
|
56
|
+
webpage?.enable &&
|
|
57
|
+
this.genWebPage({
|
|
58
|
+
...webpage,
|
|
59
|
+
date,
|
|
60
|
+
description,
|
|
61
|
+
image,
|
|
62
|
+
title,
|
|
63
|
+
url,
|
|
64
|
+
}),
|
|
65
|
+
image && this.genImageObject({ image, url }),
|
|
66
|
+
this.genOrganization(),
|
|
67
|
+
].filter(Boolean),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
genOrganization() {
|
|
72
|
+
return {
|
|
73
|
+
'@id': this.getId(SITE_URL, '#organization'),
|
|
74
|
+
'@type': 'Organization',
|
|
75
|
+
'alternateName': 'LobeChat',
|
|
76
|
+
'contactPoint': {
|
|
77
|
+
'@type': 'ContactPoint',
|
|
78
|
+
'contactType': 'customer support',
|
|
79
|
+
'email': EMAIL_SUPPORT,
|
|
80
|
+
},
|
|
81
|
+
'description':
|
|
82
|
+
'We are a group of e/acc design-engineers, hoping to provide modern design components and tools for AIGC, and creating a technology-driven forum, fostering knowledge interaction and the exchange of ideas that may culminate in mutual inspiration and collaborative innovation.',
|
|
83
|
+
'email': EMAIL_BUSINESS,
|
|
84
|
+
'founders': [this.getAuthors(['arvinxx']), this.getAuthors(['canisminor'])],
|
|
85
|
+
'image': urlJoin(OFFICIAL_SITE, '/icon-512x512.png'),
|
|
86
|
+
'logo': {
|
|
87
|
+
'@type': 'ImageObject',
|
|
88
|
+
'height': 512,
|
|
89
|
+
'url': urlJoin(OFFICIAL_SITE, '/icon-512x512.png'),
|
|
90
|
+
'width': 512,
|
|
91
|
+
},
|
|
92
|
+
'name': 'LobeHub',
|
|
93
|
+
'sameAs': [
|
|
94
|
+
X,
|
|
95
|
+
'https://github.com/lobehub',
|
|
96
|
+
'https://medium.com/@lobehub',
|
|
97
|
+
'https://www.youtube.com/@lobehub',
|
|
98
|
+
],
|
|
99
|
+
'url': OFFICIAL_SITE,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
getAuthors(ids: string[] = []) {
|
|
104
|
+
const defaultAuthor = {
|
|
105
|
+
'@id': this.getId(SITE_URL, '#organization'),
|
|
106
|
+
'@type': 'Organization',
|
|
107
|
+
};
|
|
108
|
+
if (!ids || ids.length === 0) return defaultAuthor;
|
|
109
|
+
if (ids.length === 1 && ids[0] === 'lobehub') return defaultAuthor;
|
|
110
|
+
const personId = ids.find((id) => id !== 'lobehub');
|
|
111
|
+
if (!personId) return defaultAuthor;
|
|
112
|
+
const person = (AUTHOR_LIST as any)?.[personId];
|
|
113
|
+
if (!person) return defaultAuthor;
|
|
114
|
+
return {
|
|
115
|
+
'@type': 'Person',
|
|
116
|
+
'name': person.name,
|
|
117
|
+
'url': person.url,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
genWebPage({
|
|
122
|
+
date,
|
|
123
|
+
image,
|
|
124
|
+
search,
|
|
125
|
+
description,
|
|
126
|
+
title,
|
|
127
|
+
url,
|
|
128
|
+
}: {
|
|
129
|
+
breadcrumbs?: { title: string; url: string }[];
|
|
130
|
+
date?: string;
|
|
131
|
+
description: string;
|
|
132
|
+
image?: string;
|
|
133
|
+
search?: boolean;
|
|
134
|
+
title: string;
|
|
135
|
+
url: string;
|
|
136
|
+
}) {
|
|
137
|
+
const fixedUrl = this.fixUrl(url);
|
|
138
|
+
const dateCreated = date ? new Date(date).toISOString() : LAST_MODIFIED;
|
|
139
|
+
const dateModified = date ? new Date(date).toISOString() : LAST_MODIFIED;
|
|
140
|
+
|
|
141
|
+
const baseInfo: any = {
|
|
142
|
+
'@id': fixedUrl,
|
|
143
|
+
'@type': 'WebPage',
|
|
144
|
+
'about': {
|
|
145
|
+
'@id': this.getId(SITE_URL, '#organization'),
|
|
146
|
+
},
|
|
147
|
+
'breadcrumbs': {
|
|
148
|
+
'@id': this.getId(fixedUrl, '#breadcrumb'),
|
|
149
|
+
},
|
|
150
|
+
'dateModified': dateModified,
|
|
151
|
+
'datePublished': dateCreated,
|
|
152
|
+
'description': description,
|
|
153
|
+
'image': {
|
|
154
|
+
'@id': this.getId(fixedUrl, '#primaryimage'),
|
|
155
|
+
},
|
|
156
|
+
'inLanguage': 'en-US',
|
|
157
|
+
'isPartOf': {
|
|
158
|
+
'@id': this.getId(SITE_URL, '#website'),
|
|
159
|
+
},
|
|
160
|
+
'name': this.fixTitle(title),
|
|
161
|
+
'primaryImageOfPage': {
|
|
162
|
+
'@id': this.getId(fixedUrl, '#primaryimage'),
|
|
163
|
+
},
|
|
164
|
+
'thumbnailUrl': image,
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
if (search)
|
|
168
|
+
baseInfo.potentialAction = {
|
|
169
|
+
'@type': 'SearchAction',
|
|
170
|
+
'query-input': 'required name=search_term_string',
|
|
171
|
+
'target': `${fixedUrl}?q={search_term_string}`,
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
return baseInfo;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
genImageObject({ image, url }: { image: string; url: string }) {
|
|
178
|
+
const fixedUrl = this.fixUrl(url);
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
'@id': this.getId(fixedUrl, '#primaryimage'),
|
|
182
|
+
'@type': 'ImageObject',
|
|
183
|
+
'contentUrl': image,
|
|
184
|
+
'inLanguage': 'en-US',
|
|
185
|
+
'url': image,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
genWebSite() {
|
|
190
|
+
const baseInfo: any = {
|
|
191
|
+
'@id': this.getId(SITE_URL, '#website'),
|
|
192
|
+
'@type': 'WebSite',
|
|
193
|
+
'description': pkg.description,
|
|
194
|
+
'inLanguage': 'en-US',
|
|
195
|
+
'name': 'LobeChat',
|
|
196
|
+
'publisher': {
|
|
197
|
+
'@id': this.getId(SITE_URL, '#organization'),
|
|
198
|
+
},
|
|
199
|
+
'url': SITE_URL,
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
return baseInfo;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
private getId(url: string, id: string) {
|
|
206
|
+
return [url, id].join('/');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
private fixTitle(title: string) {
|
|
210
|
+
return title.includes('LobeChat') ? title : `${title} · LobeChat`;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
private fixUrl(url: string) {
|
|
214
|
+
return urlJoin(SITE_URL, url);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export const ldModule = new Ld();
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Metadata } from 'next';
|
|
2
|
+
|
|
3
|
+
import { getCanonicalUrl } from '@/const/url';
|
|
4
|
+
import { formatDescLength, formatTitleLength } from '@/utils/genOG';
|
|
5
|
+
|
|
6
|
+
export class Meta {
|
|
7
|
+
public generate({
|
|
8
|
+
description = 'LobeChat offers you the best ChatGPT, OLLaMA, Gemini, Claude WebUI user experience',
|
|
9
|
+
title,
|
|
10
|
+
image = '/og/cover.png',
|
|
11
|
+
url,
|
|
12
|
+
type = 'website',
|
|
13
|
+
tags,
|
|
14
|
+
}: {
|
|
15
|
+
description?: string;
|
|
16
|
+
image?: string;
|
|
17
|
+
tags?: string[];
|
|
18
|
+
title: string;
|
|
19
|
+
type?: 'website' | 'article';
|
|
20
|
+
url: string;
|
|
21
|
+
}): Metadata {
|
|
22
|
+
// eslint-disable-next-line no-param-reassign
|
|
23
|
+
const formatedTitle = formatTitleLength(title, 21);
|
|
24
|
+
// eslint-disable-next-line no-param-reassign
|
|
25
|
+
const formatedDescription = formatDescLength(description, tags);
|
|
26
|
+
const siteTitle = title.includes('LobeChat') ? title : title + ' · LobeChat';
|
|
27
|
+
return {
|
|
28
|
+
alternates: { canonical: getCanonicalUrl(url) },
|
|
29
|
+
description: formatedDescription,
|
|
30
|
+
openGraph: this.genOpenGraph({
|
|
31
|
+
description,
|
|
32
|
+
image,
|
|
33
|
+
title: siteTitle,
|
|
34
|
+
type,
|
|
35
|
+
url,
|
|
36
|
+
}),
|
|
37
|
+
other: {
|
|
38
|
+
robots: 'index,follow',
|
|
39
|
+
},
|
|
40
|
+
title: formatedTitle,
|
|
41
|
+
twitter: this.genTwitter({ description, image, title: siteTitle, url }),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private genTwitter({
|
|
46
|
+
description,
|
|
47
|
+
title,
|
|
48
|
+
image,
|
|
49
|
+
url,
|
|
50
|
+
}: {
|
|
51
|
+
description: string;
|
|
52
|
+
image: string;
|
|
53
|
+
title: string;
|
|
54
|
+
url: string;
|
|
55
|
+
}) {
|
|
56
|
+
return {
|
|
57
|
+
card: 'summary_large_image',
|
|
58
|
+
description,
|
|
59
|
+
images: [image],
|
|
60
|
+
site: '@lobehub',
|
|
61
|
+
title,
|
|
62
|
+
url,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private genOpenGraph({
|
|
67
|
+
description,
|
|
68
|
+
title,
|
|
69
|
+
image,
|
|
70
|
+
url,
|
|
71
|
+
type = 'website',
|
|
72
|
+
}: {
|
|
73
|
+
description: string;
|
|
74
|
+
image: string;
|
|
75
|
+
title: string;
|
|
76
|
+
type?: 'website' | 'article';
|
|
77
|
+
url: string;
|
|
78
|
+
}) {
|
|
79
|
+
return {
|
|
80
|
+
description,
|
|
81
|
+
images: [
|
|
82
|
+
{
|
|
83
|
+
alt: title,
|
|
84
|
+
url: image,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
locale: 'en-US',
|
|
88
|
+
siteName: 'LobeChat',
|
|
89
|
+
title,
|
|
90
|
+
type,
|
|
91
|
+
url,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const metadataModule = new Meta();
|
|
@@ -16,5 +16,15 @@ export const translation = async (ns: NS) => {
|
|
|
16
16
|
const file = readFileSync(filepath, 'utf8');
|
|
17
17
|
const i18ns = JSON.parse(file);
|
|
18
18
|
|
|
19
|
-
return {
|
|
19
|
+
return {
|
|
20
|
+
t: (key: string, options: { [key: string]: string } = {}) => {
|
|
21
|
+
let content = get(i18ns, key);
|
|
22
|
+
if (options) {
|
|
23
|
+
Object.entries(options).forEach(([key, value]) => {
|
|
24
|
+
content = content.replace(`{{${key}}}`, value);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return content;
|
|
28
|
+
},
|
|
29
|
+
};
|
|
20
30
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t } from 'i18next';
|
|
2
2
|
|
|
3
|
-
import { enableAuth } from '@/const/auth';
|
|
3
|
+
import { enableAuth, enableClerk } from '@/const/auth';
|
|
4
4
|
import { UserStore } from '@/store/user';
|
|
5
5
|
import { LobeUser } from '@/types/user';
|
|
6
6
|
|
|
@@ -43,4 +43,5 @@ const isLogin = (s: UserStore) => {
|
|
|
43
43
|
export const authSelectors = {
|
|
44
44
|
isLogin,
|
|
45
45
|
isLoginWithAuth: (s: UserStore) => s.isSignedIn,
|
|
46
|
+
isLoginWithClerk: (s: UserStore) => s.isSignedIn && enableClerk,
|
|
46
47
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const formatTitleLength = (title: string, addOnLength: number = 0) => {
|
|
2
|
+
if (title.length > 60 - addOnLength) {
|
|
3
|
+
return title.slice(0, 57 - addOnLength) + '...';
|
|
4
|
+
} else {
|
|
5
|
+
return title;
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const formatDescLength = (desc: string, tags?: string[]): any => {
|
|
10
|
+
if (!desc) return;
|
|
11
|
+
if (desc.length > 160) {
|
|
12
|
+
return desc.slice(0, 157) + '...';
|
|
13
|
+
} else {
|
|
14
|
+
if (!tags) return desc;
|
|
15
|
+
const tagStr: string = tags ? tags.join(', ') : '';
|
|
16
|
+
const tagLength = 160 - desc.length - 3;
|
|
17
|
+
const newDesc = desc + tagStr.slice(0, tagLength) + (tagStr.length > tagLength ? '...' : '');
|
|
18
|
+
return newDesc.length <= 157 ? newDesc : newDesc + '...';
|
|
19
|
+
}
|
|
20
|
+
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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('auth');
|
|
10
|
-
|
|
11
|
-
return <PageTitle title={t('login')} />;
|
|
12
|
-
});
|
|
13
|
-
export default Title;
|
|
@@ -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('auth');
|
|
10
|
-
|
|
11
|
-
return <PageTitle title={t('signup')} />;
|
|
12
|
-
});
|
|
13
|
-
export default Title;
|
|
@@ -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('auth');
|
|
10
|
-
|
|
11
|
-
return <PageTitle title={t('signup')} />;
|
|
12
|
-
});
|
|
13
|
-
export default Title;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useRouter } from 'next/navigation';
|
|
4
|
-
import { memo } from 'react';
|
|
5
|
-
import { Flexbox } from 'react-layout-kit';
|
|
6
|
-
import urlJoin from 'url-join';
|
|
7
|
-
|
|
8
|
-
import { useCategory } from '@/app/(main)/settings/hooks/useCategory';
|
|
9
|
-
import Cell from '@/components/Cell';
|
|
10
|
-
import Divider from '@/components/Cell/Divider';
|
|
11
|
-
|
|
12
|
-
const SettingCate = memo(() => {
|
|
13
|
-
const settingItems = useCategory({ mobile: true });
|
|
14
|
-
const router = useRouter();
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<Flexbox width={'100%'}>
|
|
18
|
-
{settingItems?.map(({ key, icon, label, type }: any, index) => {
|
|
19
|
-
if (type === 'divider') return <Divider key={index} />;
|
|
20
|
-
return (
|
|
21
|
-
<Cell
|
|
22
|
-
icon={icon}
|
|
23
|
-
key={key}
|
|
24
|
-
label={label}
|
|
25
|
-
onClick={() => router.push(urlJoin('/settings', key))}
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
28
|
-
})}
|
|
29
|
-
</Flexbox>
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export default SettingCate;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { Flexbox } from 'react-layout-kit';
|
|
5
|
-
|
|
6
|
-
import Cell from '@/components/Cell';
|
|
7
|
-
import Divider from '@/components/Cell/Divider';
|
|
8
|
-
|
|
9
|
-
import { useExtraCate } from './useExtraCate';
|
|
10
|
-
|
|
11
|
-
const ExtraCate = memo(() => {
|
|
12
|
-
const mainItems = useExtraCate();
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<Flexbox width={'100%'}>
|
|
16
|
-
{mainItems?.map(({ key, icon, label, type, onClick }: any, index) => {
|
|
17
|
-
if (type === 'divider') return <Divider key={index} />;
|
|
18
|
-
return <Cell icon={icon} key={key} label={label} onClick={onClick} />;
|
|
19
|
-
})}
|
|
20
|
-
</Flexbox>
|
|
21
|
-
);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export default ExtraCate;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { DiscordIcon, Icon } from '@lobehub/ui';
|
|
2
|
-
import { Book, Feather, HardDriveDownload, HardDriveUpload } from 'lucide-react';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
|
|
5
|
-
import { type MenuProps } from '@/components/Menu';
|
|
6
|
-
import { DISCORD, DOCUMENTS, FEEDBACK } from '@/const/url';
|
|
7
|
-
import DataImporter from '@/features/DataImporter';
|
|
8
|
-
import { configService } from '@/services/config';
|
|
9
|
-
|
|
10
|
-
export const useExtraCate = () => {
|
|
11
|
-
const { t } = useTranslation(['common', 'setting']);
|
|
12
|
-
|
|
13
|
-
const iconSize = { fontSize: 20 };
|
|
14
|
-
|
|
15
|
-
const exports: MenuProps['items'] = [
|
|
16
|
-
{
|
|
17
|
-
icon: <Icon icon={HardDriveUpload} size={iconSize} />,
|
|
18
|
-
key: 'import',
|
|
19
|
-
label: <DataImporter>{t('import')}</DataImporter>,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
icon: <Icon icon={HardDriveDownload} size={iconSize} />,
|
|
23
|
-
key: 'export',
|
|
24
|
-
label: t('export'),
|
|
25
|
-
onClick: configService.exportAll,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: 'divider',
|
|
29
|
-
},
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
const helps: MenuProps['items'] = [
|
|
33
|
-
{
|
|
34
|
-
icon: <Icon icon={Book} size={iconSize} />,
|
|
35
|
-
key: 'docs',
|
|
36
|
-
label: t('document'),
|
|
37
|
-
onClick: () => window.open(DOCUMENTS, '__blank'),
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
icon: <Icon icon={Feather} size={iconSize} />,
|
|
41
|
-
key: 'feedback',
|
|
42
|
-
label: t('feedback'),
|
|
43
|
-
onClick: () => window.open(FEEDBACK, '__blank'),
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
icon: <Icon icon={DiscordIcon} size={iconSize} />,
|
|
47
|
-
key: 'discord',
|
|
48
|
-
label: 'Discord',
|
|
49
|
-
onClick: () => window.open(DISCORD, '__blank'),
|
|
50
|
-
},
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
const mainItems = [
|
|
54
|
-
{
|
|
55
|
-
type: 'divider',
|
|
56
|
-
},
|
|
57
|
-
...exports,
|
|
58
|
-
...helps,
|
|
59
|
-
].filter(Boolean) as MenuProps['items'];
|
|
60
|
-
|
|
61
|
-
return mainItems;
|
|
62
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { redirect } from 'next/navigation';
|
|
2
|
-
import { Center } from 'react-layout-kit';
|
|
3
|
-
|
|
4
|
-
import BrandWatermark from '@/components/BrandWatermark';
|
|
5
|
-
import Divider from '@/components/Cell/Divider';
|
|
6
|
-
import DataStatistics from '@/features/User/DataStatistics';
|
|
7
|
-
import UserInfo from '@/features/User/UserInfo';
|
|
8
|
-
import { isMobileDevice } from '@/utils/responsive';
|
|
9
|
-
|
|
10
|
-
import Cate from './features/Cate';
|
|
11
|
-
import ExtraCate from './features/ExtraCate';
|
|
12
|
-
|
|
13
|
-
const Page = () => {
|
|
14
|
-
const mobile = isMobileDevice();
|
|
15
|
-
|
|
16
|
-
if (!mobile) return redirect('/chat');
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<>
|
|
20
|
-
<UserInfo />
|
|
21
|
-
<DataStatistics paddingInline={12} style={{ paddingBottom: 6 }} />
|
|
22
|
-
<Divider />
|
|
23
|
-
<Cate />
|
|
24
|
-
<ExtraCate />
|
|
25
|
-
<Center padding={16}>
|
|
26
|
-
<BrandWatermark />
|
|
27
|
-
</Center>
|
|
28
|
-
</>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default Page;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|