@lobehub/chat 1.7.1 → 1.7.3

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,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.7.3](https://github.com/lobehub/lobe-chat/compare/v1.7.2...v1.7.3)
6
+
7
+ <sup>Released on **2024-07-28**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Update minimax models.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Update minimax models, closes [#3354](https://github.com/lobehub/lobe-chat/issues/3354) ([8113729](https://github.com/lobehub/lobe-chat/commit/8113729))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ### [Version 1.7.2](https://github.com/lobehub/lobe-chat/compare/v1.7.1...v1.7.2)
31
+
32
+ <sup>Released on **2024-07-26**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Avoid baseURL being an empty string, resulting in incorrect client fetch.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Avoid baseURL being an empty string, resulting in incorrect client fetch, closes [#3308](https://github.com/lobehub/lobe-chat/issues/3308) ([15a9bc1](https://github.com/lobehub/lobe-chat/commit/15a9bc1))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 1.7.1](https://github.com/lobehub/lobe-chat/compare/v1.7.0...v1.7.1)
6
56
 
7
57
  <sup>Released on **2024-07-26**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
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",
@@ -271,7 +271,7 @@
271
271
  "vitest": "~1.2.2",
272
272
  "vitest-canvas-mock": "^0.3.3"
273
273
  },
274
- "packageManager": "pnpm@9.5.0",
274
+ "packageManager": "pnpm@9.6.0",
275
275
  "publishConfig": {
276
276
  "access": "public",
277
277
  "registry": "https://registry.npmjs.org"
@@ -12,20 +12,20 @@ const Minimax: ModelProviderCard = {
12
12
  tokens: 245_760,
13
13
  },
14
14
  {
15
- description: '复杂场景,例如应用题计算、科学计算等场景',
16
- displayName: 'abab6.5',
15
+ description: '英文等多语种人设对话场景',
16
+ displayName: 'abab6.5g',
17
17
  enabled: true,
18
18
  functionCall: true,
19
- id: 'abab6.5-chat',
19
+ id: 'abab6.5g-chat',
20
20
  tokens: 8192,
21
21
  },
22
22
  {
23
- description: '更复杂的格式化文本生成',
24
- displayName: 'abab6',
23
+ description: '中文人设对话场景',
24
+ displayName: 'abab6.5t',
25
25
  enabled: true,
26
26
  functionCall: true,
27
- id: 'abab6-chat',
28
- tokens: 32_768,
27
+ id: 'abab6.5t-chat',
28
+ tokens: 8192,
29
29
  },
30
30
  {
31
31
  description: '生产力场景',
@@ -35,7 +35,7 @@ const Minimax: ModelProviderCard = {
35
35
  tokens: 16_384,
36
36
  },
37
37
  {
38
- description: '人设对话场景',
38
+ description: '中文人设对话场景',
39
39
  displayName: 'abab5.5s',
40
40
  enabled: true,
41
41
  id: 'abab5.5s-chat',
@@ -36,7 +36,10 @@ interface OpenAICompatibleFactoryOptions<T extends Record<string, any> = any> {
36
36
  error: any,
37
37
  options: ConstructorOptions<T>,
38
38
  ) => Omit<ChatCompletionErrorPayload, 'provider'> | undefined;
39
- handlePayload?: (payload: ChatStreamPayload) => OpenAI.ChatCompletionCreateParamsStreaming;
39
+ handlePayload?: (
40
+ payload: ChatStreamPayload,
41
+ options: ConstructorOptions<T>,
42
+ ) => OpenAI.ChatCompletionCreateParamsStreaming;
40
43
  };
41
44
  constructorOptions?: ConstructorOptions<T>;
42
45
  debug?: {
@@ -128,8 +131,10 @@ export const LobeOpenAICompatibleFactory = <T extends Record<string, any> = any>
128
131
  private _options: ConstructorOptions<T>;
129
132
 
130
133
  constructor(options: ClientOptions & Record<string, any> = {}) {
131
- const { apiKey, baseURL = DEFAULT_BASE_URL, ...res } = options;
132
- this._options = options as ConstructorOptions<T>;
134
+ const _options = { ...options, baseURL: options.baseURL?.trim() || DEFAULT_BASE_URL };
135
+ const { apiKey, baseURL = DEFAULT_BASE_URL, ...res } = _options;
136
+ this._options = _options as ConstructorOptions<T>;
137
+
133
138
  if (!apiKey) throw AgentRuntimeError.createError(ErrorType?.invalidAPIKey);
134
139
 
135
140
  this.client = new OpenAI({ apiKey, baseURL, ...constructorOptions, ...res });
@@ -139,7 +144,7 @@ export const LobeOpenAICompatibleFactory = <T extends Record<string, any> = any>
139
144
  async chat(payload: ChatStreamPayload, options?: ChatCompetitionOptions) {
140
145
  try {
141
146
  const postPayload = chatCompletion?.handlePayload
142
- ? chatCompletion.handlePayload(payload)
147
+ ? chatCompletion.handlePayload(payload, this._options)
143
148
  : ({
144
149
  ...payload,
145
150
  stream: payload.stream ?? true,
@@ -125,6 +125,10 @@ export function initializeWithClientStore(provider: string, payload: any) {
125
125
  break;
126
126
  }
127
127
  case ModelProvider.Perplexity: {
128
+ providerOptions = {
129
+ apikey: providerAuthPayload?.apiKey,
130
+ baseURL: providerAuthPayload?.endpoint,
131
+ };
128
132
  break;
129
133
  }
130
134
  case ModelProvider.Qwen: {