@lobehub/chat 1.35.14 → 1.36.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/CHANGELOG.md +25 -0
- package/Dockerfile +3 -1
- package/changelog/v1.json +9 -0
- package/package.json +1 -1
- package/src/app/(main)/settings/llm/ProviderList/providers.tsx +3 -1
- package/src/config/llm.ts +8 -1
- package/src/config/modelProviders/higress.ts +2503 -0
- package/src/config/modelProviders/index.ts +4 -0
- package/src/const/settings/llm.ts +1 -2
- package/src/libs/agent-runtime/AgentRuntime.ts +7 -0
- package/src/libs/agent-runtime/higress/index.ts +45 -0
- package/src/libs/agent-runtime/types/type.ts +1 -0
- package/src/types/user/settings/keyVaults.ts +1 -0
@@ -13,6 +13,7 @@ import GiteeAIProvider from './giteeai';
|
|
13
13
|
import GithubProvider from './github';
|
14
14
|
import GoogleProvider from './google';
|
15
15
|
import GroqProvider from './groq';
|
16
|
+
import HigressProvider from './higress';
|
16
17
|
import HuggingFaceProvider from './huggingface';
|
17
18
|
import HunyuanProvider from './hunyuan';
|
18
19
|
import InternLMProvider from './internlm';
|
@@ -73,6 +74,7 @@ export const LOBE_DEFAULT_MODEL_LIST: ChatModelCard[] = [
|
|
73
74
|
WenxinProvider.chatModels,
|
74
75
|
SenseNovaProvider.chatModels,
|
75
76
|
InternLMProvider.chatModels,
|
77
|
+
HigressProvider.chatModels,
|
76
78
|
].flat();
|
77
79
|
|
78
80
|
export const DEFAULT_MODEL_PROVIDER_LIST = [
|
@@ -111,6 +113,7 @@ export const DEFAULT_MODEL_PROVIDER_LIST = [
|
|
111
113
|
TaichuProvider,
|
112
114
|
InternLMProvider,
|
113
115
|
SiliconCloudProvider,
|
116
|
+
HigressProvider,
|
114
117
|
GiteeAIProvider,
|
115
118
|
];
|
116
119
|
|
@@ -136,6 +139,7 @@ export { default as GiteeAIProviderCard } from './giteeai';
|
|
136
139
|
export { default as GithubProviderCard } from './github';
|
137
140
|
export { default as GoogleProviderCard } from './google';
|
138
141
|
export { default as GroqProviderCard } from './groq';
|
142
|
+
export { default as HigressProviderCard } from './higress';
|
139
143
|
export { default as HuggingFaceProviderCard } from './huggingface';
|
140
144
|
export { default as HunyuanProviderCard } from './hunyuan';
|
141
145
|
export { default as InternLMProviderCard } from './internlm';
|
@@ -16,6 +16,7 @@ import { LobeGiteeAI } from './giteeai';
|
|
16
16
|
import { LobeGithubAI } from './github';
|
17
17
|
import { LobeGoogleAI } from './google';
|
18
18
|
import { LobeGroq } from './groq';
|
19
|
+
import { LobeHigressAI } from './higress';
|
19
20
|
import { LobeHuggingFaceAI } from './huggingface';
|
20
21
|
import { LobeHunyuanAI } from './hunyuan';
|
21
22
|
import { LobeInternLMAI } from './internlm';
|
@@ -142,6 +143,7 @@ class AgentRuntime {
|
|
142
143
|
github: Partial<ClientOptions>;
|
143
144
|
google: { apiKey?: string; baseURL?: string };
|
144
145
|
groq: Partial<ClientOptions>;
|
146
|
+
higress: Partial<ClientOptions>;
|
145
147
|
huggingface: { apiKey?: string; baseURL?: string };
|
146
148
|
hunyuan: Partial<ClientOptions>;
|
147
149
|
internlm: Partial<ClientOptions>;
|
@@ -349,6 +351,11 @@ class AgentRuntime {
|
|
349
351
|
runtimeModel = new LobeInternLMAI(params.internlm);
|
350
352
|
break;
|
351
353
|
}
|
354
|
+
|
355
|
+
case ModelProvider.Higress: {
|
356
|
+
runtimeModel = new LobeHigressAI(params.higress);
|
357
|
+
break;
|
358
|
+
}
|
352
359
|
}
|
353
360
|
return new AgentRuntime(runtimeModel);
|
354
361
|
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { uniqueId } from 'lodash-es';
|
2
|
+
|
3
|
+
import { LOBE_DEFAULT_MODEL_LIST } from '@/config/modelProviders';
|
4
|
+
|
5
|
+
import { ModelProvider } from '../types';
|
6
|
+
import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory';
|
7
|
+
|
8
|
+
// import { OpenRouterModelCard } from './type';
|
9
|
+
|
10
|
+
export const LobeHigressAI = LobeOpenAICompatibleFactory({
|
11
|
+
constructorOptions: {
|
12
|
+
defaultHeaders: {
|
13
|
+
'HTTP-Referer': 'https://chat-preview.lobehub.com',
|
14
|
+
'X-Title': 'Lobe Chat',
|
15
|
+
'x-Request-Id': uniqueId('lobe-chat-'),
|
16
|
+
},
|
17
|
+
},
|
18
|
+
debug: {
|
19
|
+
chatCompletion: () => process.env.DEBUG_HIGRESS_CHAT_COMPLETION === '1',
|
20
|
+
},
|
21
|
+
models: {
|
22
|
+
transformModel: (m) => {
|
23
|
+
const model = m as any;
|
24
|
+
|
25
|
+
return {
|
26
|
+
description: model.description,
|
27
|
+
displayName: model.name,
|
28
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id.endsWith(m.id))?.enabled || false,
|
29
|
+
functionCall:
|
30
|
+
model.description.includes('function calling') || model.description.includes('tools'),
|
31
|
+
id: model.id,
|
32
|
+
maxTokens:
|
33
|
+
typeof model.top_provider.max_completion_tokens === 'number'
|
34
|
+
? model.top_provider.max_completion_tokens
|
35
|
+
: undefined,
|
36
|
+
tokens: model.context_length,
|
37
|
+
vision:
|
38
|
+
model.description.includes('vision') ||
|
39
|
+
model.description.includes('multimodal') ||
|
40
|
+
model.id.includes('vision'),
|
41
|
+
};
|
42
|
+
},
|
43
|
+
},
|
44
|
+
provider: ModelProvider.Higress,
|
45
|
+
});
|
@@ -45,6 +45,7 @@ export interface UserKeyVaults {
|
|
45
45
|
github?: OpenAICompatibleKeyVault;
|
46
46
|
google?: OpenAICompatibleKeyVault;
|
47
47
|
groq?: OpenAICompatibleKeyVault;
|
48
|
+
higress?: OpenAICompatibleKeyVault;
|
48
49
|
huggingface?: OpenAICompatibleKeyVault;
|
49
50
|
hunyuan?: OpenAICompatibleKeyVault;
|
50
51
|
internlm?: OpenAICompatibleKeyVault;
|