@lobehub/chat 0.150.6 → 0.150.7
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
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.150.7](https://github.com/lobehub/lobe-chat/compare/v0.150.6...v0.150.7)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-04-28**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Suport to fetch model list on client.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Suport to fetch model list on client, closes [#2252](https://github.com/lobehub/lobe-chat/issues/2252) ([76310a8](https://github.com/lobehub/lobe-chat/commit/76310a8))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 0.150.6](https://github.com/lobehub/lobe-chat/compare/v0.150.5...v0.150.6)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2024-04-28**</sup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.150.
|
|
3
|
+
"version": "0.150.7",
|
|
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",
|
|
@@ -18,12 +18,12 @@ const OllamaProvider = memo(() => {
|
|
|
18
18
|
label: t('llm.checker.title'),
|
|
19
19
|
minWidth: undefined,
|
|
20
20
|
}}
|
|
21
|
+
modelList={{ showModelFetcher: true }}
|
|
21
22
|
provider={ModelProvider.Ollama}
|
|
22
23
|
showApiKey={false}
|
|
23
24
|
showBrowserRequest
|
|
24
25
|
showEndpoint
|
|
25
26
|
title={<Ollama.Combine size={24} />}
|
|
26
|
-
// modelList={{ showModelFetcher: true }}
|
|
27
27
|
/>
|
|
28
28
|
);
|
|
29
29
|
});
|
|
@@ -4,6 +4,7 @@ import { ClientOptions } from 'openai';
|
|
|
4
4
|
|
|
5
5
|
import { OpenAIChatMessage } from '@/libs/agent-runtime';
|
|
6
6
|
import { OllamaStream } from '@/libs/agent-runtime/ollama/stream';
|
|
7
|
+
import { ChatModelCard } from '@/types/llm';
|
|
7
8
|
|
|
8
9
|
import { LobeRuntimeAI } from '../BaseAI';
|
|
9
10
|
import { AgentRuntimeErrorType } from '../error';
|
|
@@ -64,12 +65,12 @@ export class LobeOllamaAI implements LobeRuntimeAI {
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
async models(): Promise<ChatModelCard[]> {
|
|
69
|
+
const list = await this.client.list();
|
|
70
|
+
return list.models.map((model) => ({
|
|
71
|
+
id: model.name,
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
73
74
|
|
|
74
75
|
private buildOllamaMessages(messages: OpenAIChatMessage[]) {
|
|
75
76
|
return messages.map((message) => this.convertContentToOllamaMessage(message));
|
package/src/services/models.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { createHeaderWithAuth } from '@/services/_auth';
|
|
2
|
+
import { useGlobalStore } from '@/store/global';
|
|
3
|
+
import { modelConfigSelectors } from '@/store/global/selectors';
|
|
2
4
|
import { ChatModelCard } from '@/types/llm';
|
|
3
5
|
|
|
4
6
|
import { API_ENDPOINTS } from './_url';
|
|
7
|
+
import { initializeWithClientStore } from './chat';
|
|
5
8
|
|
|
6
9
|
class ModelsService {
|
|
7
10
|
getChatModels = async (provider: string): Promise<ChatModelCard[] | undefined> => {
|
|
@@ -10,6 +13,17 @@ class ModelsService {
|
|
|
10
13
|
provider,
|
|
11
14
|
});
|
|
12
15
|
try {
|
|
16
|
+
/**
|
|
17
|
+
* Use browser agent runtime
|
|
18
|
+
*/
|
|
19
|
+
const enableFetchOnClient = modelConfigSelectors.isProviderFetchOnClient(provider)(
|
|
20
|
+
useGlobalStore.getState(),
|
|
21
|
+
);
|
|
22
|
+
if (enableFetchOnClient) {
|
|
23
|
+
const agentRuntime = await initializeWithClientStore(provider, {});
|
|
24
|
+
return agentRuntime.models();
|
|
25
|
+
}
|
|
26
|
+
|
|
13
27
|
const res = await fetch(API_ENDPOINTS.chatModels(provider), { headers });
|
|
14
28
|
if (!res.ok) return;
|
|
15
29
|
|