@lobehub/chat 1.26.13 → 1.26.15
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/.i18nrc.js +1 -0
- package/CHANGELOG.md +50 -0
- package/locales/ar/common.json +1 -0
- package/locales/ar/models.json +3 -0
- package/locales/bg-BG/common.json +1 -0
- package/locales/bg-BG/models.json +3 -0
- package/locales/de-DE/common.json +1 -0
- package/locales/de-DE/models.json +3 -0
- package/locales/en-US/common.json +1 -0
- package/locales/en-US/models.json +3 -0
- package/locales/es-ES/common.json +1 -0
- package/locales/es-ES/models.json +3 -0
- package/locales/fa-IR/auth.json +8 -0
- package/locales/fa-IR/chat.json +189 -0
- package/locales/fa-IR/clerk.json +769 -0
- package/locales/fa-IR/common.json +238 -0
- package/locales/fa-IR/components.json +84 -0
- package/locales/fa-IR/discover.json +204 -0
- package/locales/fa-IR/error.json +138 -0
- package/locales/fa-IR/file.json +94 -0
- package/locales/fa-IR/knowledgeBase.json +32 -0
- package/locales/fa-IR/market.json +32 -0
- package/locales/fa-IR/metadata.json +35 -0
- package/locales/fa-IR/migration.json +45 -0
- package/locales/fa-IR/modelProvider.json +164 -0
- package/locales/fa-IR/models.json +1108 -0
- package/locales/fa-IR/plugin.json +166 -0
- package/locales/fa-IR/portal.json +35 -0
- package/locales/fa-IR/providers.json +94 -0
- package/locales/fa-IR/ragEval.json +91 -0
- package/locales/fa-IR/setting.json +421 -0
- package/locales/fa-IR/tool.json +10 -0
- package/locales/fa-IR/welcome.json +50 -0
- package/locales/fr-FR/common.json +1 -0
- package/locales/fr-FR/models.json +3 -0
- package/locales/it-IT/common.json +1 -0
- package/locales/it-IT/models.json +3 -0
- package/locales/ja-JP/common.json +1 -0
- package/locales/ja-JP/models.json +3 -0
- package/locales/ko-KR/common.json +1 -0
- package/locales/ko-KR/models.json +3 -0
- package/locales/nl-NL/common.json +1 -0
- package/locales/nl-NL/models.json +3 -0
- package/locales/pl-PL/common.json +1 -0
- package/locales/pl-PL/models.json +3 -0
- package/locales/pt-BR/common.json +1 -0
- package/locales/pt-BR/models.json +3 -0
- package/locales/ru-RU/common.json +1 -0
- package/locales/ru-RU/models.json +3 -0
- package/locales/tr-TR/common.json +1 -0
- package/locales/tr-TR/models.json +3 -0
- package/locales/vi-VN/common.json +1 -0
- package/locales/vi-VN/models.json +3 -0
- package/locales/zh-CN/common.json +1 -0
- package/locales/zh-CN/models.json +3 -0
- package/locales/zh-TW/common.json +1 -0
- package/locales/zh-TW/models.json +3 -0
- package/package.json +2 -2
- package/src/config/app.ts +4 -1
- package/src/database/server/models/user.ts +6 -0
- package/src/layout/GlobalProvider/AppTheme.tsx +49 -29
- package/src/layout/GlobalProvider/index.tsx +2 -0
- package/src/libs/agent-runtime/BaseAI.ts +3 -3
- package/src/libs/agent-runtime/types/embeddings.ts +6 -16
- package/src/libs/agent-runtime/utils/openaiCompatibleFactory/index.ts +3 -3
- package/src/libs/langchain/loaders/index.ts +1 -1
- package/src/locales/default/common.ts +1 -0
- package/src/locales/resources.ts +5 -0
- package/src/server/routers/async/file.ts +3 -3
- package/src/server/routers/async/ragEval.ts +1 -1
- package/src/server/routers/lambda/chunk.ts +2 -2
- package/src/server/sitemap.test.ts +4 -4
@@ -131,6 +131,9 @@
|
|
131
131
|
"Qwen/Qwen2.5-32B-Instruct": {
|
132
132
|
"description": "Qwen2.5, talimat tabanlı görevlerin işlenmesini optimize etmek için tasarlanmış yeni bir büyük dil modeli serisidir."
|
133
133
|
},
|
134
|
+
"Qwen/Qwen2.5-72B-Instruct": {
|
135
|
+
"description": "Alibaba Cloud Tongyi Qianwen ekibi tarafından geliştirilen büyük bir dil modeli"
|
136
|
+
},
|
134
137
|
"Qwen/Qwen2.5-72B-Instruct-128K": {
|
135
138
|
"description": "Qwen2.5, daha güçlü anlama ve üretim yeteneği ile yeni bir büyük dil modeli serisidir."
|
136
139
|
},
|
@@ -131,6 +131,9 @@
|
|
131
131
|
"Qwen/Qwen2.5-32B-Instruct": {
|
132
132
|
"description": "Qwen2.5 là một loạt mô hình ngôn ngữ lớn hoàn toàn mới, nhằm tối ưu hóa việc xử lý các nhiệm vụ theo hướng dẫn."
|
133
133
|
},
|
134
|
+
"Qwen/Qwen2.5-72B-Instruct": {
|
135
|
+
"description": "Mô hình ngôn ngữ lớn được phát triển bởi đội ngũ Qianwen của Alibaba Cloud"
|
136
|
+
},
|
134
137
|
"Qwen/Qwen2.5-72B-Instruct-128K": {
|
135
138
|
"description": "Qwen2.5 là một loạt mô hình ngôn ngữ lớn hoàn toàn mới, sở hữu khả năng hiểu và tạo ra mạnh mẽ hơn."
|
136
139
|
},
|
@@ -131,6 +131,9 @@
|
|
131
131
|
"Qwen/Qwen2.5-32B-Instruct": {
|
132
132
|
"description": "Qwen2.5 是全新的大型语言模型系列,旨在优化指令式任务的处理。"
|
133
133
|
},
|
134
|
+
"Qwen/Qwen2.5-72B-Instruct": {
|
135
|
+
"description": "阿里云通义千问团队开发的大型语言模型"
|
136
|
+
},
|
134
137
|
"Qwen/Qwen2.5-72B-Instruct-128K": {
|
135
138
|
"description": "Qwen2.5 是全新的大型语言模型系列,具有更强的理解和生成能力。"
|
136
139
|
},
|
@@ -131,6 +131,9 @@
|
|
131
131
|
"Qwen/Qwen2.5-32B-Instruct": {
|
132
132
|
"description": "Qwen2.5是全新的大型語言模型系列,旨在優化指令式任務的處理。"
|
133
133
|
},
|
134
|
+
"Qwen/Qwen2.5-72B-Instruct": {
|
135
|
+
"description": "阿里雲通義千問團隊開發的大型語言模型"
|
136
|
+
},
|
134
137
|
"Qwen/Qwen2.5-72B-Instruct-128K": {
|
135
138
|
"description": "Qwen2.5 是全新的大型語言模型系列,具有更強的理解和生成能力。"
|
136
139
|
},
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.26.
|
3
|
+
"version": "1.26.15",
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
5
5
|
"keywords": [
|
6
6
|
"framework",
|
@@ -125,7 +125,7 @@
|
|
125
125
|
"@lobehub/chat-plugins-gateway": "^1.9.0",
|
126
126
|
"@lobehub/icons": "^1.35.4",
|
127
127
|
"@lobehub/tts": "^1.25.1",
|
128
|
-
"@lobehub/ui": "^1.
|
128
|
+
"@lobehub/ui": "^1.152.0",
|
129
129
|
"@neondatabase/serverless": "^0.10.1",
|
130
130
|
"@next/third-parties": "^14.2.15",
|
131
131
|
"@react-spring/web": "^9.7.5",
|
package/src/config/app.ts
CHANGED
@@ -44,6 +44,8 @@ export const getAppConfig = () => {
|
|
44
44
|
|
45
45
|
APP_URL: z.string().optional(),
|
46
46
|
CDN_USE_GLOBAL: z.boolean().optional(),
|
47
|
+
CUSTOM_FONT_FAMILY: z.string().optional(),
|
48
|
+
CUSTOM_FONT_URL: z.string().optional(),
|
47
49
|
},
|
48
50
|
runtimeEnv: {
|
49
51
|
NEXT_PUBLIC_BASE_PATH: process.env.NEXT_PUBLIC_BASE_PATH || '',
|
@@ -67,7 +69,8 @@ export const getAppConfig = () => {
|
|
67
69
|
PLUGIN_SETTINGS: process.env.PLUGIN_SETTINGS,
|
68
70
|
|
69
71
|
APP_URL,
|
70
|
-
|
72
|
+
CUSTOM_FONT_FAMILY: process.env.CUSTOM_FONT_FAMILY,
|
73
|
+
CUSTOM_FONT_URL: process.env.CUSTOM_FONT_URL,
|
71
74
|
CDN_USE_GLOBAL: process.env.CDN_USE_GLOBAL === '1',
|
72
75
|
},
|
73
76
|
});
|
@@ -19,6 +19,12 @@ export class UserNotFoundError extends TRPCError {
|
|
19
19
|
|
20
20
|
export class UserModel {
|
21
21
|
static createUser = async (params: NewUser) => {
|
22
|
+
// if user already exists, skip creation
|
23
|
+
if (params.id) {
|
24
|
+
const user = await serverDB.query.users.findFirst({ where: eq(users.id, params.id) });
|
25
|
+
if (!!user) return;
|
26
|
+
}
|
27
|
+
|
22
28
|
const [user] = await serverDB
|
23
29
|
.insert(users)
|
24
30
|
.values({ ...params })
|
@@ -1,7 +1,12 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
|
-
import {
|
4
|
-
|
3
|
+
import {
|
4
|
+
ConfigProvider,
|
5
|
+
FontLoader,
|
6
|
+
NeutralColors,
|
7
|
+
PrimaryColors,
|
8
|
+
ThemeProvider,
|
9
|
+
} from '@lobehub/ui';
|
5
10
|
import { ThemeAppearance, createStyles } from 'antd-style';
|
6
11
|
import 'antd/dist/reset.css';
|
7
12
|
import Image from 'next/image';
|
@@ -77,6 +82,8 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
77
82
|
|
78
83
|
export interface AppThemeProps {
|
79
84
|
children?: ReactNode;
|
85
|
+
customFontFamily?: string;
|
86
|
+
customFontURL?: string;
|
80
87
|
defaultAppearance?: ThemeAppearance;
|
81
88
|
defaultNeutralColor?: NeutralColors;
|
82
89
|
defaultPrimaryColor?: PrimaryColors;
|
@@ -84,12 +91,20 @@ export interface AppThemeProps {
|
|
84
91
|
}
|
85
92
|
|
86
93
|
const AppTheme = memo<AppThemeProps>(
|
87
|
-
({
|
94
|
+
({
|
95
|
+
children,
|
96
|
+
defaultAppearance,
|
97
|
+
defaultPrimaryColor,
|
98
|
+
defaultNeutralColor,
|
99
|
+
globalCDN,
|
100
|
+
customFontURL,
|
101
|
+
customFontFamily,
|
102
|
+
}) => {
|
88
103
|
// console.debug('server:appearance', defaultAppearance);
|
89
104
|
// console.debug('server:primaryColor', defaultPrimaryColor);
|
90
105
|
// console.debug('server:neutralColor', defaultNeutralColor);
|
91
106
|
const themeMode = useUserStore(userGeneralSettingsSelectors.currentThemeMode);
|
92
|
-
const { styles, cx } = useStyles();
|
107
|
+
const { styles, cx, theme } = useStyles();
|
93
108
|
const [primaryColor, neutralColor] = useUserStore((s) => [
|
94
109
|
userGeneralSettingsSelectors.primaryColor(s),
|
95
110
|
userGeneralSettingsSelectors.neutralColor(s),
|
@@ -104,33 +119,38 @@ const AppTheme = memo<AppThemeProps>(
|
|
104
119
|
}, [neutralColor]);
|
105
120
|
|
106
121
|
return (
|
107
|
-
<
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
122
|
+
<ThemeProvider
|
123
|
+
className={cx(styles.app, styles.scrollbar, styles.scrollbarPolyfill)}
|
124
|
+
customTheme={{
|
125
|
+
neutralColor: neutralColor ?? defaultNeutralColor,
|
126
|
+
primaryColor: primaryColor ?? defaultPrimaryColor,
|
127
|
+
}}
|
128
|
+
defaultAppearance={defaultAppearance}
|
129
|
+
onAppearanceChange={(appearance) => {
|
130
|
+
setCookie(LOBE_THEME_APPEARANCE, appearance);
|
131
|
+
}}
|
132
|
+
theme={{
|
133
|
+
cssVar: true,
|
134
|
+
token: {
|
135
|
+
fontFamily: customFontFamily ? `${customFontFamily},${theme.fontFamily}` : undefined,
|
136
|
+
},
|
137
|
+
}}
|
138
|
+
themeMode={themeMode}
|
139
|
+
>
|
140
|
+
{!!customFontURL && <FontLoader url={customFontURL} />}
|
141
|
+
<GlobalStyle />
|
142
|
+
<AntdStaticMethods />
|
143
|
+
<ConfigProvider
|
144
|
+
config={{
|
145
|
+
aAs: Link,
|
146
|
+
imgAs: Image,
|
147
|
+
imgUnoptimized: true,
|
148
|
+
proxy: globalCDN ? 'unpkg' : undefined,
|
117
149
|
}}
|
118
|
-
themeMode={themeMode}
|
119
150
|
>
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
config={{
|
124
|
-
aAs: Link,
|
125
|
-
imgAs: Image,
|
126
|
-
imgUnoptimized: true,
|
127
|
-
proxy: globalCDN ? 'unpkg' : undefined,
|
128
|
-
}}
|
129
|
-
>
|
130
|
-
{children}
|
131
|
-
</ConfigProvider>
|
132
|
-
</ThemeProvider>
|
133
|
-
</AntdConfigProvider>
|
151
|
+
{children}
|
152
|
+
</ConfigProvider>
|
153
|
+
</ThemeProvider>
|
134
154
|
);
|
135
155
|
},
|
136
156
|
);
|
@@ -69,6 +69,8 @@ const GlobalLayout = async ({ children }: PropsWithChildren) => {
|
|
69
69
|
<StyleRegistry>
|
70
70
|
<Locale antdLocale={antdLocale} defaultLang={userLocale}>
|
71
71
|
<AppTheme
|
72
|
+
customFontFamily={appEnv.CUSTOM_FONT_FAMILY}
|
73
|
+
customFontURL={appEnv.CUSTOM_FONT_URL}
|
72
74
|
defaultAppearance={appearance?.value}
|
73
75
|
defaultNeutralColor={neutralColor?.value as any}
|
74
76
|
defaultPrimaryColor={primaryColor?.value as any}
|
@@ -5,7 +5,7 @@ import { ChatModelCard } from '@/types/llm';
|
|
5
5
|
import {
|
6
6
|
ChatCompetitionOptions,
|
7
7
|
ChatStreamPayload,
|
8
|
-
|
8
|
+
Embeddings,
|
9
9
|
EmbeddingsOptions,
|
10
10
|
EmbeddingsPayload,
|
11
11
|
TextToImagePayload,
|
@@ -17,7 +17,7 @@ export interface LobeRuntimeAI {
|
|
17
17
|
baseURL?: string;
|
18
18
|
chat(payload: ChatStreamPayload, options?: ChatCompetitionOptions): Promise<Response>;
|
19
19
|
|
20
|
-
embeddings?(payload: EmbeddingsPayload, options?: EmbeddingsOptions): Promise<
|
20
|
+
embeddings?(payload: EmbeddingsPayload, options?: EmbeddingsOptions): Promise<Embeddings[]>;
|
21
21
|
|
22
22
|
models?(): Promise<any>;
|
23
23
|
|
@@ -40,5 +40,5 @@ export abstract class LobeOpenAICompatibleRuntime {
|
|
40
40
|
abstract embeddings(
|
41
41
|
payload: EmbeddingsPayload,
|
42
42
|
options?: EmbeddingsOptions,
|
43
|
-
): Promise<
|
43
|
+
): Promise<Embeddings[]>;
|
44
44
|
}
|
@@ -25,19 +25,9 @@ export interface EmbeddingsOptions {
|
|
25
25
|
user?: string;
|
26
26
|
}
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
embedding: Array<number>;
|
35
|
-
/**
|
36
|
-
* The index of the embedding in the list of embeddings.
|
37
|
-
*/
|
38
|
-
index: number;
|
39
|
-
/**
|
40
|
-
* The object type, which is always "embedding".
|
41
|
-
*/
|
42
|
-
object: 'embedding';
|
43
|
-
}
|
28
|
+
/**
|
29
|
+
* The embedding vector, which is a list of floats. The length of vector depends on
|
30
|
+
* the model as listed in the
|
31
|
+
* [embedding guide](https://platform.openai.com/docs/guides/embeddings).
|
32
|
+
*/
|
33
|
+
export type Embeddings = Array<number>;
|
@@ -10,7 +10,7 @@ import {
|
|
10
10
|
ChatCompetitionOptions,
|
11
11
|
ChatCompletionErrorPayload,
|
12
12
|
ChatStreamPayload,
|
13
|
-
|
13
|
+
Embeddings,
|
14
14
|
EmbeddingsOptions,
|
15
15
|
EmbeddingsPayload,
|
16
16
|
TextToImagePayload,
|
@@ -271,14 +271,14 @@ export const LobeOpenAICompatibleFactory = <T extends Record<string, any> = any>
|
|
271
271
|
async embeddings(
|
272
272
|
payload: EmbeddingsPayload,
|
273
273
|
options?: EmbeddingsOptions,
|
274
|
-
): Promise<
|
274
|
+
): Promise<Embeddings[]> {
|
275
275
|
try {
|
276
276
|
const res = await this.client.embeddings.create(
|
277
277
|
{ ...payload, user: options?.user },
|
278
278
|
{ headers: options?.headers, signal: options?.signal },
|
279
279
|
);
|
280
280
|
|
281
|
-
return res.data;
|
281
|
+
return res.data.map((item) => item.embedding);
|
282
282
|
} catch (error) {
|
283
283
|
throw this.handleError(error);
|
284
284
|
}
|
@@ -61,7 +61,7 @@ export class ChunkingLoader {
|
|
61
61
|
|
62
62
|
default: {
|
63
63
|
throw new Error(
|
64
|
-
|
64
|
+
`Unsupported file type [${type}], please check your file is supported, or create report issue here: https://github.com/lobehub/lobe-chat/discussions/3550`,
|
65
65
|
);
|
66
66
|
}
|
67
67
|
}
|
package/src/locales/resources.ts
CHANGED
@@ -15,6 +15,7 @@ export const locales = [
|
|
15
15
|
'zh-CN',
|
16
16
|
'zh-TW',
|
17
17
|
'vi-VN',
|
18
|
+
'fa-IR',
|
18
19
|
] as const;
|
19
20
|
|
20
21
|
export type DefaultResources = typeof resources;
|
@@ -111,6 +112,10 @@ export const localeOptions: LocaleOptions = [
|
|
111
112
|
label: 'Български',
|
112
113
|
value: 'bg-BG',
|
113
114
|
},
|
115
|
+
{
|
116
|
+
label: 'فارسی',
|
117
|
+
value: 'fa-IR',
|
118
|
+
},
|
114
119
|
] as LocaleOptions;
|
115
120
|
|
116
121
|
export const supportLocales: string[] = [...locales, 'en', 'zh'];
|
@@ -105,9 +105,9 @@ export const fileRouter = router({
|
|
105
105
|
console.timeEnd(`任务[${number}]: embeddings`);
|
106
106
|
|
107
107
|
const items: NewEmbeddingsItem[] =
|
108
|
-
embeddings?.map((e) => ({
|
109
|
-
chunkId: chunks[
|
110
|
-
embeddings: e
|
108
|
+
embeddings?.map((e, idx) => ({
|
109
|
+
chunkId: chunks[idx].id,
|
110
|
+
embeddings: e,
|
111
111
|
fileId: input.fileId,
|
112
112
|
model: input.model,
|
113
113
|
})) || [];
|
@@ -120,7 +120,7 @@ export const chunkRouter = router({
|
|
120
120
|
console.timeEnd('embedding');
|
121
121
|
|
122
122
|
return ctx.chunkModel.semanticSearch({
|
123
|
-
embedding: embeddings![0]
|
123
|
+
embedding: embeddings![0],
|
124
124
|
fileIds: input.fileIds,
|
125
125
|
query: input.query,
|
126
126
|
});
|
@@ -147,7 +147,7 @@ export const chunkRouter = router({
|
|
147
147
|
model: input.model || DEFAULT_EMBEDDING_MODEL,
|
148
148
|
});
|
149
149
|
|
150
|
-
embedding = embeddings![0]
|
150
|
+
embedding = embeddings![0];
|
151
151
|
const embeddingsId = await ctx.embeddingModel.create({
|
152
152
|
embeddings: embedding,
|
153
153
|
model: input.model,
|
@@ -73,7 +73,7 @@ describe('Sitemap', () => {
|
|
73
73
|
]);
|
74
74
|
|
75
75
|
const assistantsSitemap = await sitemap.getAssistants();
|
76
|
-
expect(assistantsSitemap.length).toBe(
|
76
|
+
expect(assistantsSitemap.length).toBe(15);
|
77
77
|
expect(assistantsSitemap).toContainEqual(
|
78
78
|
expect.objectContaining({
|
79
79
|
url: getCanonicalUrl('/discover/assistant/test-assistant'),
|
@@ -97,7 +97,7 @@ describe('Sitemap', () => {
|
|
97
97
|
]);
|
98
98
|
|
99
99
|
const pluginsSitemap = await sitemap.getPlugins();
|
100
|
-
expect(pluginsSitemap.length).toBe(
|
100
|
+
expect(pluginsSitemap.length).toBe(15);
|
101
101
|
expect(pluginsSitemap).toContainEqual(
|
102
102
|
expect.objectContaining({
|
103
103
|
url: getCanonicalUrl('/discover/plugin/test-plugin'),
|
@@ -121,7 +121,7 @@ describe('Sitemap', () => {
|
|
121
121
|
]);
|
122
122
|
|
123
123
|
const modelsSitemap = await sitemap.getModels();
|
124
|
-
expect(modelsSitemap.length).toBe(
|
124
|
+
expect(modelsSitemap.length).toBe(15);
|
125
125
|
expect(modelsSitemap).toContainEqual(
|
126
126
|
expect.objectContaining({
|
127
127
|
url: getCanonicalUrl('/discover/model/test:model'),
|
@@ -145,7 +145,7 @@ describe('Sitemap', () => {
|
|
145
145
|
]);
|
146
146
|
|
147
147
|
const providersSitemap = await sitemap.getProviders();
|
148
|
-
expect(providersSitemap.length).toBe(
|
148
|
+
expect(providersSitemap.length).toBe(15);
|
149
149
|
expect(providersSitemap).toContainEqual(
|
150
150
|
expect.objectContaining({
|
151
151
|
url: getCanonicalUrl('/discover/provider/test-provider'),
|