@lobehub/chat 1.126.0 → 1.126.2
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/locales/ar/chat.json +2 -1
- package/locales/bg-BG/chat.json +2 -1
- package/locales/de-DE/chat.json +2 -1
- package/locales/en-US/chat.json +2 -1
- package/locales/es-ES/chat.json +2 -1
- package/locales/fa-IR/chat.json +2 -1
- package/locales/fr-FR/chat.json +2 -1
- package/locales/it-IT/chat.json +2 -1
- package/locales/ja-JP/chat.json +2 -1
- package/locales/ko-KR/chat.json +2 -1
- package/locales/nl-NL/chat.json +2 -1
- package/locales/pl-PL/chat.json +2 -1
- package/locales/pt-BR/chat.json +2 -1
- package/locales/ru-RU/chat.json +2 -1
- package/locales/tr-TR/chat.json +2 -1
- package/locales/vi-VN/chat.json +2 -1
- package/locales/zh-CN/chat.json +2 -1
- package/locales/zh-TW/chat.json +2 -1
- package/package.json +4 -4
- package/packages/utils/src/keyboard.ts +0 -2
- package/src/features/ChatInput/InputEditor/index.tsx +41 -8
- package/src/features/ChatInput/TypoBar/index.tsx +8 -8
- package/src/hooks/useHotkeys/chatScope.ts +17 -6
- package/src/locales/default/chat.ts +1 -0
- package/src/server/modules/AssistantStore/index.test.ts +3 -0
- package/src/server/modules/AssistantStore/index.ts +6 -4
- package/src/services/discover.ts +9 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 1.126.2](https://github.com/lobehub/lobe-chat/compare/v1.126.1...v1.126.2)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2025-09-09**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix editor key handling.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix editor key handling, closes [#9189](https://github.com/lobehub/lobe-chat/issues/9189) ([8be822b](https://github.com/lobehub/lobe-chat/commit/8be822b))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 1.126.1](https://github.com/lobehub/lobe-chat/compare/v1.126.0...v1.126.1)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2025-09-09**</sup>
|
|
33
|
+
|
|
34
|
+
#### 🐛 Bug Fixes
|
|
35
|
+
|
|
36
|
+
- **misc**: Fix Assistant List error message.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's fixed
|
|
44
|
+
|
|
45
|
+
- **misc**: Fix Assistant List error message, closes [#9178](https://github.com/lobehub/lobe-chat/issues/9178) ([3519cb2](https://github.com/lobehub/lobe-chat/commit/3519cb2))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
## [Version 1.126.0](https://github.com/lobehub/lobe-chat/compare/v1.125.0...v1.126.0)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2025-09-08**</sup>
|
package/changelog/v1.json
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"children": {
|
|
4
|
+
"fixes": [
|
|
5
|
+
"Fix editor key handling."
|
|
6
|
+
]
|
|
7
|
+
},
|
|
8
|
+
"date": "2025-09-09",
|
|
9
|
+
"version": "1.126.2"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"children": {
|
|
13
|
+
"fixes": [
|
|
14
|
+
"Fix Assistant List error message."
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"date": "2025-09-09",
|
|
18
|
+
"version": "1.126.1"
|
|
19
|
+
},
|
|
2
20
|
{
|
|
3
21
|
"children": {},
|
|
4
22
|
"date": "2025-09-08",
|
package/locales/ar/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "اضغط <key/> للإرسال",
|
|
78
78
|
"sendWithEnter": "اضغط <key/> للإرسال",
|
|
79
79
|
"stop": "توقف",
|
|
80
|
-
"warp": "تغيير السطر"
|
|
80
|
+
"warp": "تغيير السطر",
|
|
81
|
+
"warpWithKey": "اضغط على مفتاح <key/> للانتقال إلى السطر"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "جارٍ فهم وتحليل نواياك..."
|
package/locales/bg-BG/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "Натиснете <key/> за изпращане",
|
|
78
78
|
"sendWithEnter": "Натиснете <key/> за изпращане",
|
|
79
79
|
"stop": "Спри",
|
|
80
|
-
"warp": "Нов ред"
|
|
80
|
+
"warp": "Нов ред",
|
|
81
|
+
"warpWithKey": "Натиснете <key/> за нов ред"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "Разбирам и анализирам вашето намерение..."
|
package/locales/de-DE/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "Drücken Sie <key/>, um zu senden",
|
|
78
78
|
"sendWithEnter": "Drücken Sie <key/>, um zu senden",
|
|
79
79
|
"stop": "Stoppen",
|
|
80
|
-
"warp": "Zeilenumbruch"
|
|
80
|
+
"warp": "Zeilenumbruch",
|
|
81
|
+
"warpWithKey": "Mit der Taste <key/> umbrechen"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "Verstehe und analysiere gerade Ihre Absicht..."
|
package/locales/en-US/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "Press <key/> to send",
|
|
78
78
|
"sendWithEnter": "Press <key/> to send",
|
|
79
79
|
"stop": "Stop",
|
|
80
|
-
"warp": "New Line"
|
|
80
|
+
"warp": "New Line",
|
|
81
|
+
"warpWithKey": "Press <key/> to insert a line break"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "Understanding and analyzing your intent..."
|
package/locales/es-ES/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "Presiona <key/> para enviar",
|
|
78
78
|
"sendWithEnter": "Presiona <key/> para enviar",
|
|
79
79
|
"stop": "Detener",
|
|
80
|
-
"warp": "Salto de línea"
|
|
80
|
+
"warp": "Salto de línea",
|
|
81
|
+
"warpWithKey": "Presione la tecla <key/> para hacer un salto de línea"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "Entendiendo y analizando su intención..."
|
package/locales/fa-IR/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "برای ارسال، کلید <key/> را فشار دهید",
|
|
78
78
|
"sendWithEnter": "برای ارسال، کلید <key/> را فشار دهید",
|
|
79
79
|
"stop": "توقف",
|
|
80
|
-
"warp": "خط جدید"
|
|
80
|
+
"warp": "خط جدید",
|
|
81
|
+
"warpWithKey": "با فشار دادن کلید <key/> خط جدید ایجاد کنید"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "در حال درک و تحلیل نیت شما..."
|
package/locales/fr-FR/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "Appuyez sur <key/> pour envoyer",
|
|
78
78
|
"sendWithEnter": "Appuyez sur <key/> pour envoyer",
|
|
79
79
|
"stop": "Arrêter",
|
|
80
|
-
"warp": "Saut de ligne"
|
|
80
|
+
"warp": "Saut de ligne",
|
|
81
|
+
"warpWithKey": "Appuyez sur la touche <key/> pour un retour à la ligne"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "En train de comprendre et d'analyser votre intention..."
|
package/locales/it-IT/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "Premi <key/> per inviare",
|
|
78
78
|
"sendWithEnter": "Premi <key/> per inviare",
|
|
79
79
|
"stop": "Ferma",
|
|
80
|
-
"warp": "A capo"
|
|
80
|
+
"warp": "A capo",
|
|
81
|
+
"warpWithKey": "Vai a capo premendo il tasto <key/>"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "Stiamo comprendendo e analizzando la tua intenzione..."
|
package/locales/ja-JP/chat.json
CHANGED
package/locales/ko-KR/chat.json
CHANGED
package/locales/nl-NL/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "Druk op <key/> om te verzenden",
|
|
78
78
|
"sendWithEnter": "Druk op <key/> om te verzenden",
|
|
79
79
|
"stop": "Stoppen",
|
|
80
|
-
"warp": "Nieuwe regel"
|
|
80
|
+
"warp": "Nieuwe regel",
|
|
81
|
+
"warpWithKey": "Druk op <key/> om een nieuwe regel te beginnen"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "Bezig met het begrijpen en analyseren van uw intentie..."
|
package/locales/pl-PL/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "Naciśnij <key/>, aby wysłać",
|
|
78
78
|
"sendWithEnter": "Naciśnij <key/>, aby wysłać",
|
|
79
79
|
"stop": "Zatrzymaj",
|
|
80
|
-
"warp": "Złamanie wiersza"
|
|
80
|
+
"warp": "Złamanie wiersza",
|
|
81
|
+
"warpWithKey": "Zawijaj wiersz klawiszem <key/>"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "Rozumiemy i analizujemy Twoje intencje..."
|
package/locales/pt-BR/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "Pressione <key/> para enviar",
|
|
78
78
|
"sendWithEnter": "Pressione <key/> para enviar",
|
|
79
79
|
"stop": "Parar",
|
|
80
|
-
"warp": "Quebrar linha"
|
|
80
|
+
"warp": "Quebrar linha",
|
|
81
|
+
"warpWithKey": "Quebrar linha pressionando <key/> tecla"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "Entendendo e analisando sua intenção..."
|
package/locales/ru-RU/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "Нажмите <key/> для отправки",
|
|
78
78
|
"sendWithEnter": "Нажмите <key/> для отправки",
|
|
79
79
|
"stop": "Остановить",
|
|
80
|
-
"warp": "Перенос строки"
|
|
80
|
+
"warp": "Перенос строки",
|
|
81
|
+
"warpWithKey": "Нажмите клавишу <key/> для переноса строки"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "Мы понимаем и анализируем ваше намерение..."
|
package/locales/tr-TR/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "<key/> tuşuna basarak gönder",
|
|
78
78
|
"sendWithEnter": "<key/> tuşuna basarak gönder",
|
|
79
79
|
"stop": "Dur",
|
|
80
|
-
"warp": "Satır atla"
|
|
80
|
+
"warp": "Satır atla",
|
|
81
|
+
"warpWithKey": "<key/> tuşuna basarak satır sonu yap"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "Niyetinizi anlama ve analiz etme aşamasındayız..."
|
package/locales/vi-VN/chat.json
CHANGED
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"sendWithCmdEnter": "Nhấn <key/> để gửi",
|
|
78
78
|
"sendWithEnter": "Nhấn <key/> để gửi",
|
|
79
79
|
"stop": "Dừng",
|
|
80
|
-
"warp": "Xuống dòng"
|
|
80
|
+
"warp": "Xuống dòng",
|
|
81
|
+
"warpWithKey": "Nhấn phím <key/> để xuống dòng"
|
|
81
82
|
},
|
|
82
83
|
"intentUnderstanding": {
|
|
83
84
|
"title": "Đang hiểu và phân tích ý định của bạn..."
|
package/locales/zh-CN/chat.json
CHANGED
package/locales/zh-TW/chat.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "1.126.
|
|
3
|
+
"version": "1.126.2",
|
|
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",
|
|
@@ -155,11 +155,11 @@
|
|
|
155
155
|
"@lobehub/charts": "^2.0.0",
|
|
156
156
|
"@lobehub/chat-plugin-sdk": "^1.32.4",
|
|
157
157
|
"@lobehub/chat-plugins-gateway": "^1.9.0",
|
|
158
|
-
"@lobehub/editor": "^1.5.
|
|
158
|
+
"@lobehub/editor": "^1.5.8",
|
|
159
159
|
"@lobehub/icons": "^2.31.0",
|
|
160
160
|
"@lobehub/market-sdk": "^0.22.7",
|
|
161
161
|
"@lobehub/tts": "^2.0.1",
|
|
162
|
-
"@lobehub/ui": "^2.
|
|
162
|
+
"@lobehub/ui": "^2.12.2",
|
|
163
163
|
"@modelcontextprotocol/sdk": "^1.17.1",
|
|
164
164
|
"@neondatabase/serverless": "^1.0.1",
|
|
165
165
|
"@next/third-parties": "^15.4.6",
|
|
@@ -366,7 +366,7 @@
|
|
|
366
366
|
"vite": "^5.4.19",
|
|
367
367
|
"vitest": "^3.2.4"
|
|
368
368
|
},
|
|
369
|
-
"packageManager": "pnpm@10.15.
|
|
369
|
+
"packageManager": "pnpm@10.15.1",
|
|
370
370
|
"publishConfig": {
|
|
371
371
|
"access": "public",
|
|
372
372
|
"registry": "https://registry.npmjs.org"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isDesktop } from '@lobechat/const';
|
|
2
|
-
import { HotkeyEnum } from '@lobechat/types';
|
|
2
|
+
import { HotkeyEnum, KeyEnum } from '@lobechat/types';
|
|
3
3
|
import { isCommandPressed } from '@lobechat/utils';
|
|
4
4
|
import {
|
|
5
5
|
INSERT_TABLE_COMMAND,
|
|
@@ -12,13 +12,15 @@ import {
|
|
|
12
12
|
ReactTablePlugin,
|
|
13
13
|
} from '@lobehub/editor';
|
|
14
14
|
import { Editor, FloatMenu, SlashMenu, useEditorState } from '@lobehub/editor/react';
|
|
15
|
+
import { Hotkey, combineKeys } from '@lobehub/ui';
|
|
15
16
|
import { Table2Icon } from 'lucide-react';
|
|
16
17
|
import { memo, useEffect, useRef } from 'react';
|
|
17
18
|
import { useHotkeysContext } from 'react-hotkeys-hook';
|
|
18
|
-
import { useTranslation } from 'react-i18next';
|
|
19
|
+
import { Trans, useTranslation } from 'react-i18next';
|
|
20
|
+
import { Flexbox } from 'react-layout-kit';
|
|
19
21
|
|
|
20
22
|
import { useUserStore } from '@/store/user';
|
|
21
|
-
import { preferenceSelectors } from '@/store/user/selectors';
|
|
23
|
+
import { preferenceSelectors, settingsSelectors } from '@/store/user/selectors';
|
|
22
24
|
|
|
23
25
|
import { useChatInputStore, useStoreApi } from '../store';
|
|
24
26
|
|
|
@@ -32,14 +34,17 @@ const InputEditor = memo<{ defaultRows?: number }>(({ defaultRows = 2 }) => {
|
|
|
32
34
|
]);
|
|
33
35
|
|
|
34
36
|
const storeApi = useStoreApi();
|
|
35
|
-
|
|
36
37
|
const state = useEditorState(editor);
|
|
38
|
+
const hotkey = useUserStore(settingsSelectors.getHotkeyById(HotkeyEnum.AddUserMessage));
|
|
37
39
|
const { enableScope, disableScope } = useHotkeysContext();
|
|
38
40
|
const { t } = useTranslation(['editor', 'chat']);
|
|
39
41
|
|
|
40
42
|
const isChineseInput = useRef(false);
|
|
41
43
|
|
|
42
44
|
const useCmdEnterToSend = useUserStore(preferenceSelectors.useCmdEnterToSend);
|
|
45
|
+
const wrapperShortcut = useCmdEnterToSend
|
|
46
|
+
? KeyEnum.Enter
|
|
47
|
+
: combineKeys([KeyEnum.Mod, KeyEnum.Enter]);
|
|
43
48
|
|
|
44
49
|
useEffect(() => {
|
|
45
50
|
const fn = (e: BeforeUnloadEvent) => {
|
|
@@ -91,16 +96,44 @@ const InputEditor = memo<{ defaultRows?: number }>(({ defaultRows = 2 }) => {
|
|
|
91
96
|
}}
|
|
92
97
|
onInit={(editor) => storeApi.setState({ editor })}
|
|
93
98
|
onPressEnter={({ event: e }) => {
|
|
94
|
-
if (e.
|
|
99
|
+
if (e.shiftKey || isChineseInput.current) return;
|
|
100
|
+
// when user like alt + enter to add ai message
|
|
101
|
+
if (e.altKey && hotkey === combineKeys([KeyEnum.Alt, KeyEnum.Enter])) return true;
|
|
95
102
|
const commandKey = isCommandPressed(e);
|
|
96
103
|
// when user like cmd + enter to send message
|
|
97
104
|
if (useCmdEnterToSend) {
|
|
98
|
-
if (commandKey)
|
|
105
|
+
if (commandKey) {
|
|
106
|
+
send();
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
99
109
|
} else {
|
|
100
|
-
if (!commandKey)
|
|
110
|
+
if (!commandKey) {
|
|
111
|
+
send();
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
101
114
|
}
|
|
102
115
|
}}
|
|
103
|
-
placeholder={
|
|
116
|
+
placeholder={
|
|
117
|
+
<Flexbox align={'center'} gap={4} horizontal>
|
|
118
|
+
{t('sendPlaceholder', { ns: 'chat' }).replace('...', ', ')}
|
|
119
|
+
<Trans
|
|
120
|
+
as={'div'}
|
|
121
|
+
components={{
|
|
122
|
+
key: (
|
|
123
|
+
<Hotkey
|
|
124
|
+
keys={wrapperShortcut}
|
|
125
|
+
style={{ color: 'inherit' }}
|
|
126
|
+
styles={{ kbdStyle: { color: 'inhert' } }}
|
|
127
|
+
variant={'borderless'}
|
|
128
|
+
/>
|
|
129
|
+
),
|
|
130
|
+
}}
|
|
131
|
+
i18nKey={'input.warpWithKey'}
|
|
132
|
+
ns={'chat'}
|
|
133
|
+
/>
|
|
134
|
+
{'...'}
|
|
135
|
+
</Flexbox>
|
|
136
|
+
}
|
|
104
137
|
plugins={[
|
|
105
138
|
ReactListPlugin,
|
|
106
139
|
ReactLinkPlugin,
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
SigmaIcon,
|
|
19
19
|
SquareDashedBottomCodeIcon,
|
|
20
20
|
StrikethroughIcon,
|
|
21
|
+
UnderlineIcon,
|
|
21
22
|
} from 'lucide-react';
|
|
22
23
|
import { memo } from 'react';
|
|
23
24
|
import { useTranslation } from 'react-i18next';
|
|
@@ -50,14 +51,13 @@ const TypoBar = memo(() => {
|
|
|
50
51
|
label: t('typobar.italic'),
|
|
51
52
|
onClick: editorState.italic,
|
|
52
53
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// },
|
|
54
|
+
{
|
|
55
|
+
active: editorState.isUnderline,
|
|
56
|
+
icon: UnderlineIcon,
|
|
57
|
+
key: 'underline',
|
|
58
|
+
label: t('typobar.underline'),
|
|
59
|
+
onClick: editorState.underline,
|
|
60
|
+
},
|
|
61
61
|
{
|
|
62
62
|
active: editorState.isStrikethrough,
|
|
63
63
|
icon: StrikethroughIcon,
|
|
@@ -18,12 +18,12 @@ import { useHotkeyById } from './useHotkeyById';
|
|
|
18
18
|
export const useSaveTopicHotkey = () => {
|
|
19
19
|
const openNewTopicOrSaveTopic = useChatStore((s) => s.openNewTopicOrSaveTopic);
|
|
20
20
|
const { mutate } = useActionSWR('openNewTopicOrSaveTopic', openNewTopicOrSaveTopic);
|
|
21
|
-
return useHotkeyById(HotkeyEnum.SaveTopic, () => mutate());
|
|
21
|
+
return useHotkeyById(HotkeyEnum.SaveTopic, () => mutate(), { enableOnContentEditable: true });
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
export const useToggleZenModeHotkey = () => {
|
|
25
25
|
const toggleZenMode = useGlobalStore((s) => s.toggleZenMode);
|
|
26
|
-
return useHotkeyById(HotkeyEnum.ToggleZenMode, toggleZenMode);
|
|
26
|
+
return useHotkeyById(HotkeyEnum.ToggleZenMode, toggleZenMode, { enableOnContentEditable: true });
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const useOpenChatSettingsHotkey = () => {
|
|
@@ -41,6 +41,7 @@ export const useRegenerateMessageHotkey = () => {
|
|
|
41
41
|
HotkeyEnum.RegenerateMessage,
|
|
42
42
|
() => !disable && regenerateMessage(lastMessage.id),
|
|
43
43
|
{
|
|
44
|
+
enableOnContentEditable: true,
|
|
44
45
|
enabled: !disable,
|
|
45
46
|
},
|
|
46
47
|
);
|
|
@@ -60,6 +61,7 @@ export const useToggleLeftPanelHotkey = () => {
|
|
|
60
61
|
showSessionPanel: !showSessionPanel,
|
|
61
62
|
}),
|
|
62
63
|
{
|
|
64
|
+
enableOnContentEditable: true,
|
|
63
65
|
enabled: !isZenMode && !isPinned,
|
|
64
66
|
},
|
|
65
67
|
);
|
|
@@ -70,20 +72,29 @@ export const useToggleRightPanelHotkey = () => {
|
|
|
70
72
|
const toggleConfig = useGlobalStore((s) => s.toggleChatSideBar);
|
|
71
73
|
|
|
72
74
|
return useHotkeyById(HotkeyEnum.ToggleRightPanel, () => toggleConfig(), {
|
|
75
|
+
enableOnContentEditable: true,
|
|
73
76
|
enabled: !isZenMode,
|
|
74
77
|
});
|
|
75
78
|
};
|
|
76
79
|
|
|
77
80
|
export const useAddUserMessageHotkey = () => {
|
|
78
81
|
const { send } = useSend();
|
|
79
|
-
return useHotkeyById(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
return useHotkeyById(
|
|
83
|
+
HotkeyEnum.AddUserMessage,
|
|
84
|
+
() => {
|
|
85
|
+
send({ onlyAddUserMessage: true });
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
enableOnContentEditable: true,
|
|
89
|
+
},
|
|
90
|
+
);
|
|
82
91
|
};
|
|
83
92
|
|
|
84
93
|
export const useClearCurrentMessagesHotkey = () => {
|
|
85
94
|
const clearCurrentMessages = useClearCurrentMessages();
|
|
86
|
-
return useHotkeyById(HotkeyEnum.ClearCurrentMessages, () => clearCurrentMessages()
|
|
95
|
+
return useHotkeyById(HotkeyEnum.ClearCurrentMessages, () => clearCurrentMessages(), {
|
|
96
|
+
enableOnContentEditable: true,
|
|
97
|
+
});
|
|
87
98
|
};
|
|
88
99
|
|
|
89
100
|
// 注册聚合
|
|
@@ -101,6 +101,7 @@ describe('AssistantStore', () => {
|
|
|
101
101
|
ok: true,
|
|
102
102
|
status: 200,
|
|
103
103
|
json: () => Promise.resolve({ ...mockAgents }),
|
|
104
|
+
clone: () => ({ json: () => Promise.resolve({ ...mockAgents }) }),
|
|
104
105
|
});
|
|
105
106
|
|
|
106
107
|
// @ts-expect-error
|
|
@@ -131,6 +132,7 @@ describe('AssistantStore', () => {
|
|
|
131
132
|
ok: true,
|
|
132
133
|
status: 200,
|
|
133
134
|
json: () => Promise.resolve({ ...mockAgents }),
|
|
135
|
+
clone: () => ({ json: () => Promise.resolve({ ...mockAgents }) }),
|
|
134
136
|
});
|
|
135
137
|
|
|
136
138
|
// @ts-expect-error
|
|
@@ -167,6 +169,7 @@ describe('AssistantStore', () => {
|
|
|
167
169
|
status: 200,
|
|
168
170
|
ok: true,
|
|
169
171
|
json: () => Promise.resolve({ ...mockAgents }),
|
|
172
|
+
clone: () => ({ json: () => Promise.resolve({ ...mockAgents }) }),
|
|
170
173
|
});
|
|
171
174
|
|
|
172
175
|
global.fetch = fetchMock as any;
|
|
@@ -26,9 +26,8 @@ export class AssistantStore {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
getAgentIndex = async (locale: Locales = DEFAULT_LANG): Promise<any[]> => {
|
|
29
|
+
let res: Response;
|
|
29
30
|
try {
|
|
30
|
-
let res: Response;
|
|
31
|
-
|
|
32
31
|
res = await fetch(this.getAgentIndexUrl(locale as any), {
|
|
33
32
|
cache: 'force-cache',
|
|
34
33
|
next: { revalidate: CacheRevalidate.List, tags: [CacheTag.Discover, CacheTag.Assistants] },
|
|
@@ -49,7 +48,7 @@ export class AssistantStore {
|
|
|
49
48
|
return [];
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
const data: any = await res.json();
|
|
51
|
+
const data: any = await res.clone().json();
|
|
53
52
|
|
|
54
53
|
if (EdgeConfig.isEnabled()) {
|
|
55
54
|
// Get the assistant whitelist from Edge Config
|
|
@@ -75,8 +74,11 @@ export class AssistantStore {
|
|
|
75
74
|
return [];
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
console.error(
|
|
77
|
+
console.error(`[AgentIndexFetchError] failed to fetch agent index, error detail:`);
|
|
79
78
|
console.error(e);
|
|
79
|
+
if (res!) {
|
|
80
|
+
console.error(`status code: ${res?.status}`, await res.text());
|
|
81
|
+
}
|
|
80
82
|
|
|
81
83
|
throw e;
|
|
82
84
|
}
|
package/src/services/discover.ts
CHANGED
|
@@ -55,12 +55,15 @@ class DiscoverService {
|
|
|
55
55
|
|
|
56
56
|
getAssistantList = async (params: AssistantQueryParams = {}): Promise<AssistantListResponse> => {
|
|
57
57
|
const locale = globalHelpers.getCurrentLanguage();
|
|
58
|
-
return lambdaClient.market.getAssistantList.query(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
return lambdaClient.market.getAssistantList.query(
|
|
59
|
+
{
|
|
60
|
+
...params,
|
|
61
|
+
locale,
|
|
62
|
+
page: params.page ? Number(params.page) : 1,
|
|
63
|
+
pageSize: params.pageSize ? Number(params.pageSize) : 20,
|
|
64
|
+
},
|
|
65
|
+
{ context: { showNotification: false } },
|
|
66
|
+
);
|
|
64
67
|
};
|
|
65
68
|
|
|
66
69
|
// ============================== MCP Market ==============================
|