@lobehub/chat 1.118.1 → 1.118.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 +50 -0
- package/changelog/v1.json +18 -0
- package/package.json +1 -1
- package/packages/model-runtime/src/ollama/index.ts +2 -2
- package/packages/model-runtime/src/utils/usageConverter.test.ts +1 -1
- package/packages/model-runtime/src/utils/usageConverter.ts +3 -1
- package/packages/model-runtime/src/xai/index.ts +1 -1
- package/packages/types/src/aiModel.ts +1 -0
- package/src/config/aiModels/xai.ts +25 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,56 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.118.3](https://github.com/lobehub/lobe-chat/compare/v1.118.2...v1.118.3)
|
6
|
+
|
7
|
+
<sup>Released on **2025-08-29**</sup>
|
8
|
+
|
9
|
+
#### 🐛 Bug Fixes
|
10
|
+
|
11
|
+
- **misc**: Correct totalOutputTokens calculation for XAI provider.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### What's fixed
|
19
|
+
|
20
|
+
- **misc**: Correct totalOutputTokens calculation for XAI provider, closes [#8984](https://github.com/lobehub/lobe-chat/issues/8984) ([09ce90a](https://github.com/lobehub/lobe-chat/commit/09ce90a))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
30
|
+
### [Version 1.118.2](https://github.com/lobehub/lobe-chat/compare/v1.118.1...v1.118.2)
|
31
|
+
|
32
|
+
<sup>Released on **2025-08-29**</sup>
|
33
|
+
|
34
|
+
#### 💄 Styles
|
35
|
+
|
36
|
+
- **misc**: Add Grok Code Fast 1 model.
|
37
|
+
|
38
|
+
<br/>
|
39
|
+
|
40
|
+
<details>
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
42
|
+
|
43
|
+
#### Styles
|
44
|
+
|
45
|
+
- **misc**: Add Grok Code Fast 1 model, closes [#8982](https://github.com/lobehub/lobe-chat/issues/8982) ([dbcec3d](https://github.com/lobehub/lobe-chat/commit/dbcec3d))
|
46
|
+
|
47
|
+
</details>
|
48
|
+
|
49
|
+
<div align="right">
|
50
|
+
|
51
|
+
[](#readme-top)
|
52
|
+
|
53
|
+
</div>
|
54
|
+
|
5
55
|
### [Version 1.118.1](https://github.com/lobehub/lobe-chat/compare/v1.118.0...v1.118.1)
|
6
56
|
|
7
57
|
<sup>Released on **2025-08-29**</sup>
|
package/changelog/v1.json
CHANGED
@@ -1,4 +1,22 @@
|
|
1
1
|
[
|
2
|
+
{
|
3
|
+
"children": {
|
4
|
+
"fixes": [
|
5
|
+
"Correct totalOutputTokens calculation for XAI provider."
|
6
|
+
]
|
7
|
+
},
|
8
|
+
"date": "2025-08-29",
|
9
|
+
"version": "1.118.3"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"children": {
|
13
|
+
"improvements": [
|
14
|
+
"Add Grok Code Fast 1 model."
|
15
|
+
]
|
16
|
+
},
|
17
|
+
"date": "2025-08-29",
|
18
|
+
"version": "1.118.2"
|
19
|
+
},
|
2
20
|
{
|
3
21
|
"children": {
|
4
22
|
"fixes": [
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.118.
|
3
|
+
"version": "1.118.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",
|
@@ -137,8 +137,8 @@ export class LobeOllamaAI implements LobeRuntimeAI {
|
|
137
137
|
enabled: knownModel?.enabled || false,
|
138
138
|
functionCall: knownModel?.abilities?.functionCall || false,
|
139
139
|
id: model.name,
|
140
|
-
reasoning: knownModel?.abilities?.
|
141
|
-
vision: knownModel?.abilities?.
|
140
|
+
reasoning: knownModel?.abilities?.reasoning || false,
|
141
|
+
vision: knownModel?.abilities?.vision || false,
|
142
142
|
};
|
143
143
|
})
|
144
144
|
.filter(Boolean) as ChatModelCard[];
|
@@ -271,7 +271,7 @@ describe('convertUsage', () => {
|
|
271
271
|
// Assert
|
272
272
|
expect(xaiResult).toMatchObject({
|
273
273
|
totalInputTokens: 6103,
|
274
|
-
totalOutputTokens: 66
|
274
|
+
totalOutputTokens: 447, // 66 + 381,xai的reasoning_tokens和completion_tokens价格一样
|
275
275
|
outputTextTokens: 66, // 不减去 reasoning_tokens
|
276
276
|
outputReasoningTokens: 381,
|
277
277
|
totalTokens: 6550,
|
@@ -27,6 +27,8 @@ export const convertUsage = (
|
|
27
27
|
provider === 'xai'
|
28
28
|
? totalOutputTokens - outputAudioTokens
|
29
29
|
: totalOutputTokens - outputReasoning - outputAudioTokens - outputImageTokens;
|
30
|
+
const totalOutputTokensNormalized =
|
31
|
+
provider === 'xai' ? totalOutputTokens + outputReasoning : totalOutputTokens;
|
30
32
|
|
31
33
|
const totalTokens = inputCitationTokens + usage.total_tokens;
|
32
34
|
|
@@ -43,7 +45,7 @@ export const convertUsage = (
|
|
43
45
|
outputTextTokens: outputTextTokens,
|
44
46
|
rejectedPredictionTokens: usage.completion_tokens_details?.rejected_prediction_tokens,
|
45
47
|
totalInputTokens,
|
46
|
-
totalOutputTokens:
|
48
|
+
totalOutputTokens: totalOutputTokensNormalized,
|
47
49
|
totalTokens,
|
48
50
|
} satisfies ModelTokensUsage;
|
49
51
|
|
@@ -6,7 +6,7 @@ export interface XAIModelCard {
|
|
6
6
|
id: string;
|
7
7
|
}
|
8
8
|
|
9
|
-
export const GrokReasoningModels = new Set(['grok-3-mini', 'grok-4']);
|
9
|
+
export const GrokReasoningModels = new Set(['grok-3-mini', 'grok-4', 'grok-code']);
|
10
10
|
|
11
11
|
export const isGrokReasoningModel = (model: string) =>
|
12
12
|
Array.from(GrokReasoningModels).some((id) => model.includes(id));
|
@@ -2,6 +2,31 @@ import { AIChatModelCard, AIImageModelCard } from '@/types/aiModel';
|
|
2
2
|
|
3
3
|
// https://docs.x.ai/docs/models
|
4
4
|
const xaiChatModels: AIChatModelCard[] = [
|
5
|
+
{
|
6
|
+
abilities: {
|
7
|
+
functionCall: true,
|
8
|
+
reasoning: true,
|
9
|
+
},
|
10
|
+
contextWindowTokens: 256_000,
|
11
|
+
description:
|
12
|
+
'我们很高兴推出 grok-code-fast-1,这是一款快速且经济高效的推理模型,在代理编码方面表现出色。',
|
13
|
+
displayName: 'Grok Code Fast 1',
|
14
|
+
enabled: true,
|
15
|
+
id: 'grok-code-fast-1',
|
16
|
+
pricing: {
|
17
|
+
units: [
|
18
|
+
{ name: 'textInput_cacheRead', rate: 0.02, strategy: 'fixed', unit: 'millionTokens' },
|
19
|
+
{ name: 'textInput', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
|
20
|
+
{ name: 'textOutput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
|
21
|
+
],
|
22
|
+
},
|
23
|
+
releasedAt: '2025-08-28',
|
24
|
+
// settings: {
|
25
|
+
// reasoning_effort is not supported by grok-code. Specifying reasoning_effort parameter will get an error response.
|
26
|
+
// extendParams: ['reasoningEffort'],
|
27
|
+
// },
|
28
|
+
type: 'chat',
|
29
|
+
},
|
5
30
|
{
|
6
31
|
abilities: {
|
7
32
|
functionCall: true,
|