@lobehub/chat 0.126.4 → 0.127.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 +8 -0
- package/CHANGELOG.md +58 -0
- package/Dockerfile +3 -0
- package/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/docs/Deployment/Environment-Variable.md +10 -0
- package/docs/Deployment/Environment-Variable.zh-CN.md +10 -0
- package/locales/ar/common.json +1 -0
- package/locales/ar/error.json +2 -0
- package/locales/ar/setting.json +16 -0
- package/locales/de-DE/common.json +1 -0
- package/locales/de-DE/error.json +2 -0
- package/locales/de-DE/setting.json +16 -0
- package/locales/en-US/common.json +1 -0
- package/locales/en-US/error.json +2 -0
- package/locales/en-US/setting.json +16 -0
- package/locales/es-ES/common.json +1 -0
- package/locales/es-ES/error.json +2 -0
- package/locales/es-ES/setting.json +16 -0
- package/locales/fr-FR/common.json +1 -0
- package/locales/fr-FR/error.json +2 -0
- package/locales/fr-FR/setting.json +16 -0
- package/locales/it-IT/common.json +1 -0
- package/locales/it-IT/error.json +2 -0
- package/locales/it-IT/setting.json +16 -0
- package/locales/ja-JP/common.json +1 -0
- package/locales/ja-JP/error.json +2 -0
- package/locales/ja-JP/setting.json +16 -0
- package/locales/ko-KR/common.json +1 -0
- package/locales/ko-KR/error.json +2 -0
- package/locales/ko-KR/setting.json +16 -0
- package/locales/nl-NL/common.json +1 -0
- package/locales/nl-NL/error.json +2 -0
- package/locales/nl-NL/setting.json +16 -0
- package/locales/pl-PL/common.json +1 -0
- package/locales/pl-PL/error.json +2 -0
- package/locales/pl-PL/setting.json +16 -0
- package/locales/pt-BR/common.json +1 -0
- package/locales/pt-BR/error.json +2 -0
- package/locales/pt-BR/setting.json +16 -0
- package/locales/ru-RU/common.json +1 -0
- package/locales/ru-RU/error.json +2 -0
- package/locales/ru-RU/setting.json +16 -0
- package/locales/tr-TR/common.json +1 -0
- package/locales/tr-TR/error.json +2 -0
- package/locales/tr-TR/setting.json +16 -0
- package/locales/vi-VN/common.json +1 -0
- package/locales/vi-VN/error.json +2 -0
- package/locales/vi-VN/setting.json +16 -0
- package/locales/zh-CN/common.json +1 -0
- package/locales/zh-CN/error.json +2 -0
- package/locales/zh-CN/setting.json +16 -0
- package/locales/zh-TW/common.json +1 -0
- package/locales/zh-TW/error.json +2 -0
- package/locales/zh-TW/setting.json +16 -0
- package/package.json +1 -1
- package/src/app/api/chat/[provider]/agentRuntime.ts +14 -0
- package/src/app/api/config/route.ts +2 -0
- package/src/app/api/errorResponse.ts +3 -0
- package/src/app/settings/llm/Ollama/index.tsx +81 -0
- package/src/app/settings/llm/page.tsx +7 -0
- package/src/components/ModelProviderIcon/index.tsx +5 -1
- package/src/config/modelProviders/index.ts +3 -0
- package/src/config/modelProviders/ollama.ts +117 -0
- package/src/config/server/provider.ts +6 -0
- package/src/const/settings.ts +4 -0
- package/src/libs/agent-runtime/error.ts +3 -0
- package/src/libs/agent-runtime/index.ts +1 -0
- package/src/libs/agent-runtime/moonshot/index.ts +1 -3
- package/src/libs/agent-runtime/ollama/index.ts +80 -0
- package/src/libs/agent-runtime/types/type.ts +1 -0
- package/src/locales/default/common.ts +1 -0
- package/src/locales/default/error.ts +3 -0
- package/src/locales/default/setting.ts +16 -0
- package/src/middleware.ts +8 -2
- package/src/services/_auth.ts +8 -0
- package/src/store/global/slices/settings/selectors/modelProvider.ts +24 -2
- package/src/types/settings/modelProvider.ts +7 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ModelProviderCard } from '@/types/llm';
|
|
2
|
+
|
|
3
|
+
const Ollama: ModelProviderCard = {
|
|
4
|
+
chatModels: [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Llama2 Chat 7B',
|
|
7
|
+
functionCall: false,
|
|
8
|
+
id: 'llama2',
|
|
9
|
+
tokens: 4000,
|
|
10
|
+
vision: false,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
displayName: 'Llama2 Chat 13B',
|
|
14
|
+
functionCall: false,
|
|
15
|
+
hidden: true,
|
|
16
|
+
id: 'llama2:13b',
|
|
17
|
+
tokens: 4000,
|
|
18
|
+
vision: false,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
displayName: 'Llama2 Chat 70B',
|
|
22
|
+
functionCall: false,
|
|
23
|
+
hidden: true,
|
|
24
|
+
id: 'llama2:70b',
|
|
25
|
+
tokens: 4000,
|
|
26
|
+
vision: false,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
displayName: 'Code Llama 7B',
|
|
30
|
+
functionCall: false,
|
|
31
|
+
id: 'codellama',
|
|
32
|
+
tokens: 16_000,
|
|
33
|
+
vision: false,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Code Llama 34B',
|
|
37
|
+
functionCall: false,
|
|
38
|
+
hidden: true,
|
|
39
|
+
id: 'codellama:34b',
|
|
40
|
+
tokens: 16_000,
|
|
41
|
+
vision: false,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
displayName: 'Code Llama 70B',
|
|
45
|
+
functionCall: false,
|
|
46
|
+
hidden: true,
|
|
47
|
+
id: 'codellama:70b',
|
|
48
|
+
tokens: 16_000,
|
|
49
|
+
vision: false,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
displayName: 'Code Llama 7B (Python)',
|
|
53
|
+
functionCall: false,
|
|
54
|
+
hidden: true,
|
|
55
|
+
id: 'codellama:python',
|
|
56
|
+
tokens: 16_000,
|
|
57
|
+
vision: false,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
displayName: 'Mistral',
|
|
61
|
+
functionCall: false,
|
|
62
|
+
id: 'mistral',
|
|
63
|
+
tokens: 4800,
|
|
64
|
+
vision: false,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Qwen Chat 7B',
|
|
68
|
+
functionCall: false,
|
|
69
|
+
id: 'qwen:7b-chat',
|
|
70
|
+
tokens: 32_768,
|
|
71
|
+
vision: false,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
displayName: 'Qwen Chat 14B',
|
|
75
|
+
functionCall: false,
|
|
76
|
+
hidden: true,
|
|
77
|
+
id: 'qwen:14b-chat',
|
|
78
|
+
tokens: 32_768,
|
|
79
|
+
vision: false,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
displayName: 'Qwen Chat 70B',
|
|
83
|
+
functionCall: false,
|
|
84
|
+
hidden: true,
|
|
85
|
+
id: 'qwen:70b-chat',
|
|
86
|
+
tokens: 32_768,
|
|
87
|
+
vision: false,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
displayName: 'LLaVA 7B',
|
|
91
|
+
functionCall: false,
|
|
92
|
+
hidden: true,
|
|
93
|
+
id: 'llava',
|
|
94
|
+
tokens: 4000,
|
|
95
|
+
vision: false,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
displayName: 'LLaVA 13B',
|
|
99
|
+
functionCall: false,
|
|
100
|
+
hidden: true,
|
|
101
|
+
id: 'llava:13b',
|
|
102
|
+
tokens: 4000,
|
|
103
|
+
vision: false,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
displayName: 'LLaVA 34B',
|
|
107
|
+
functionCall: false,
|
|
108
|
+
hidden: true,
|
|
109
|
+
id: 'llava:34b',
|
|
110
|
+
tokens: 4000,
|
|
111
|
+
vision: false,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
id: 'ollama',
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export default Ollama;
|
|
@@ -33,6 +33,9 @@ declare global {
|
|
|
33
33
|
AWS_ACCESS_KEY_ID?: string;
|
|
34
34
|
AWS_SECRET_ACCESS_KEY?: string;
|
|
35
35
|
|
|
36
|
+
// Ollama Provider;
|
|
37
|
+
OLLAMA_PROXY_URL?: string;
|
|
38
|
+
|
|
36
39
|
DEBUG_CHAT_COMPLETION?: string;
|
|
37
40
|
}
|
|
38
41
|
}
|
|
@@ -83,6 +86,9 @@ export const getProviderConfig = () => {
|
|
|
83
86
|
AZURE_ENDPOINT: process.env.AZURE_ENDPOINT,
|
|
84
87
|
USE_AZURE_OPENAI: process.env.USE_AZURE_OPENAI === '1',
|
|
85
88
|
|
|
89
|
+
ENABLE_OLLAMA: !!process.env.OLLAMA_PROXY_URL,
|
|
90
|
+
OLLAMA_PROXY_URL: process.env.OLLAMA_PROXY_URL || '',
|
|
91
|
+
|
|
86
92
|
DEBUG_CHAT_COMPLETION: process.env.DEBUG_CHAT_COMPLETION === '1',
|
|
87
93
|
};
|
|
88
94
|
};
|
package/src/const/settings.ts
CHANGED
|
@@ -22,6 +22,9 @@ export const AgentRuntimeErrorType = {
|
|
|
22
22
|
|
|
23
23
|
InvalidMoonshotAPIKey: 'InvalidMoonshotAPIKey',
|
|
24
24
|
MoonshotBizError: 'MoonshotBizError',
|
|
25
|
+
|
|
26
|
+
InvalidOllamaArgs: 'InvalidOllamaArgs',
|
|
27
|
+
OllamaBizError: 'OllamaBizError',
|
|
25
28
|
} as const;
|
|
26
29
|
|
|
27
30
|
export type ILobeAgentRuntimeErrorType =
|
|
@@ -4,6 +4,7 @@ export { LobeBedrockAI } from './bedrock';
|
|
|
4
4
|
export * from './error';
|
|
5
5
|
export { LobeGoogleAI } from './google';
|
|
6
6
|
export { LobeMoonshotAI } from './moonshot';
|
|
7
|
+
export { LobeOllamaAI } from './ollama';
|
|
7
8
|
export { LobeOpenAI } from './openai';
|
|
8
9
|
export * from './types';
|
|
9
10
|
export { AgentRuntimeError } from './utils/createError';
|
|
@@ -20,9 +20,7 @@ export class LobeMoonshotAI implements LobeRuntimeAI {
|
|
|
20
20
|
constructor(apiKey?: string, baseURL: string = DEFAULT_BASE_URL) {
|
|
21
21
|
if (!apiKey) throw AgentRuntimeError.createError(AgentRuntimeErrorType.InvalidMoonshotAPIKey);
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this._llm = new OpenAI({ apiKey, baseURL, defaultHeaders: header });
|
|
23
|
+
this._llm = new OpenAI({ apiKey, baseURL });
|
|
26
24
|
this.baseURL = this._llm.baseURL;
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { OpenAIStream, StreamingTextResponse } from 'ai';
|
|
2
|
+
import OpenAI from 'openai';
|
|
3
|
+
|
|
4
|
+
import { LobeRuntimeAI } from '../BaseAI';
|
|
5
|
+
import { AgentRuntimeErrorType } from '../error';
|
|
6
|
+
import { ChatStreamPayload, ModelProvider } from '../types';
|
|
7
|
+
import { AgentRuntimeError } from '../utils/createError';
|
|
8
|
+
import { debugStream } from '../utils/debugStream';
|
|
9
|
+
import { desensitizeUrl } from '../utils/desensitizeUrl';
|
|
10
|
+
import { DEBUG_CHAT_COMPLETION } from '../utils/env';
|
|
11
|
+
import { handleOpenAIError } from '../utils/handleOpenAIError';
|
|
12
|
+
|
|
13
|
+
const DEFAULT_BASE_URL = 'http://127.0.0.1:11434/v1';
|
|
14
|
+
|
|
15
|
+
export class LobeOllamaAI implements LobeRuntimeAI {
|
|
16
|
+
private _llm: OpenAI;
|
|
17
|
+
|
|
18
|
+
baseURL: string;
|
|
19
|
+
|
|
20
|
+
constructor(baseURL: string = DEFAULT_BASE_URL) {
|
|
21
|
+
if (!baseURL) throw AgentRuntimeError.createError(AgentRuntimeErrorType.InvalidOllamaArgs);
|
|
22
|
+
|
|
23
|
+
this._llm = new OpenAI({ apiKey: 'ollama', baseURL });
|
|
24
|
+
this.baseURL = baseURL;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async chat(payload: ChatStreamPayload) {
|
|
28
|
+
try {
|
|
29
|
+
const response = await this._llm.chat.completions.create(
|
|
30
|
+
payload as unknown as OpenAI.ChatCompletionCreateParamsStreaming,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const stream = OpenAIStream(response);
|
|
34
|
+
|
|
35
|
+
const [debug, returnStream] = stream.tee();
|
|
36
|
+
|
|
37
|
+
if (DEBUG_CHAT_COMPLETION) {
|
|
38
|
+
debugStream(debug).catch(console.error);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return new StreamingTextResponse(returnStream);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
let desensitizedEndpoint = this.baseURL;
|
|
44
|
+
|
|
45
|
+
if (this.baseURL !== DEFAULT_BASE_URL) {
|
|
46
|
+
desensitizedEndpoint = desensitizeUrl(this.baseURL);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if ('status' in (error as any)) {
|
|
50
|
+
switch ((error as Response).status) {
|
|
51
|
+
case 401: {
|
|
52
|
+
throw AgentRuntimeError.chat({
|
|
53
|
+
endpoint: desensitizedEndpoint,
|
|
54
|
+
error: error as any,
|
|
55
|
+
errorType: AgentRuntimeErrorType.InvalidOllamaArgs,
|
|
56
|
+
provider: ModelProvider.Ollama,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
default: {
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const { errorResult, RuntimeError } = handleOpenAIError(error);
|
|
67
|
+
|
|
68
|
+
const errorType = RuntimeError || AgentRuntimeErrorType.OllamaBizError;
|
|
69
|
+
|
|
70
|
+
throw AgentRuntimeError.chat({
|
|
71
|
+
endpoint: desensitizedEndpoint,
|
|
72
|
+
error: errorResult,
|
|
73
|
+
errorType,
|
|
74
|
+
provider: ModelProvider.Ollama,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default LobeOllamaAI;
|
|
@@ -73,6 +73,9 @@ export default {
|
|
|
73
73
|
InvalidAzureAPIKey: 'Azure API Key 不正确或为空,请检查 Azure API Key 后重试',
|
|
74
74
|
AzureBizError: '请求 Azure AI 服务出错,请根据以下信息排查或重试',
|
|
75
75
|
|
|
76
|
+
InvalidOllamaArgs: 'Ollama 配置不正确,请检查 Ollama 配置后重试',
|
|
77
|
+
OllamaBizError: '请求 Ollama 服务出错,请根据以下信息排查或重试',
|
|
78
|
+
|
|
76
79
|
AgentRuntimeError: 'Lobe 语言模型运行时执行出错,请根据以下信息排查或重试',
|
|
77
80
|
/* eslint-enable */
|
|
78
81
|
},
|
|
@@ -85,6 +85,22 @@ export default {
|
|
|
85
85
|
title: 'API Key',
|
|
86
86
|
},
|
|
87
87
|
},
|
|
88
|
+
Ollama: {
|
|
89
|
+
checker: {
|
|
90
|
+
desc: '测试代理地址是否正确填写',
|
|
91
|
+
},
|
|
92
|
+
customModelName: {
|
|
93
|
+
desc: '增加自定义模型,多个模型使用逗号(,)隔开',
|
|
94
|
+
placeholder: 'vicuna,llava,codellama,llama2:13b-text',
|
|
95
|
+
title: '自定义模型名称',
|
|
96
|
+
},
|
|
97
|
+
endpoint: {
|
|
98
|
+
desc: '填入 Ollama 接口代理地址,本地未额外指定可留空',
|
|
99
|
+
placeholder: 'http://127.0.0.1:11434/v1',
|
|
100
|
+
title: '接口代理地址',
|
|
101
|
+
},
|
|
102
|
+
title: 'Ollama',
|
|
103
|
+
},
|
|
88
104
|
OpenAI: {
|
|
89
105
|
azureApiVersion: {
|
|
90
106
|
desc: 'Azure 的 API 版本,遵循 YYYY-MM-DD 格式,查阅[最新版本](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions)',
|
package/src/middleware.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
// export { auth as middleware } from './app/api/next-auth';
|
|
2
1
|
import { NextResponse } from 'next/server';
|
|
3
2
|
|
|
3
|
+
import { getServerConfig } from '@/config/server';
|
|
4
|
+
|
|
4
5
|
import { auth } from './app/api/auth/next-auth';
|
|
5
6
|
import { OAUTH_AUTHORIZED } from './const/auth';
|
|
6
7
|
|
|
7
8
|
export const config = {
|
|
8
9
|
matcher: '/api/:path*',
|
|
9
10
|
};
|
|
11
|
+
const defaultMiddleware = () => NextResponse.next();
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
const withAuthMiddleware = auth((req) => {
|
|
12
14
|
// Just check if session exists
|
|
13
15
|
const session = req.auth;
|
|
14
16
|
const isLoggedIn = !!session;
|
|
@@ -23,3 +25,7 @@ export default auth((req) => {
|
|
|
23
25
|
},
|
|
24
26
|
});
|
|
25
27
|
});
|
|
28
|
+
|
|
29
|
+
const { ENABLE_OAUTH_SSO } = getServerConfig();
|
|
30
|
+
|
|
31
|
+
export default !ENABLE_OAUTH_SSO ? defaultMiddleware : withAuthMiddleware;
|
package/src/services/_auth.ts
CHANGED
|
@@ -40,6 +40,14 @@ const getProviderAuthPayload = (provider: string) => {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
case ModelProvider.Ollama: {
|
|
44
|
+
const endpoint = modelProviderSelectors.ollamaProxyUrl(useGlobalStore.getState());
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
endpoint,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
43
51
|
default:
|
|
44
52
|
case ModelProvider.OpenAI: {
|
|
45
53
|
const openai = modelProviderSelectors.openAIConfig(useGlobalStore.getState());
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
GoogleProvider,
|
|
6
6
|
LOBE_DEFAULT_MODEL_LIST,
|
|
7
7
|
MoonshotProvider,
|
|
8
|
+
OllamaProvider,
|
|
8
9
|
OpenAIProvider,
|
|
9
10
|
ZhiPuProvider,
|
|
10
11
|
} from '@/config/modelProviders';
|
|
@@ -37,6 +38,12 @@ const azureConfig = (s: GlobalStore) => modelProvider(s).azure;
|
|
|
37
38
|
const enableMoonshot = (s: GlobalStore) => modelProvider(s).moonshot.enabled;
|
|
38
39
|
const moonshotAPIKey = (s: GlobalStore) => modelProvider(s).moonshot.apiKey;
|
|
39
40
|
|
|
41
|
+
const enableOllamaConfigInSettings = (s: GlobalStore) =>
|
|
42
|
+
s.serverConfig.languageModel?.ollama?.enabled || false;
|
|
43
|
+
|
|
44
|
+
const enableOllama = (s: GlobalStore) => modelProvider(s).ollama.enabled;
|
|
45
|
+
const ollamaProxyUrl = (s: GlobalStore) => modelProvider(s).ollama.endpoint;
|
|
46
|
+
|
|
40
47
|
// const azureModelList = (s: GlobalStore): ModelProviderCard => {
|
|
41
48
|
// const azure = azureConfig(s);
|
|
42
49
|
// return {
|
|
@@ -46,8 +53,11 @@ const moonshotAPIKey = (s: GlobalStore) => modelProvider(s).moonshot.apiKey;
|
|
|
46
53
|
// };
|
|
47
54
|
|
|
48
55
|
// 提取处理 chatModels 的专门方法
|
|
49
|
-
const processChatModels = (
|
|
50
|
-
|
|
56
|
+
const processChatModels = (
|
|
57
|
+
modelConfig: ReturnType<typeof parseModelString>,
|
|
58
|
+
defaultChartModels = OpenAIProvider.chatModels,
|
|
59
|
+
): ChatModelCard[] => {
|
|
60
|
+
let chatModels = modelConfig.removeAll ? [] : defaultChartModels;
|
|
51
61
|
|
|
52
62
|
// 处理移除逻辑
|
|
53
63
|
if (!modelConfig.removeAll) {
|
|
@@ -102,6 +112,12 @@ const modelSelectList = (s: GlobalStore): ModelProviderCard[] => {
|
|
|
102
112
|
|
|
103
113
|
const chatModels = processChatModels(modelConfig);
|
|
104
114
|
|
|
115
|
+
const ollamaModelConfig = parseModelString(
|
|
116
|
+
currentSettings(s).languageModel.ollama.customModelName,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const ollamaChatModels = processChatModels(ollamaModelConfig, OllamaProvider.chatModels);
|
|
120
|
+
|
|
105
121
|
return [
|
|
106
122
|
{
|
|
107
123
|
...OpenAIProvider,
|
|
@@ -112,6 +128,7 @@ const modelSelectList = (s: GlobalStore): ModelProviderCard[] => {
|
|
|
112
128
|
{ ...MoonshotProvider, enabled: enableMoonshot(s) },
|
|
113
129
|
{ ...GoogleProvider, enabled: enableGoogle(s) },
|
|
114
130
|
{ ...BedrockProvider, enabled: enableBedrock(s) },
|
|
131
|
+
{ ...OllamaProvider, chatModels: ollamaChatModels, enabled: enableOllama(s) },
|
|
115
132
|
];
|
|
116
133
|
};
|
|
117
134
|
|
|
@@ -174,4 +191,9 @@ export const modelProviderSelectors = {
|
|
|
174
191
|
// Moonshot
|
|
175
192
|
enableMoonshot,
|
|
176
193
|
moonshotAPIKey,
|
|
194
|
+
|
|
195
|
+
// Ollama
|
|
196
|
+
enableOllamaConfigInSettings,
|
|
197
|
+
enableOllama,
|
|
198
|
+
ollamaProxyUrl,
|
|
177
199
|
};
|
|
@@ -47,11 +47,18 @@ export interface AWSBedrockConfig {
|
|
|
47
47
|
secretAccessKey?: string;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
export interface OllamaConfig {
|
|
51
|
+
customModelName?: string;
|
|
52
|
+
enabled?: boolean;
|
|
53
|
+
endpoint?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
50
56
|
export interface GlobalLLMConfig {
|
|
51
57
|
azure: AzureOpenAIConfig;
|
|
52
58
|
bedrock: AWSBedrockConfig;
|
|
53
59
|
google: GoogleConfig;
|
|
54
60
|
moonshot: MoonshotConfig;
|
|
61
|
+
ollama: OllamaConfig;
|
|
55
62
|
openAI: OpenAIConfig;
|
|
56
63
|
zhipu: ZhiPuConfig;
|
|
57
64
|
}
|