@lobehub/chat 1.106.7 → 1.107.0
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/.env.example +9 -0
- package/CHANGELOG.md +50 -0
- package/Dockerfile +2 -0
- package/Dockerfile.database +2 -0
- package/Dockerfile.pglite +2 -0
- package/changelog/v1.json +18 -0
- package/docs/usage/providers/aihubmix.zh-CN.mdx +101 -0
- package/locales/ar/modelProvider.json +1 -0
- package/locales/ar/providers.json +3 -0
- package/locales/bg-BG/modelProvider.json +1 -0
- package/locales/bg-BG/providers.json +3 -0
- package/locales/de-DE/modelProvider.json +1 -0
- package/locales/de-DE/providers.json +3 -0
- package/locales/en-US/modelProvider.json +1 -0
- package/locales/en-US/providers.json +3 -0
- package/locales/es-ES/modelProvider.json +1 -0
- package/locales/es-ES/providers.json +3 -0
- package/locales/fa-IR/modelProvider.json +1 -0
- package/locales/fa-IR/providers.json +3 -0
- package/locales/fr-FR/modelProvider.json +1 -0
- package/locales/fr-FR/providers.json +3 -0
- package/locales/it-IT/modelProvider.json +1 -0
- package/locales/it-IT/providers.json +3 -0
- package/locales/ja-JP/modelProvider.json +1 -0
- package/locales/ja-JP/providers.json +3 -0
- package/locales/ko-KR/modelProvider.json +1 -0
- package/locales/ko-KR/providers.json +3 -0
- package/locales/nl-NL/modelProvider.json +1 -0
- package/locales/nl-NL/providers.json +3 -0
- package/locales/pl-PL/modelProvider.json +1 -0
- package/locales/pl-PL/providers.json +3 -0
- package/locales/pt-BR/modelProvider.json +1 -0
- package/locales/pt-BR/providers.json +3 -0
- package/locales/ru-RU/modelProvider.json +1 -0
- package/locales/ru-RU/providers.json +3 -0
- package/locales/tr-TR/modelProvider.json +1 -0
- package/locales/tr-TR/providers.json +3 -0
- package/locales/vi-VN/modelProvider.json +1 -0
- package/locales/vi-VN/providers.json +3 -0
- package/locales/zh-CN/modelProvider.json +1 -0
- package/locales/zh-CN/providers.json +3 -0
- package/locales/zh-TW/modelProvider.json +1 -0
- package/locales/zh-TW/providers.json +3 -0
- package/package.json +1 -2
- package/src/app/(backend)/middleware/auth/index.ts +2 -2
- package/src/app/(backend)/webapi/chat/[provider]/route.test.ts +12 -12
- package/src/app/(backend)/webapi/chat/[provider]/route.ts +6 -6
- package/src/app/(backend)/webapi/chat/vertexai/route.ts +2 -2
- package/src/app/(backend)/webapi/models/[provider]/pull/route.ts +2 -2
- package/src/app/(backend)/webapi/models/[provider]/route.ts +2 -2
- package/src/app/(backend)/webapi/text-to-image/[provider]/route.ts +2 -2
- package/src/app/[variants]/(main)/settings/provider/(detail)/github/page.tsx +2 -2
- package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsx +17 -2
- package/src/config/aiModels/aihubmix.ts +164 -0
- package/src/config/aiModels/index.ts +3 -0
- package/src/config/aiModels/sensenova.ts +82 -3
- package/src/config/llm.ts +6 -0
- package/src/config/modelProviders/aihubmix.ts +18 -0
- package/src/config/modelProviders/huggingface.ts +1 -0
- package/src/config/modelProviders/index.ts +4 -0
- package/src/libs/model-runtime/ModelRuntime.test.ts +9 -10
- package/src/libs/model-runtime/ModelRuntime.ts +2 -3
- package/src/libs/model-runtime/RouterRuntime/baseRuntimeMap.ts +15 -0
- package/src/libs/model-runtime/RouterRuntime/createRuntime.ts +193 -0
- package/src/libs/model-runtime/RouterRuntime/index.ts +9 -0
- package/src/libs/model-runtime/aihubmix/index.ts +118 -0
- package/src/libs/model-runtime/index.ts +1 -1
- package/src/libs/model-runtime/openrouter/index.ts +2 -2
- package/src/libs/model-runtime/runtimeMap.ts +2 -0
- package/src/libs/model-runtime/sensenova/index.ts +4 -1
- package/src/libs/model-runtime/types/type.ts +1 -0
- package/src/locales/default/modelProvider.ts +1 -0
- package/src/server/modules/{AgentRuntime → ModelRuntime}/index.test.ts +64 -67
- package/src/server/modules/{AgentRuntime → ModelRuntime}/index.ts +3 -3
- package/src/server/routers/async/file.ts +2 -2
- package/src/server/routers/async/image.ts +2 -2
- package/src/server/routers/async/ragEval.ts +2 -2
- package/src/server/routers/lambda/chunk.ts +3 -3
- package/src/services/__tests__/chat.test.ts +21 -21
- package/src/services/chat.ts +2 -2
- package/src/types/aiProvider.ts +1 -0
- package/src/types/llm.ts +4 -0
- package/src/types/user/settings/keyVaults.ts +1 -0
- package/src/app/[variants]/(main)/settings/provider/(detail)/huggingface/page.tsx +0 -67
- /package/src/server/modules/{AgentRuntime → ModelRuntime}/apiKeyManager.test.ts +0 -0
- /package/src/server/modules/{AgentRuntime → ModelRuntime}/apiKeyManager.ts +0 -0
- /package/src/server/modules/{AgentRuntime → ModelRuntime}/trace.ts +0 -0
@@ -5,6 +5,9 @@
|
|
5
5
|
"ai360": {
|
6
6
|
"description": "360 AI 是 360 公司推出的 AI 模型和服務平台,提供多種先進的自然語言處理模型,包括 360GPT2 Pro、360GPT Pro、360GPT Turbo 和 360GPT Turbo Responsibility 8K。這些模型結合了大規模參數和多模態能力,廣泛應用於文本生成、語義理解、對話系統與代碼生成等領域。通過靈活的定價策略,360 AI 滿足多樣化用戶需求,支持開發者集成,推動智能化應用的革新和發展。"
|
7
7
|
},
|
8
|
+
"aihubmix": {
|
9
|
+
"description": "AiHubMix 透過統一的 API 介面提供對多種 AI 模型的存取。"
|
10
|
+
},
|
8
11
|
"anthropic": {
|
9
12
|
"description": "Anthropic 是一家專注於人工智慧研究和開發的公司,提供了一系列先進的語言模型,如 Claude 3.5 Sonnet、Claude 3 Sonnet、Claude 3 Opus 和 Claude 3 Haiku。這些模型在智能、速度和成本之間取得了理想的平衡,適用於從企業級工作負載到快速響應的各種應用場景。Claude 3.5 Sonnet 作為其最新模型,在多項評估中表現優異,同時保持了較高的性價比。"
|
10
13
|
},
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.107.0",
|
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",
|
@@ -264,7 +264,6 @@
|
|
264
264
|
"systemjs": "^6.15.1",
|
265
265
|
"tokenx": "^0.4.1",
|
266
266
|
"ts-md5": "^1.3.1",
|
267
|
-
"type-fest": "^4.41.0",
|
268
267
|
"ua-parser-js": "^1.0.40",
|
269
268
|
"unstructured-client": "^0.19.0",
|
270
269
|
"url-join": "^5.0.0",
|
@@ -9,7 +9,7 @@ import {
|
|
9
9
|
enableClerk,
|
10
10
|
} from '@/const/auth';
|
11
11
|
import { ClerkAuth } from '@/libs/clerk-auth';
|
12
|
-
import {
|
12
|
+
import { AgentRuntimeError, ChatCompletionErrorPayload, ModelRuntime } from '@/libs/model-runtime';
|
13
13
|
import { validateOIDCJWT } from '@/libs/oidc-provider/jwt';
|
14
14
|
import { ChatErrorType } from '@/types/fetch';
|
15
15
|
import { createErrorResponse } from '@/utils/errorResponse';
|
@@ -17,7 +17,7 @@ import { getXorPayload } from '@/utils/server/xor';
|
|
17
17
|
|
18
18
|
import { checkAuthMethod } from './utils';
|
19
19
|
|
20
|
-
type CreateRuntime = (jwtPayload: ClientSecretPayload) =>
|
20
|
+
type CreateRuntime = (jwtPayload: ClientSecretPayload) => ModelRuntime;
|
21
21
|
type RequestOptions = { createRuntime?: CreateRuntime; params: Promise<{ provider: string }> };
|
22
22
|
|
23
23
|
export type RequestHandler = (
|
@@ -4,7 +4,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
4
|
|
5
5
|
import { checkAuthMethod } from '@/app/(backend)/middleware/auth/utils';
|
6
6
|
import { LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED } from '@/const/auth';
|
7
|
-
import {
|
7
|
+
import { LobeRuntimeAI, ModelRuntime } from '@/libs/model-runtime';
|
8
8
|
import { ChatErrorType } from '@/types/fetch';
|
9
9
|
import { getXorPayload } from '@/utils/server/xor';
|
10
10
|
|
@@ -57,10 +57,10 @@ afterEach(() => {
|
|
57
57
|
|
58
58
|
describe('POST handler', () => {
|
59
59
|
describe('init chat model', () => {
|
60
|
-
it('should initialize
|
60
|
+
it('should initialize ModelRuntime correctly with valid authorization', async () => {
|
61
61
|
const mockParams = Promise.resolve({ provider: 'test-provider' });
|
62
62
|
|
63
|
-
// 设置 getJWTPayload 和
|
63
|
+
// 设置 getJWTPayload 和 initModelRuntimeWithUserPayload 的模拟返回值
|
64
64
|
vi.mocked(getXorPayload).mockReturnValueOnce({
|
65
65
|
accessCode: 'test-access-code',
|
66
66
|
apiKey: 'test-api-key',
|
@@ -69,10 +69,10 @@ describe('POST handler', () => {
|
|
69
69
|
|
70
70
|
const mockRuntime: LobeRuntimeAI = { baseURL: 'abc', chat: vi.fn() };
|
71
71
|
|
72
|
-
// migrate to new
|
72
|
+
// migrate to new ModelRuntime init api
|
73
73
|
const spy = vi
|
74
|
-
.spyOn(
|
75
|
-
.mockResolvedValue(new
|
74
|
+
.spyOn(ModelRuntime, 'initializeWithProvider')
|
75
|
+
.mockResolvedValue(new ModelRuntime(mockRuntime));
|
76
76
|
|
77
77
|
// 调用 POST 函数
|
78
78
|
await POST(request as unknown as Request, { params: mockParams });
|
@@ -111,14 +111,14 @@ describe('POST handler', () => {
|
|
111
111
|
});
|
112
112
|
|
113
113
|
const mockParams = Promise.resolve({ provider: 'test-provider' });
|
114
|
-
// 设置
|
114
|
+
// 设置 initModelRuntimeWithUserPayload 的模拟返回值
|
115
115
|
vi.mocked(getAuth).mockReturnValue({} as any);
|
116
116
|
vi.mocked(checkAuthMethod).mockReset();
|
117
117
|
|
118
118
|
const mockRuntime: LobeRuntimeAI = { baseURL: 'abc', chat: vi.fn() };
|
119
119
|
|
120
|
-
vi.spyOn(
|
121
|
-
new
|
120
|
+
vi.spyOn(ModelRuntime, 'initializeWithProvider').mockResolvedValue(
|
121
|
+
new ModelRuntime(mockRuntime),
|
122
122
|
);
|
123
123
|
|
124
124
|
const request = new Request(new URL('https://test.com'), {
|
@@ -178,12 +178,12 @@ describe('POST handler', () => {
|
|
178
178
|
|
179
179
|
const mockChatResponse: any = { success: true, message: 'Reply from agent' };
|
180
180
|
|
181
|
-
vi.spyOn(
|
181
|
+
vi.spyOn(ModelRuntime.prototype, 'chat').mockResolvedValue(mockChatResponse);
|
182
182
|
|
183
183
|
const response = await POST(request as unknown as Request, { params: mockParams });
|
184
184
|
|
185
185
|
expect(response).toEqual(mockChatResponse);
|
186
|
-
expect(
|
186
|
+
expect(ModelRuntime.prototype.chat).toHaveBeenCalledWith(mockChatPayload, {
|
187
187
|
user: 'abc',
|
188
188
|
signal: expect.anything(),
|
189
189
|
});
|
@@ -210,7 +210,7 @@ describe('POST handler', () => {
|
|
210
210
|
errorMessage: 'Something went wrong',
|
211
211
|
};
|
212
212
|
|
213
|
-
vi.spyOn(
|
213
|
+
vi.spyOn(ModelRuntime.prototype, 'chat').mockRejectedValue(mockErrorResponse);
|
214
214
|
|
215
215
|
const response = await POST(request, { params: mockParams });
|
216
216
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
2
2
|
import {
|
3
3
|
AGENT_RUNTIME_ERROR_SET,
|
4
|
-
AgentRuntime,
|
5
4
|
ChatCompletionErrorPayload,
|
5
|
+
ModelRuntime,
|
6
6
|
} from '@/libs/model-runtime';
|
7
|
-
import { createTraceOptions,
|
7
|
+
import { createTraceOptions, initModelRuntimeWithUserPayload } from '@/server/modules/ModelRuntime';
|
8
8
|
import { ChatErrorType } from '@/types/fetch';
|
9
9
|
import { ChatStreamPayload } from '@/types/openai/chat';
|
10
10
|
import { createErrorResponse } from '@/utils/errorResponse';
|
@@ -17,11 +17,11 @@ export const POST = checkAuth(async (req: Request, { params, jwtPayload, createR
|
|
17
17
|
|
18
18
|
try {
|
19
19
|
// ============ 1. init chat model ============ //
|
20
|
-
let
|
20
|
+
let modelRuntime: ModelRuntime;
|
21
21
|
if (createRuntime) {
|
22
|
-
|
22
|
+
modelRuntime = createRuntime(jwtPayload);
|
23
23
|
} else {
|
24
|
-
|
24
|
+
modelRuntime = await initModelRuntimeWithUserPayload(provider, jwtPayload);
|
25
25
|
}
|
26
26
|
|
27
27
|
// ============ 2. create chat completion ============ //
|
@@ -36,7 +36,7 @@ export const POST = checkAuth(async (req: Request, { params, jwtPayload, createR
|
|
36
36
|
traceOptions = createTraceOptions(data, { provider, trace: tracePayload });
|
37
37
|
}
|
38
38
|
|
39
|
-
return await
|
39
|
+
return await modelRuntime.chat(data, {
|
40
40
|
user: jwtPayload.userId,
|
41
41
|
...traceOptions,
|
42
42
|
signal: req.signal,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
2
|
-
import {
|
2
|
+
import { ModelProvider, ModelRuntime } from '@/libs/model-runtime';
|
3
3
|
import { LobeVertexAI } from '@/libs/model-runtime/vertexai';
|
4
4
|
import { safeParseJSON } from '@/utils/safeParseJSON';
|
5
5
|
|
@@ -28,7 +28,7 @@ export const POST = checkAuth(async (req: Request, { jwtPayload }) =>
|
|
28
28
|
project: !!credentials?.project_id ? credentials?.project_id : process.env.VERTEXAI_PROJECT,
|
29
29
|
});
|
30
30
|
|
31
|
-
return new
|
31
|
+
return new ModelRuntime(instance);
|
32
32
|
},
|
33
33
|
params: Promise.resolve({ provider: ModelProvider.VertexAI }),
|
34
34
|
}),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
2
2
|
import { ChatCompletionErrorPayload, PullModelParams } from '@/libs/model-runtime';
|
3
|
-
import {
|
3
|
+
import { initModelRuntimeWithUserPayload } from '@/server/modules/ModelRuntime';
|
4
4
|
import { ChatErrorType } from '@/types/fetch';
|
5
5
|
import { createErrorResponse } from '@/utils/errorResponse';
|
6
6
|
|
@@ -10,7 +10,7 @@ export const POST = checkAuth(async (req, { params, jwtPayload }) => {
|
|
10
10
|
const { provider } = await params;
|
11
11
|
|
12
12
|
try {
|
13
|
-
const agentRuntime = await
|
13
|
+
const agentRuntime = await initModelRuntimeWithUserPayload(provider, jwtPayload);
|
14
14
|
|
15
15
|
const data = (await req.json()) as PullModelParams;
|
16
16
|
|
@@ -2,7 +2,7 @@ import { NextResponse } from 'next/server';
|
|
2
2
|
|
3
3
|
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
4
4
|
import { ChatCompletionErrorPayload, ModelProvider } from '@/libs/model-runtime';
|
5
|
-
import {
|
5
|
+
import { initModelRuntimeWithUserPayload } from '@/server/modules/ModelRuntime';
|
6
6
|
import { ChatErrorType } from '@/types/fetch';
|
7
7
|
import { createErrorResponse } from '@/utils/errorResponse';
|
8
8
|
|
@@ -16,7 +16,7 @@ export const GET = checkAuth(async (req, { params, jwtPayload }) => {
|
|
16
16
|
try {
|
17
17
|
const hasDefaultApiKey = jwtPayload.apiKey || 'dont-need-api-key-for-model-list';
|
18
18
|
|
19
|
-
const agentRuntime = await
|
19
|
+
const agentRuntime = await initModelRuntimeWithUserPayload(provider, {
|
20
20
|
...jwtPayload,
|
21
21
|
apiKey: noNeedAPIKey(provider) ? hasDefaultApiKey : jwtPayload.apiKey,
|
22
22
|
});
|
@@ -3,7 +3,7 @@ import { NextResponse } from 'next/server';
|
|
3
3
|
import { checkAuth } from '@/app/(backend)/middleware/auth';
|
4
4
|
import { ChatCompletionErrorPayload } from '@/libs/model-runtime';
|
5
5
|
import { TextToImagePayload } from '@/libs/model-runtime/types';
|
6
|
-
import {
|
6
|
+
import { initModelRuntimeWithUserPayload } from '@/server/modules/ModelRuntime';
|
7
7
|
import { ChatErrorType } from '@/types/fetch';
|
8
8
|
import { createErrorResponse } from '@/utils/errorResponse';
|
9
9
|
|
@@ -52,7 +52,7 @@ export const POST = checkAuth(async (req: Request, { params, jwtPayload }) => {
|
|
52
52
|
|
53
53
|
try {
|
54
54
|
// ============ 1. init chat model ============ //
|
55
|
-
const agentRuntime = await
|
55
|
+
const agentRuntime = await initModelRuntimeWithUserPayload(provider, jwtPayload);
|
56
56
|
|
57
57
|
// ============ 2. create chat completion ============ //
|
58
58
|
|
@@ -48,10 +48,10 @@ const useProviderCard = (): ProviderItem => {
|
|
48
48
|
),
|
49
49
|
desc: (
|
50
50
|
<Markdown className={styles.markdown} fontSize={12} variant={'chat'}>
|
51
|
-
{t(
|
51
|
+
{t('github.personalAccessToken.desc')}
|
52
52
|
</Markdown>
|
53
53
|
),
|
54
|
-
label: t(
|
54
|
+
label: t('github.personalAccessToken.title'),
|
55
55
|
name: [KeyVaultsConfigKey, LLMProviderApiTokenKey],
|
56
56
|
},
|
57
57
|
],
|
@@ -97,6 +97,7 @@ const useStyles = createStyles(({ css, prefixCls, responsive, token }) => ({
|
|
97
97
|
|
98
98
|
export interface ProviderConfigProps extends Omit<AiProviderDetailItem, 'enabled' | 'source'> {
|
99
99
|
apiKeyItems?: FormItemProps[];
|
100
|
+
apiKeyUrl?: string;
|
100
101
|
canDeactivate?: boolean;
|
101
102
|
checkErrorRender?: CheckErrorRender;
|
102
103
|
className?: string;
|
@@ -127,6 +128,7 @@ const ProviderConfig = memo<ProviderConfigProps>(
|
|
127
128
|
showAceGcm = true,
|
128
129
|
extra,
|
129
130
|
source = AiProviderSourceEnum.Builtin,
|
131
|
+
apiKeyUrl,
|
130
132
|
}) => {
|
131
133
|
const {
|
132
134
|
proxyUrl,
|
@@ -184,7 +186,7 @@ const ProviderConfig = memo<ProviderConfigProps>(
|
|
184
186
|
) : (
|
185
187
|
<FormPassword
|
186
188
|
autoComplete={'new-password'}
|
187
|
-
placeholder={t(
|
189
|
+
placeholder={t('providerModels.config.apiKey.placeholder', { name })}
|
188
190
|
suffix={
|
189
191
|
configUpdating && (
|
190
192
|
<Icon icon={Loader2Icon} spin style={{ color: theme.colorTextTertiary }} />
|
@@ -192,7 +194,20 @@ const ProviderConfig = memo<ProviderConfigProps>(
|
|
192
194
|
}
|
193
195
|
/>
|
194
196
|
),
|
195
|
-
desc:
|
197
|
+
desc: apiKeyUrl ? (
|
198
|
+
<Trans
|
199
|
+
i18nKey="providerModels.config.apiKey.descWithUrl"
|
200
|
+
ns={'modelProvider'}
|
201
|
+
value={{ name }}
|
202
|
+
>
|
203
|
+
请填写你的 {{ name }} API Key,
|
204
|
+
<Link href={apiKeyUrl} target={'_blank'}>
|
205
|
+
点此获取
|
206
|
+
</Link>
|
207
|
+
</Trans>
|
208
|
+
) : (
|
209
|
+
t(`providerModels.config.apiKey.desc`, { name })
|
210
|
+
),
|
196
211
|
label: t(`providerModels.config.apiKey.title`),
|
197
212
|
name: [KeyVaultsConfigKey, LLMProviderApiTokenKey],
|
198
213
|
},
|
@@ -0,0 +1,164 @@
|
|
1
|
+
import { AIChatModelCard } from '@/types/aiModel';
|
2
|
+
|
3
|
+
const aihubmixModels: AIChatModelCard[] = [
|
4
|
+
{
|
5
|
+
abilities: {
|
6
|
+
functionCall: true,
|
7
|
+
reasoning: true,
|
8
|
+
},
|
9
|
+
contextWindowTokens: 65_536,
|
10
|
+
description: 'DeepSeek R1 推理模型,具有强大的推理能力',
|
11
|
+
displayName: 'DeepSeek R1',
|
12
|
+
enabled: true,
|
13
|
+
id: 'DeepSeek-R1',
|
14
|
+
type: 'chat',
|
15
|
+
},
|
16
|
+
{
|
17
|
+
abilities: {
|
18
|
+
functionCall: true,
|
19
|
+
reasoning: true,
|
20
|
+
vision: true,
|
21
|
+
},
|
22
|
+
contextWindowTokens: 200_000,
|
23
|
+
description:
|
24
|
+
'Claude Opus 4 是 Anthropic 迄今为止最强大的模型,专为处理复杂、长时间运行的任务而设计。',
|
25
|
+
displayName: 'Claude Opus 4',
|
26
|
+
enabled: true,
|
27
|
+
id: 'claude-opus-4-20250514',
|
28
|
+
type: 'chat',
|
29
|
+
},
|
30
|
+
{
|
31
|
+
abilities: {
|
32
|
+
functionCall: true,
|
33
|
+
reasoning: true,
|
34
|
+
vision: true,
|
35
|
+
},
|
36
|
+
contextWindowTokens: 200_000,
|
37
|
+
description:
|
38
|
+
'Claude Sonnet 4 是一款高效且性价比高的模型,作为 Claude Sonnet 3.7 的升级版,适合日常任务和中等复杂度的应用。',
|
39
|
+
displayName: 'Claude Sonnet 4',
|
40
|
+
enabled: true,
|
41
|
+
id: 'claude-sonnet-4-20250514',
|
42
|
+
type: 'chat',
|
43
|
+
},
|
44
|
+
{
|
45
|
+
abilities: {
|
46
|
+
functionCall: true,
|
47
|
+
reasoning: true,
|
48
|
+
vision: true,
|
49
|
+
},
|
50
|
+
contextWindowTokens: 200_000,
|
51
|
+
description: 'OpenAI o3 推理模型,具有强大的推理能力',
|
52
|
+
displayName: 'o3',
|
53
|
+
enabled: true,
|
54
|
+
id: 'o3',
|
55
|
+
type: 'chat',
|
56
|
+
},
|
57
|
+
{
|
58
|
+
abilities: {
|
59
|
+
functionCall: true,
|
60
|
+
reasoning: true,
|
61
|
+
vision: true,
|
62
|
+
},
|
63
|
+
contextWindowTokens: 200_000,
|
64
|
+
description: 'OpenAI o4-mini 小型推理模型,高效且经济',
|
65
|
+
displayName: 'o4-mini',
|
66
|
+
enabled: true,
|
67
|
+
id: 'o4-mini',
|
68
|
+
type: 'chat',
|
69
|
+
},
|
70
|
+
{
|
71
|
+
abilities: {
|
72
|
+
functionCall: true,
|
73
|
+
vision: true,
|
74
|
+
},
|
75
|
+
contextWindowTokens: 1_047_576,
|
76
|
+
description: 'GPT-4.1 旗舰模型,适用于复杂任务',
|
77
|
+
displayName: 'GPT-4.1',
|
78
|
+
enabled: true,
|
79
|
+
id: 'gpt-4.1',
|
80
|
+
type: 'chat',
|
81
|
+
},
|
82
|
+
{
|
83
|
+
abilities: {
|
84
|
+
functionCall: true,
|
85
|
+
vision: true,
|
86
|
+
},
|
87
|
+
contextWindowTokens: 1_047_576,
|
88
|
+
description: 'GPT-4.1 mini 平衡智能、速度和成本',
|
89
|
+
displayName: 'GPT-4.1 mini',
|
90
|
+
enabled: true,
|
91
|
+
id: 'gpt-4.1-mini',
|
92
|
+
type: 'chat',
|
93
|
+
},
|
94
|
+
{
|
95
|
+
abilities: {
|
96
|
+
functionCall: true,
|
97
|
+
reasoning: true,
|
98
|
+
search: true,
|
99
|
+
vision: true,
|
100
|
+
},
|
101
|
+
contextWindowTokens: 1_048_576 + 65_536,
|
102
|
+
description:
|
103
|
+
'Gemini 2.5 Pro 是 Google 最先进的思维模型,能够对代码、数学和STEM领域的复杂问题进行推理,以及使用长上下文分析大型数据集、代码库和文档。',
|
104
|
+
displayName: 'Gemini 2.5 Pro',
|
105
|
+
enabled: true,
|
106
|
+
id: 'gemini-2.5-pro',
|
107
|
+
maxOutput: 65_536,
|
108
|
+
pricing: {
|
109
|
+
input: 1.25, // prompts <= 200k tokens
|
110
|
+
output: 10, // prompts <= 200k tokens
|
111
|
+
},
|
112
|
+
releasedAt: '2025-06-17',
|
113
|
+
settings: {
|
114
|
+
extendParams: ['thinkingBudget'],
|
115
|
+
searchImpl: 'params',
|
116
|
+
searchProvider: 'google',
|
117
|
+
},
|
118
|
+
type: 'chat',
|
119
|
+
},
|
120
|
+
{
|
121
|
+
abilities: {
|
122
|
+
functionCall: true,
|
123
|
+
reasoning: true,
|
124
|
+
search: true,
|
125
|
+
vision: true,
|
126
|
+
},
|
127
|
+
contextWindowTokens: 1_000_000,
|
128
|
+
description: 'Gemini 2.5 Flash 预览版,快速高效的多模态模型',
|
129
|
+
displayName: 'Gemini 2.5 Flash',
|
130
|
+
enabled: true,
|
131
|
+
id: 'gemini-2.5-flash',
|
132
|
+
releasedAt: '2025-06-17',
|
133
|
+
settings: {
|
134
|
+
extendParams: ['thinkingBudget'],
|
135
|
+
searchImpl: 'params',
|
136
|
+
searchProvider: 'google',
|
137
|
+
},
|
138
|
+
type: 'chat',
|
139
|
+
},
|
140
|
+
{
|
141
|
+
abilities: {
|
142
|
+
functionCall: true,
|
143
|
+
},
|
144
|
+
contextWindowTokens: 235_000,
|
145
|
+
description: 'Qwen3 235B 大型语言模型',
|
146
|
+
displayName: 'Qwen3 235B',
|
147
|
+
enabled: true,
|
148
|
+
id: 'Qwen/Qwen3-235B-A22B',
|
149
|
+
type: 'chat',
|
150
|
+
},
|
151
|
+
{
|
152
|
+
abilities: {
|
153
|
+
functionCall: true,
|
154
|
+
},
|
155
|
+
contextWindowTokens: 32_000,
|
156
|
+
description: 'Qwen3 32B 中型语言模型',
|
157
|
+
displayName: 'Qwen3 32B',
|
158
|
+
enabled: true,
|
159
|
+
id: 'Qwen/Qwen3-32B',
|
160
|
+
type: 'chat',
|
161
|
+
},
|
162
|
+
];
|
163
|
+
|
164
|
+
export default aihubmixModels;
|
@@ -2,6 +2,7 @@ import { AiFullModelCard, LobeDefaultAiModelListItem } from '@/types/aiModel';
|
|
2
2
|
|
3
3
|
import { default as ai21 } from './ai21';
|
4
4
|
import { default as ai360 } from './ai360';
|
5
|
+
import { default as aihubmix } from './aihubmix';
|
5
6
|
import { default as anthropic } from './anthropic';
|
6
7
|
import { default as azure } from './azure';
|
7
8
|
import { default as azureai } from './azureai';
|
@@ -78,6 +79,7 @@ const buildDefaultModelList = (map: ModelsMap): LobeDefaultAiModelListItem[] =>
|
|
78
79
|
export const LOBE_DEFAULT_MODEL_LIST = buildDefaultModelList({
|
79
80
|
ai21,
|
80
81
|
ai360,
|
82
|
+
aihubmix,
|
81
83
|
anthropic,
|
82
84
|
azure,
|
83
85
|
azureai,
|
@@ -135,6 +137,7 @@ export const LOBE_DEFAULT_MODEL_LIST = buildDefaultModelList({
|
|
135
137
|
|
136
138
|
export { default as ai21 } from './ai21';
|
137
139
|
export { default as ai360 } from './ai360';
|
140
|
+
export { default as aihubmix } from './aihubmix';
|
138
141
|
export { default as anthropic } from './anthropic';
|
139
142
|
export { default as azure } from './azure';
|
140
143
|
export { default as azureai } from './azureai';
|
@@ -4,6 +4,88 @@ import { AIChatModelCard } from '@/types/aiModel';
|
|
4
4
|
// https://www.sensecore.cn/help/docs/model-as-a-service/nova/release
|
5
5
|
|
6
6
|
const sensenovaChatModels: AIChatModelCard[] = [
|
7
|
+
{
|
8
|
+
abilities: {
|
9
|
+
reasoning: true,
|
10
|
+
vision: true,
|
11
|
+
},
|
12
|
+
contextWindowTokens: 131_072,
|
13
|
+
description: '通过对多模态、语言及推理数据的全面更新与训练策略的优化,新模型在多模态推理和泛化指令跟随能力上实现了显著提升,支持高达128k的上下文窗口,并在OCR与文旅IP识别等专项任务中表现卓越。',
|
14
|
+
displayName: 'SenseNova V6.5 Pro',
|
15
|
+
enabled: true,
|
16
|
+
id: 'SenseNova-V6-5-Pro',
|
17
|
+
pricing: {
|
18
|
+
currency: 'CNY',
|
19
|
+
input: 3,
|
20
|
+
output: 9,
|
21
|
+
},
|
22
|
+
releasedAt: '2025-07-23',
|
23
|
+
settings: {
|
24
|
+
extendParams: ['enableReasoning'],
|
25
|
+
},
|
26
|
+
type: 'chat',
|
27
|
+
},
|
28
|
+
{
|
29
|
+
abilities: {
|
30
|
+
reasoning: true,
|
31
|
+
vision: true,
|
32
|
+
},
|
33
|
+
contextWindowTokens: 131_072,
|
34
|
+
description: '通过对多模态、语言及推理数据的全面更新与训练策略的优化,新模型在多模态推理和泛化指令跟随能力上实现了显著提升,支持高达128k的上下文窗口,并在OCR与文旅IP识别等专项任务中表现卓越。',
|
35
|
+
displayName: 'SenseNova V6.5 Turbo',
|
36
|
+
enabled: true,
|
37
|
+
id: 'SenseNova-V6-5-Turbo',
|
38
|
+
pricing: {
|
39
|
+
currency: 'CNY',
|
40
|
+
input: 1.5,
|
41
|
+
output: 4.5,
|
42
|
+
},
|
43
|
+
releasedAt: '2025-07-23',
|
44
|
+
settings: {
|
45
|
+
extendParams: ['enableReasoning'],
|
46
|
+
},
|
47
|
+
type: 'chat',
|
48
|
+
},
|
49
|
+
{
|
50
|
+
abilities: {
|
51
|
+
reasoning: true,
|
52
|
+
},
|
53
|
+
contextWindowTokens: 32_768,
|
54
|
+
description: 'Qwen3-235B-A22B,MoE(混合专家模型)模型,引入了“混合推理模式”,支持用户在“思考模式”和“非思考模式”之间无缝切换,支持119种语言和方言理解与推理,并具备强大的工具调用能力,在综合能力、代码与数学、多语言能力、知识与推理等多项基准测试中,都能与DeepSeek R1、OpenAI o1、o3-mini、Grok 3和谷歌Gemini 2.5 Pro等目前市场上的主流大模型竞争。',
|
55
|
+
displayName: 'Qwen3 235B A22B',
|
56
|
+
id: 'Qwen3-235B',
|
57
|
+
organization: 'Qwen',
|
58
|
+
pricing: {
|
59
|
+
currency: 'CNY',
|
60
|
+
input: 0,
|
61
|
+
output: 0,
|
62
|
+
},
|
63
|
+
releasedAt: '2025-05-27',
|
64
|
+
settings: {
|
65
|
+
extendParams: ['enableReasoning'],
|
66
|
+
},
|
67
|
+
type: 'chat',
|
68
|
+
},
|
69
|
+
{
|
70
|
+
abilities: {
|
71
|
+
reasoning: true,
|
72
|
+
},
|
73
|
+
contextWindowTokens: 32_768,
|
74
|
+
description: 'Qwen3-32B,稠密模型(Dense Model),引入了“混合推理模式”,支持用户在“思考模式”和“非思考模式”之间无缝切换,由于模型架构改进、训练数据增加以及更有效的训练方法,整体性能与Qwen2.5-72B表现相当。',
|
75
|
+
displayName: 'Qwen3 32B',
|
76
|
+
id: 'Qwen3-32B',
|
77
|
+
organization: 'Qwen',
|
78
|
+
pricing: {
|
79
|
+
currency: 'CNY',
|
80
|
+
input: 0,
|
81
|
+
output: 0,
|
82
|
+
},
|
83
|
+
releasedAt: '2025-05-27',
|
84
|
+
settings: {
|
85
|
+
extendParams: ['enableReasoning'],
|
86
|
+
},
|
87
|
+
type: 'chat',
|
88
|
+
},
|
7
89
|
{
|
8
90
|
abilities: {
|
9
91
|
reasoning: true,
|
@@ -12,7 +94,6 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
12
94
|
contextWindowTokens: 32_768,
|
13
95
|
description: '兼顾视觉、语言深度推理,实现慢思考和深度推理,呈现完整的思维链过程。',
|
14
96
|
displayName: 'SenseNova V6 Reasoner',
|
15
|
-
enabled: true,
|
16
97
|
id: 'SenseNova-V6-Reasoner',
|
17
98
|
pricing: {
|
18
99
|
currency: 'CNY',
|
@@ -30,7 +111,6 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
30
111
|
description:
|
31
112
|
'实现图片、文本、视频能力的原生统一,突破传统多模态分立局限,在多模基础能力、语言基础能力等核心维度全面领先,文理兼修,在多项测评中多次位列国内外第一梯队水平。',
|
32
113
|
displayName: 'SenseNova V6 Turbo',
|
33
|
-
enabled: true,
|
34
114
|
id: 'SenseNova-V6-Turbo',
|
35
115
|
pricing: {
|
36
116
|
currency: 'CNY',
|
@@ -48,7 +128,6 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
48
128
|
description:
|
49
129
|
'实现图片、文本、视频能力的原生统一,突破传统多模态分立局限,在OpenCompass和SuperCLUE评测中斩获双冠军。',
|
50
130
|
displayName: 'SenseNova V6 Pro',
|
51
|
-
enabled: true,
|
52
131
|
id: 'SenseNova-V6-Pro',
|
53
132
|
pricing: {
|
54
133
|
currency: 'CNY',
|
package/src/config/llm.ts
CHANGED
@@ -171,6 +171,9 @@ export const getLLMConfig = () => {
|
|
171
171
|
|
172
172
|
ENABLED_V0: z.boolean(),
|
173
173
|
V0_API_KEY: z.string().optional(),
|
174
|
+
|
175
|
+
ENABLED_AIHUBMIX: z.boolean(),
|
176
|
+
AIHUBMIX_API_KEY: z.string().optional(),
|
174
177
|
},
|
175
178
|
runtimeEnv: {
|
176
179
|
API_KEY_SELECT_MODE: process.env.API_KEY_SELECT_MODE,
|
@@ -340,6 +343,9 @@ export const getLLMConfig = () => {
|
|
340
343
|
|
341
344
|
ENABLED_V0: !!process.env.V0_API_KEY,
|
342
345
|
V0_API_KEY: process.env.V0_API_KEY,
|
346
|
+
|
347
|
+
ENABLED_AIHUBMIX: !!process.env.AIHUBMIX_API_KEY,
|
348
|
+
AIHUBMIX_API_KEY: process.env.AIHUBMIX_API_KEY,
|
343
349
|
},
|
344
350
|
});
|
345
351
|
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { ModelProviderCard } from '@/types/llm';
|
2
|
+
|
3
|
+
const AiHubMix: ModelProviderCard = {
|
4
|
+
apiKeyUrl: 'https://lobe.li/9mZhb4T',
|
5
|
+
chatModels: [],
|
6
|
+
checkModel: 'gpt-4.1-mini',
|
7
|
+
description: 'AiHubMix 通过统一的 API 接口提供对多种 AI 模型的访问。',
|
8
|
+
id: 'aihubmix',
|
9
|
+
modelsUrl: 'https://docs.aihubmix.com/cn/api/Model-List',
|
10
|
+
name: 'AiHubMix',
|
11
|
+
settings: {
|
12
|
+
sdkType: 'router',
|
13
|
+
showModelFetcher: true,
|
14
|
+
},
|
15
|
+
url: 'https://aihubmix.com?utm_source=lobehub',
|
16
|
+
};
|
17
|
+
|
18
|
+
export default AiHubMix;
|