@lobehub/chat 1.52.14 → 1.52.15

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,39 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.52.15](https://github.com/lobehub/lobe-chat/compare/v1.52.14...v1.52.15)
6
+
7
+ <sup>Released on **2025-02-10**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix lmstudio baseURL.
12
+
13
+ #### 💄 Styles
14
+
15
+ - **misc**: Optimized MaxToken Slider.
16
+
17
+ <br/>
18
+
19
+ <details>
20
+ <summary><kbd>Improvements and Fixes</kbd></summary>
21
+
22
+ #### What's fixed
23
+
24
+ - **misc**: Fix lmstudio baseURL, closes [#5988](https://github.com/lobehub/lobe-chat/issues/5988) ([1d19aa6](https://github.com/lobehub/lobe-chat/commit/1d19aa6))
25
+
26
+ #### Styles
27
+
28
+ - **misc**: Optimized MaxToken Slider, closes [#5952](https://github.com/lobehub/lobe-chat/issues/5952) ([3cdcb95](https://github.com/lobehub/lobe-chat/commit/3cdcb95))
29
+
30
+ </details>
31
+
32
+ <div align="right">
33
+
34
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
35
+
36
+ </div>
37
+
5
38
  ### [Version 1.52.14](https://github.com/lobehub/lobe-chat/compare/v1.52.13...v1.52.14)
6
39
 
7
40
  <sup>Released on **2025-02-10**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,16 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Fix lmstudio baseURL."
6
+ ],
7
+ "improvements": [
8
+ "Optimized MaxToken Slider."
9
+ ]
10
+ },
11
+ "date": "2025-02-10",
12
+ "version": "1.52.15"
13
+ },
2
14
  {
3
15
  "children": {
4
16
  "improvements": [
@@ -103,6 +103,30 @@ services:
103
103
  env_file:
104
104
  - .env
105
105
  restart: always
106
+ entrypoint: >
107
+ /bin/sh -c "
108
+ /bin/node /app/startServer.js &
109
+ LOBE_PID=\$!
110
+ sleep 3
111
+ if [ $(wget --timeout=5 --spider --server-response ${AUTH_CASDOOR_ISSUER}/.well-known/openid-configuration 2>&1 | grep -c 'HTTP/1.1 200 OK') -eq 0 ]; then
112
+ echo '⚠️Warining: Unable to fetch OIDC configuration from Casdoor'
113
+ echo 'Request URL: ${AUTH_CASDOOR_ISSUER}/.well-known/openid-configuration'
114
+ echo 'Read more at: https://lobehub.com/docs/self-hosting/server-database/docker-compose#necessary-configuration'
115
+ else
116
+ if ! wget -O - --timeout=5 ${AUTH_CASDOOR_ISSUER}/.well-known/openid-configuration 2>&1 | grep 'issuer' | grep ${AUTH_CASDOOR_ISSUER}; then
117
+ printf '❌Error: The Auth issuer is conflict, Issuer in OIDC configuration is: %s' \$(wget -O - --timeout=5 ${AUTH_CASDOOR_ISSUER}/.well-known/openid-configuration 2>&1 | grep -E 'issuer.*' | awk -F '\"' '{print \$4}')
118
+ echo ' , but the issuer in .env file is: ${AUTH_CASDOOR_ISSUER} '
119
+ echo 'Request URL: ${AUTH_CASDOOR_ISSUER}/.well-known/openid-configuration'
120
+ echo 'Read more at: https://lobehub.com/docs/self-hosting/server-database/docker-compose#necessary-configuration'
121
+ fi
122
+ fi
123
+ if [ $(wget --timeout=5 --spider --server-response ${S3_ENDPOINT}/minio/health/live 2>&1 | grep -c 'HTTP/1.1 200 OK') -eq 0 ]; then
124
+ echo '⚠️Warining: Unable to fetch MinIO health status'
125
+ echo 'Request URL: ${S3_ENDPOINT}/minio/health/live'
126
+ echo 'Read more at: https://lobehub.com/docs/self-hosting/server-database/docker-compose#necessary-configuration'
127
+ fi
128
+ wait \$LOBE_PID
129
+ "
106
130
 
107
131
  volumes:
108
132
  data:
@@ -107,13 +107,13 @@ If you are deploying using a public network, the following assumptions apply:
107
107
 
108
108
  Configure the Casdoor webhook so that LobeChat can receive notifications when user information is updated.
109
109
 
110
- Go to `Admin ` -> `Webhooks`, add a webhook, and fill in the following fields:
110
+ Go to `Admin` -> `Webhooks`, add a webhook, and fill in the following fields:
111
111
 
112
112
  - URL: `https://lobe.example.com/api/auth/webhooks/casdoor`
113
113
  - Method: `POST`
114
114
  - Content Type: `application/json`
115
115
  - Headers: `casdoor-secret`: `Your Webhook Secret`
116
- > The webhook is generated by yourself, you can visit https://generate-secret.vercel.app/10 to generate a 10 bit secret.
116
+ > The secret is generated by yourself, you can visit https://generate-secret.vercel.app/10 to generate a 10 bit secret.
117
117
 
118
118
  - Event: `update-user`
119
119
  - Is user extented: `true`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.52.14",
3
+ "version": "1.52.15",
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",
@@ -35,7 +35,7 @@ const MaxTokenSlider = memo<MaxTokenSliderProps>(({ value, onChange, defaultValu
35
35
  const updateWithPowValue = (value: number) => {
36
36
  setPowValue(value);
37
37
 
38
- setTokens(getRealValue(value) === 1 ? 0 : powerKibi(value));
38
+ setTokens(getRealValue(value) <= 2 ? 0 : powerKibi(value));
39
39
  };
40
40
 
41
41
  const updateWithRealValue = (value: number) => {
@@ -48,16 +48,16 @@ const MaxTokenSlider = memo<MaxTokenSliderProps>(({ value, onChange, defaultValu
48
48
 
49
49
  const marks = useMemo(() => {
50
50
  return {
51
- [exponent(1)]: '0',
52
- [exponent(2)]: isMobile ? '2' : '2K', // 2 Kibi = 2048
53
- [exponent(4)]: isMobile ? '4' : '4K',
51
+ [exponent(2)]: '0',
52
+ [exponent(4)]: isMobile ? '4' : '4K', // 4 Kibi = 4096
54
53
  [exponent(8)]: isMobile ? '8' : '8K',
55
54
  [exponent(16)]: isMobile ? '16' : '16K',
56
55
  [exponent(32)]: isMobile ? '32' : '32K',
57
56
  [exponent(64)]: isMobile ? '64' : '64K',
58
57
  [exponent((128 / Kibi) * 1000)]: ' ', // hide tick mark
59
58
  [exponent((200 / Kibi) * 1000)]: isMobile ? '200' : '200k', // 200,000
60
- [exponent(Kibi)]: isMobile ? '1024' : '1M',
59
+ [exponent(Kibi)]: '1M',
60
+ [exponent(2 * Kibi)]: '2M',
61
61
  };
62
62
  }, [isMobile]);
63
63
 
@@ -66,14 +66,14 @@ const MaxTokenSlider = memo<MaxTokenSliderProps>(({ value, onChange, defaultValu
66
66
  <Flexbox flex={1}>
67
67
  <Slider
68
68
  marks={marks}
69
- max={exponent(Kibi)}
70
- min={0}
69
+ max={exponent(2 * Kibi)}
70
+ min={exponent(2)}
71
71
  onChange={updateWithPowValue}
72
72
  step={null}
73
73
  tooltip={{
74
74
  formatter: (x) => {
75
75
  if (typeof x === 'undefined') return;
76
- if (x === 0) return t('MaxTokenSlider.unlimited');
76
+ if (x <= exponent(2)) return t('MaxTokenSlider.unlimited');
77
77
 
78
78
  let value = getRealValue(x);
79
79
  if (value < 125) return value.toFixed(0) + 'K';
@@ -86,13 +86,14 @@ const MaxTokenSlider = memo<MaxTokenSliderProps>(({ value, onChange, defaultValu
86
86
  </Flexbox>
87
87
  <div>
88
88
  <InputNumber
89
+ changeOnWheel
89
90
  min={0}
90
91
  onChange={(e) => {
91
92
  if (!e && e !== 0) return;
92
93
 
93
94
  updateWithRealValue(e);
94
95
  }}
95
- step={2 * Kibi}
96
+ step={4 * Kibi}
96
97
  value={token}
97
98
  />
98
99
  </div>
@@ -12,7 +12,7 @@ import * as debugStreamModule from '../utils/debugStream';
12
12
  import { LobeLMStudioAI } from './index';
13
13
 
14
14
  const provider = ModelProvider.LMStudio;
15
- const defaultBaseURL = 'http://localhost:1234/v1';
15
+ const defaultBaseURL = 'http://127.0.0.1:1234/v1';
16
16
 
17
17
  const bizErrorType = 'ProviderBizError';
18
18
  const invalidErrorType = 'InvalidProviderAPIKey';
@@ -3,7 +3,7 @@ import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory';
3
3
 
4
4
  export const LobeLMStudioAI = LobeOpenAICompatibleFactory({
5
5
  apiKey: 'placeholder-to-avoid-error',
6
- baseURL: 'http://localhost:1234/v1',
6
+ baseURL: 'http://127.0.0.1:1234/v1',
7
7
  debug: {
8
8
  chatCompletion: () => process.env.DEBUG_LMSTUDIO_CHAT_COMPLETION === '1',
9
9
  },
@@ -1,7 +1,9 @@
1
1
  import { changeLanguage } from 'i18next';
2
2
  import { describe, expect, it, vi } from 'vitest';
3
3
 
4
+ import { LOBE_LOCALE_COOKIE } from '@/const/locale';
4
5
  import { LocaleMode } from '@/types/locale';
6
+ import { setCookie } from '@/utils/client/cookie';
5
7
 
6
8
  import { switchLang } from './switchLang';
7
9
 
@@ -9,6 +11,10 @@ vi.mock('i18next', () => ({
9
11
  changeLanguage: vi.fn(),
10
12
  }));
11
13
 
14
+ vi.mock('./cookie', () => ({
15
+ setCookie: vi.fn(),
16
+ }));
17
+
12
18
  describe('switchLang', () => {
13
19
  afterEach(() => {
14
20
  vi.resetAllMocks();
@@ -20,6 +26,7 @@ describe('switchLang', () => {
20
26
 
21
27
  expect(changeLanguage).toHaveBeenCalledWith(locale);
22
28
  expect(document.documentElement.lang).toBe(locale);
29
+ expect(setCookie).toHaveBeenCalledWith(LOBE_LOCALE_COOKIE, locale, 365);
23
30
  });
24
31
 
25
32
  it('should change language based on navigator.language when locale is "auto"', () => {
@@ -30,5 +37,6 @@ describe('switchLang', () => {
30
37
 
31
38
  expect(changeLanguage).toHaveBeenCalledWith(navigatorLanguage);
32
39
  expect(document.documentElement.lang).toBe(navigatorLanguage);
40
+ expect(setCookie).toHaveBeenCalledWith(LOBE_LOCALE_COOKIE, undefined, 365);
33
41
  });
34
42
  });