@lobehub/chat 0.120.4 → 0.120.5
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 +25 -0
- package/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/locales/ar/common.json +1 -0
- package/locales/de-DE/common.json +1 -0
- package/locales/en-US/common.json +1 -0
- package/locales/es-ES/common.json +1 -0
- package/locales/fr-FR/common.json +1 -0
- package/locales/it-IT/common.json +1 -0
- package/locales/ja-JP/common.json +1 -0
- package/locales/ko-KR/common.json +1 -0
- package/locales/nl-NL/common.json +1 -0
- package/locales/pl-PL/common.json +1 -0
- package/locales/pt-BR/common.json +1 -0
- package/locales/ru-RU/common.json +1 -0
- package/locales/tr-TR/common.json +1 -0
- package/locales/vi-VN/common.json +1 -0
- package/locales/zh-CN/common.json +1 -0
- package/locales/zh-TW/common.json +1 -0
- package/package.json +16 -16
- package/src/app/chat/features/ChatHeader/ShareButton/style.ts +1 -1
- package/src/locales/default/common.ts +1 -0
- package/src/store/global/slices/settings/action.test.ts +117 -0
- package/src/store/session/slices/session/action.ts +1 -1
- package/src/styles/global.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.120.5](https://github.com/lobehub/lobe-chat/compare/v0.120.4...v0.120.5)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-01-21**</sup>
|
|
8
|
+
|
|
9
|
+
#### 💄 Styles
|
|
10
|
+
|
|
11
|
+
- **misc**: Update locale and add test for globalStore.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### Styles
|
|
19
|
+
|
|
20
|
+
- **misc**: Update locale and add test for globalStore, closes [#1119](https://github.com/lobehub/lobe-chat/issues/1119) ([4545cf0](https://github.com/lobehub/lobe-chat/commit/4545cf0))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 0.120.4](https://github.com/lobehub/lobe-chat/compare/v0.120.3...v0.120.4)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2024-01-21**</sup>
|
package/README.md
CHANGED
|
@@ -223,14 +223,14 @@ Our marketplace is not just a showcase platform but also a collaborative space.
|
|
|
223
223
|
|
|
224
224
|
<!-- AGENT LIST -->
|
|
225
225
|
|
|
226
|
-
| Recent Submits
|
|
227
|
-
|
|
|
228
|
-
| [
|
|
229
|
-
| [
|
|
230
|
-
| [
|
|
231
|
-
| [
|
|
232
|
-
|
|
233
|
-
> 📊 Total agents: [<kbd>**
|
|
226
|
+
| Recent Submits | Description |
|
|
227
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
228
|
+
| [Accounting Expert Assistant](https://chat-preview.lobehub.com/market?agent=accounting)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-21**</sup> | Accountant Agent: Comprehensive accounting support and expertise for individuals and businesses worldwide.<br/>`accounting` `financial-management` `tax-planning` `budgeting` |
|
|
229
|
+
| [Business Guru](https://chat-preview.lobehub.com/market?agent=business-guru)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-21**</sup> | Business Consultant: Providing comprehensive business support and expertise worldwide.Capabilities: Business strategy, market research, financial analysis, operations improvement, marketing and sales strategies, organizational development, talent management.Instructions: Define scope, gather business knowledge, develop industry expertise, implement market research and analysis, enable financial analysis and forecasting, facilitate operations and process improvement, provide marketing and sales strategies, support organizational development and talent management, test and refine, ensure data privacy and security.<br/>`business-consultant` |
|
|
230
|
+
| [DIY Guide Assistant](https://chat-preview.lobehub.com/market?agent=diy)<br/><sup>By **[guluahljj](https://github.com/guluahljj)** on **2024-01-21**</sup> | DIY project assistant, providing detailed guidance, programming support, and personalized customization<br/>`diy` `guide` `project` `programming` `assembly` |
|
|
231
|
+
| [Financial Expert](https://chat-preview.lobehub.com/market?agent=finnance)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-21**</sup> | Finance Expert with Global Financial Expertise, Multilingual Communication, Financial Analysis and Reporting, Investment Planning and Portfolio Management, Financial Planning and Retirement Strategies, and Risk Management and Insurance capabilities.<br/>`inancial-management` |
|
|
232
|
+
|
|
233
|
+
> 📊 Total agents: [<kbd>**111**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
|
|
234
234
|
|
|
235
235
|
<!-- AGENT LIST -->
|
|
236
236
|
|
package/README.zh-CN.md
CHANGED
|
@@ -203,14 +203,14 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
|
|
|
203
203
|
|
|
204
204
|
<!-- AGENT LIST -->
|
|
205
205
|
|
|
206
|
-
| 最近新增
|
|
207
|
-
|
|
|
208
|
-
| [
|
|
209
|
-
| [
|
|
210
|
-
| [
|
|
211
|
-
| [
|
|
212
|
-
|
|
213
|
-
> 📊 Total agents: [<kbd>**
|
|
206
|
+
| 最近新增 | 助手说明 |
|
|
207
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
208
|
+
| [会计专家助手](https://chat-preview.lobehub.com/market?agent=accounting)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-21**</sup> | 会计代理:为全球个人和企业提供全面的会计支持和专业知识。<br/>`会计` `财务管理` `税务规划` `预算编制` |
|
|
209
|
+
| [商业顾问](https://chat-preview.lobehub.com/market?agent=business-guru)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-21**</sup> | 商业顾问:为全球提供全面的商业支持和专业知识。能力:商业战略、市场研究、财务分析、运营改善、营销和销售策略、组织发展、人才管理。说明:定义范围,收集商业知识,发展行业专长,实施市场研究和分析,启用财务分析和预测,促进运营和流程改善,提供营销和销售策略,支持组织发展和人才管理,测试和完善,确保数据隐私和安全。<br/>`business-consultant` |
|
|
210
|
+
| [DIY 指导助手](https://chat-preview.lobehub.com/market?agent=diy)<br/><sup>By **[guluahljj](https://github.com/guluahljj)** on **2024-01-21**</sup> | DIY 项目助手,提供详细指导、编程支持和个性化定制<br/>`diy` `指导` `项目` `编程` `组装` |
|
|
211
|
+
| [金融专家](https://chat-preview.lobehub.com/market?agent=finnance)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-21**</sup> | 具有全球金融专业知识、多语沟通能力、财务分析和报告、投资规划和投资组合管理、财务规划和退休策略、以及风险管理和保险能力的金融专家。<br/>`金融管理` |
|
|
212
|
+
|
|
213
|
+
> 📊 Total agents: [<kbd>**111**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
|
|
214
214
|
|
|
215
215
|
<!-- AGENT LIST -->
|
|
216
216
|
|
package/locales/ar/common.json
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"close": "إغلاق",
|
|
14
14
|
"confirmRemoveSessionItemAlert": "سيتم حذف هذا المساعد قريبًا، وبمجرد الحذف لن يمكن استعادته، يرجى تأكيد الإجراء",
|
|
15
15
|
"copy": "نسخ",
|
|
16
|
+
"copyFail": "فشل في النسخ",
|
|
16
17
|
"copySuccess": "تم النسخ بنجاح",
|
|
17
18
|
"defaultAgent": "مساعد افتراضي",
|
|
18
19
|
"defaultSession": "جلسة افتراضية",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"close": "Schließen",
|
|
14
14
|
"confirmRemoveSessionItemAlert": "Möchten Sie diesen Assistenten wirklich löschen? Nach dem Löschen kann er nicht wiederhergestellt werden. Bitte bestätigen Sie Ihre Aktion.",
|
|
15
15
|
"copy": "Kopieren",
|
|
16
|
+
"copyFail": "Kopieren fehlgeschlagen",
|
|
16
17
|
"copySuccess": "Kopieren erfolgreich",
|
|
17
18
|
"defaultAgent": "Standardassistent",
|
|
18
19
|
"defaultSession": "Standardassistent",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"close": "Close",
|
|
14
14
|
"confirmRemoveSessionItemAlert": "You are about to delete this agent. Once deleted, it cannot be recovered. Please confirm your action.",
|
|
15
15
|
"copy": "Copy",
|
|
16
|
+
"copyFail": "Copy failed",
|
|
16
17
|
"copySuccess": "Copied successfully",
|
|
17
18
|
"defaultAgent": "Default Agent",
|
|
18
19
|
"defaultSession": "Default Agent",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"close": "Cerrar",
|
|
14
14
|
"confirmRemoveSessionItemAlert": "Estás a punto de eliminar este asistente. Una vez eliminado, no se podrá recuperar. Por favor, confirma tu acción",
|
|
15
15
|
"copy": "Copiar",
|
|
16
|
+
"copyFail": "Fallo al copiar",
|
|
16
17
|
"copySuccess": "¡Copia exitosa!",
|
|
17
18
|
"defaultAgent": "Asistente predeterminado",
|
|
18
19
|
"defaultSession": "Sesión predeterminada",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"close": "Fermer",
|
|
14
14
|
"confirmRemoveSessionItemAlert": "Vous êtes sur le point de supprimer cet agent. Une fois supprimé, il ne pourra pas être récupéré. Veuillez confirmer votre action.",
|
|
15
15
|
"copy": "Copier",
|
|
16
|
+
"copyFail": "Échec de la copie",
|
|
16
17
|
"copySuccess": "Copie réussie",
|
|
17
18
|
"defaultAgent": "Agent par défaut",
|
|
18
19
|
"defaultSession": "Session par défaut",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"close": "Chiudi",
|
|
14
14
|
"confirmRemoveSessionItemAlert": "Stai per eliminare questo assistente. Una volta eliminato, non sarà possibile recuperarlo. Confermi l'operazione?",
|
|
15
15
|
"copy": "Copia",
|
|
16
|
+
"copyFail": "Copia non riuscita",
|
|
16
17
|
"copySuccess": "Copia riuscita",
|
|
17
18
|
"defaultAgent": "Assistente predefinito",
|
|
18
19
|
"defaultSession": "Sessione predefinita",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"close": "Sluiten",
|
|
14
14
|
"confirmRemoveSessionItemAlert": "U staat op het punt deze assistent te verwijderen. Na verwijdering kan deze niet worden hersteld. Weet u zeker dat u door wilt gaan?",
|
|
15
15
|
"copy": "Kopiëren",
|
|
16
|
+
"copyFail": "Kopiëren mislukt",
|
|
16
17
|
"copySuccess": "Kopiëren gelukt",
|
|
17
18
|
"defaultAgent": "Standaard assistent",
|
|
18
19
|
"defaultSession": "Standaard assistent",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"close": "Zamknij",
|
|
14
14
|
"confirmRemoveSessionItemAlert": "Czy na pewno chcesz usunąć tego asystenta? Po usunięciu nie będzie możliwe jego odzyskanie.",
|
|
15
15
|
"copy": "Kopiuj",
|
|
16
|
+
"copyFail": "Nie udało się skopiować",
|
|
16
17
|
"copySuccess": "Skopiowano pomyślnie",
|
|
17
18
|
"defaultAgent": "Domyślny asystent",
|
|
18
19
|
"defaultSession": "Domyślna sesja",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"close": "Fechar",
|
|
14
14
|
"confirmRemoveSessionItemAlert": "Você está prestes a excluir este assistente. Após a exclusão, não será possível recuperá-lo. Por favor, confirme sua ação.",
|
|
15
15
|
"copy": "Copiar",
|
|
16
|
+
"copyFail": "Falha ao copiar",
|
|
16
17
|
"copySuccess": "Cópia bem-sucedida",
|
|
17
18
|
"defaultAgent": "Assistente padrão",
|
|
18
19
|
"defaultSession": "Sessão padrão",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"close": "Закрыть",
|
|
14
14
|
"confirmRemoveSessionItemAlert": "Вы собираетесь удалить этого агента. После удаления его будет невозможно восстановить. Подтвердите ваше действие",
|
|
15
15
|
"copy": "Копировать",
|
|
16
|
+
"copyFail": "Не удалось скопировать",
|
|
16
17
|
"copySuccess": "Успешно скопировано",
|
|
17
18
|
"defaultAgent": "Пользовательский агент",
|
|
18
19
|
"defaultSession": "Пользовательский агент",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"close": "Kapat",
|
|
14
14
|
"confirmRemoveSessionItemAlert": "Bu asistanı silmek üzeresiniz. Silindikten sonra geri alınamaz. Lütfen eyleminizi onaylayın.",
|
|
15
15
|
"copy": "Kopyala",
|
|
16
|
+
"copyFail": "Kopyalama başarısız oldu",
|
|
16
17
|
"copySuccess": "Kopyalama Başarılı",
|
|
17
18
|
"defaultAgent": "Varsayılan Asistan",
|
|
18
19
|
"defaultSession": "Varsayılan Asistan",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"close": "Đóng",
|
|
14
14
|
"confirmRemoveSessionItemAlert": "Bạn sắp xóa trợ lý này. Sau khi xóa, bạn sẽ không thể khôi phục. Vui lòng xác nhận hành động của bạn",
|
|
15
15
|
"copy": "Sao chép",
|
|
16
|
+
"copyFail": "Sao chép thất bại",
|
|
16
17
|
"copySuccess": "Sao chép thành công",
|
|
17
18
|
"defaultAgent": "Trợ lý mặc định",
|
|
18
19
|
"defaultSession": "Phiên mặc định",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.120.
|
|
3
|
+
"version": "0.120.5",
|
|
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",
|
|
@@ -84,10 +84,10 @@
|
|
|
84
84
|
"@lobehub/ui": "latest",
|
|
85
85
|
"@vercel/analytics": "^1",
|
|
86
86
|
"ahooks": "^3",
|
|
87
|
-
"ai": "^2
|
|
88
|
-
"antd": "^5
|
|
87
|
+
"ai": "^2",
|
|
88
|
+
"antd": "^5",
|
|
89
89
|
"antd-style": "^3",
|
|
90
|
-
"brotli-wasm": "^2
|
|
90
|
+
"brotli-wasm": "^2",
|
|
91
91
|
"chroma-js": "^2",
|
|
92
92
|
"copy-to-clipboard": "^3",
|
|
93
93
|
"dayjs": "^1",
|
|
@@ -104,16 +104,16 @@
|
|
|
104
104
|
"lucide-react": "latest",
|
|
105
105
|
"modern-screenshot": "^4",
|
|
106
106
|
"nanoid": "^5",
|
|
107
|
-
"next": "^14.
|
|
107
|
+
"next": "^14.1",
|
|
108
108
|
"nuqs": "^1.15.4",
|
|
109
|
-
"openai": "^4.
|
|
109
|
+
"openai": "^4.22",
|
|
110
110
|
"polished": "^4",
|
|
111
111
|
"posthog-js": "^1",
|
|
112
112
|
"query-string": "^8",
|
|
113
113
|
"react": "^18",
|
|
114
114
|
"react-dom": "^18",
|
|
115
|
-
"react-hotkeys-hook": "^4
|
|
116
|
-
"react-i18next": "^14
|
|
115
|
+
"react-hotkeys-hook": "^4",
|
|
116
|
+
"react-i18next": "^14",
|
|
117
117
|
"react-intersection-observer": "^9",
|
|
118
118
|
"react-layout-kit": "^1",
|
|
119
119
|
"react-lazy-load": "^4",
|
|
@@ -122,9 +122,9 @@
|
|
|
122
122
|
"remark": "^14",
|
|
123
123
|
"remark-gfm": "^3",
|
|
124
124
|
"remark-html": "^15",
|
|
125
|
-
"rtl-detect": "^1
|
|
125
|
+
"rtl-detect": "^1",
|
|
126
126
|
"semver": "^7",
|
|
127
|
-
"sharp": "0.33.
|
|
127
|
+
"sharp": "^0.33.2",
|
|
128
128
|
"swr": "^2",
|
|
129
129
|
"systemjs": "^6",
|
|
130
130
|
"ts-md5": "^1",
|
|
@@ -148,19 +148,19 @@
|
|
|
148
148
|
"@testing-library/jest-dom": "^6",
|
|
149
149
|
"@testing-library/react": "^14",
|
|
150
150
|
"@types/chroma-js": "^2",
|
|
151
|
-
"@types/json-schema": "^7
|
|
151
|
+
"@types/json-schema": "^7",
|
|
152
152
|
"@types/lodash": "^4",
|
|
153
153
|
"@types/lodash-es": "^4",
|
|
154
154
|
"@types/node": "^20",
|
|
155
155
|
"@types/react": "^18",
|
|
156
156
|
"@types/react-dom": "^18",
|
|
157
|
-
"@types/rtl-detect": "^1
|
|
157
|
+
"@types/rtl-detect": "^1",
|
|
158
158
|
"@types/semver": "^7",
|
|
159
159
|
"@types/systemjs": "^6",
|
|
160
160
|
"@types/ua-parser-js": "^0.7",
|
|
161
161
|
"@types/uuid": "^9",
|
|
162
162
|
"@umijs/lint": "^4",
|
|
163
|
-
"@vitest/coverage-v8": "^1
|
|
163
|
+
"@vitest/coverage-v8": "^1",
|
|
164
164
|
"commitlint": "^18",
|
|
165
165
|
"consola": "^3",
|
|
166
166
|
"dpdm": "^3",
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
"fake-indexeddb": "^5",
|
|
169
169
|
"glob": "^10",
|
|
170
170
|
"husky": "^8",
|
|
171
|
-
"jsdom": "^23
|
|
171
|
+
"jsdom": "^23",
|
|
172
172
|
"just-diff": "^6",
|
|
173
173
|
"lint-staged": "^15",
|
|
174
174
|
"lodash": "^4",
|
|
@@ -184,8 +184,8 @@
|
|
|
184
184
|
"typescript": "^5",
|
|
185
185
|
"unified": "^11",
|
|
186
186
|
"unist-util-visit": "^5",
|
|
187
|
-
"vitest": "^1
|
|
188
|
-
"vitest-canvas-mock": "^0.3
|
|
187
|
+
"vitest": "^1",
|
|
188
|
+
"vitest-canvas-mock": "^0.3"
|
|
189
189
|
},
|
|
190
190
|
"publishConfig": {
|
|
191
191
|
"access": "public",
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { act, renderHook } from '@testing-library/react';
|
|
2
|
+
import { DeepPartial } from 'utility-types';
|
|
3
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
4
|
+
|
|
5
|
+
import { DEFAULT_AGENT, DEFAULT_SETTINGS } from '@/const/settings';
|
|
6
|
+
import { useGlobalStore } from '@/store/global';
|
|
7
|
+
import { SettingsTabs } from '@/store/global/initialState';
|
|
8
|
+
import { LobeAgentSettings } from '@/types/session';
|
|
9
|
+
import { GlobalSettings, OpenAIConfig } from '@/types/settings';
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
vi.clearAllMocks();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
vi.mock('@/utils/uuid', () => ({
|
|
16
|
+
nanoid: vi.fn(() => 'unique-id'),
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
describe('SettingsAction', () => {
|
|
20
|
+
describe('importAppSettings', () => {
|
|
21
|
+
it('should import app settings', () => {
|
|
22
|
+
const { result } = renderHook(() => useGlobalStore());
|
|
23
|
+
const newSettings: GlobalSettings = {
|
|
24
|
+
...DEFAULT_SETTINGS,
|
|
25
|
+
themeMode: 'dark',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
act(() => {
|
|
29
|
+
result.current.importAppSettings(newSettings);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
expect(result.current.settings).toEqual(newSettings);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('resetSettings', () => {
|
|
37
|
+
it('should reset settings to default', () => {
|
|
38
|
+
const { result } = renderHook(() => useGlobalStore());
|
|
39
|
+
|
|
40
|
+
act(() => {
|
|
41
|
+
result.current.resetSettings();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
expect(result.current.settings).toEqual(DEFAULT_SETTINGS);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe('setOpenAIConfig', () => {
|
|
49
|
+
it('should set OpenAI configuration', () => {
|
|
50
|
+
const { result } = renderHook(() => useGlobalStore());
|
|
51
|
+
const openAIConfig: Partial<OpenAIConfig> = { OPENAI_API_KEY: 'test' };
|
|
52
|
+
|
|
53
|
+
act(() => {
|
|
54
|
+
result.current.setOpenAIConfig(openAIConfig);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
expect(result.current.settings.languageModel.openAI.OPENAI_API_KEY).toEqual(
|
|
58
|
+
openAIConfig.OPENAI_API_KEY,
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('setSettings', () => {
|
|
64
|
+
it('should set partial settings', () => {
|
|
65
|
+
const { result } = renderHook(() => useGlobalStore());
|
|
66
|
+
const partialSettings: Partial<GlobalSettings> = { themeMode: 'dark' };
|
|
67
|
+
|
|
68
|
+
act(() => {
|
|
69
|
+
result.current.setSettings(partialSettings);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
expect(result.current.settings.themeMode).toEqual('dark');
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe('switchSettingTabs', () => {
|
|
77
|
+
it('should switch settings tabs', () => {
|
|
78
|
+
const { result } = renderHook(() => useGlobalStore());
|
|
79
|
+
|
|
80
|
+
act(() => {
|
|
81
|
+
result.current.switchSettingTabs(SettingsTabs.Agent);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
expect(result.current.settingsTab).toEqual(SettingsTabs.Agent);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe('switchThemeMode', () => {
|
|
89
|
+
it('should switch theme mode', () => {
|
|
90
|
+
const { result } = renderHook(() => useGlobalStore());
|
|
91
|
+
|
|
92
|
+
act(() => {
|
|
93
|
+
result.current.switchThemeMode('light');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
expect(result.current.settings.themeMode).toEqual('light');
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe('updateDefaultAgent', () => {
|
|
101
|
+
it('should update default agent settings', () => {
|
|
102
|
+
const { result } = renderHook(() => useGlobalStore());
|
|
103
|
+
const updatedAgent: DeepPartial<LobeAgentSettings> = {
|
|
104
|
+
meta: { title: 'docs' },
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
act(() => {
|
|
108
|
+
result.current.updateDefaultAgent(updatedAgent);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
expect(result.current.settings.defaultAgent).toEqual({
|
|
112
|
+
...DEFAULT_AGENT,
|
|
113
|
+
...updatedAgent,
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
});
|
package/src/styles/global.ts
CHANGED