@lobehub/chat 1.75.4 → 1.76.0
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 +52 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/changelog/v1.json +18 -0
- package/docs/developer/database-schema.dbml +1 -0
- package/docs/self-hosting/advanced/model-list.mdx +5 -3
- package/docs/self-hosting/advanced/model-list.zh-CN.mdx +5 -3
- package/docs/usage/providers/infiniai.zh-CN.mdx +4 -0
- package/locales/ar/hotkey.json +46 -0
- package/locales/ar/models.json +51 -54
- package/locales/ar/providers.json +3 -0
- package/locales/ar/setting.json +12 -0
- package/locales/bg-BG/hotkey.json +46 -0
- package/locales/bg-BG/models.json +51 -54
- package/locales/bg-BG/providers.json +3 -0
- package/locales/bg-BG/setting.json +12 -0
- package/locales/de-DE/hotkey.json +46 -0
- package/locales/de-DE/models.json +51 -54
- package/locales/de-DE/providers.json +3 -0
- package/locales/de-DE/setting.json +12 -0
- package/locales/en-US/hotkey.json +46 -0
- package/locales/en-US/models.json +51 -54
- package/locales/en-US/providers.json +3 -0
- package/locales/en-US/setting.json +12 -0
- package/locales/es-ES/hotkey.json +46 -0
- package/locales/es-ES/models.json +51 -54
- package/locales/es-ES/providers.json +3 -0
- package/locales/es-ES/setting.json +12 -0
- package/locales/fa-IR/hotkey.json +46 -0
- package/locales/fa-IR/models.json +51 -54
- package/locales/fa-IR/providers.json +3 -0
- package/locales/fa-IR/setting.json +12 -0
- package/locales/fr-FR/hotkey.json +46 -0
- package/locales/fr-FR/models.json +51 -54
- package/locales/fr-FR/providers.json +3 -0
- package/locales/fr-FR/setting.json +12 -0
- package/locales/it-IT/hotkey.json +46 -0
- package/locales/it-IT/models.json +51 -54
- package/locales/it-IT/providers.json +3 -0
- package/locales/it-IT/setting.json +12 -0
- package/locales/ja-JP/hotkey.json +46 -0
- package/locales/ja-JP/models.json +51 -54
- package/locales/ja-JP/providers.json +3 -0
- package/locales/ja-JP/setting.json +12 -0
- package/locales/ko-KR/hotkey.json +46 -0
- package/locales/ko-KR/models.json +51 -54
- package/locales/ko-KR/providers.json +3 -0
- package/locales/ko-KR/setting.json +12 -0
- package/locales/nl-NL/hotkey.json +46 -0
- package/locales/nl-NL/models.json +51 -54
- package/locales/nl-NL/providers.json +3 -0
- package/locales/nl-NL/setting.json +12 -0
- package/locales/pl-PL/hotkey.json +46 -0
- package/locales/pl-PL/models.json +51 -54
- package/locales/pl-PL/providers.json +3 -0
- package/locales/pl-PL/setting.json +12 -0
- package/locales/pt-BR/hotkey.json +46 -0
- package/locales/pt-BR/models.json +51 -54
- package/locales/pt-BR/providers.json +3 -0
- package/locales/pt-BR/setting.json +12 -0
- package/locales/ru-RU/hotkey.json +46 -0
- package/locales/ru-RU/models.json +51 -54
- package/locales/ru-RU/providers.json +3 -0
- package/locales/ru-RU/setting.json +12 -0
- package/locales/tr-TR/hotkey.json +46 -0
- package/locales/tr-TR/models.json +51 -54
- package/locales/tr-TR/providers.json +3 -0
- package/locales/tr-TR/setting.json +12 -0
- package/locales/vi-VN/hotkey.json +46 -0
- package/locales/vi-VN/models.json +51 -54
- package/locales/vi-VN/providers.json +3 -0
- package/locales/vi-VN/setting.json +12 -0
- package/locales/zh-CN/hotkey.json +46 -0
- package/locales/zh-CN/models.json +55 -58
- package/locales/zh-CN/providers.json +3 -0
- package/locales/zh-CN/setting.json +12 -0
- package/locales/zh-TW/hotkey.json +46 -0
- package/locales/zh-TW/models.json +51 -54
- package/locales/zh-TW/providers.json +3 -0
- package/locales/zh-TW/setting.json +12 -0
- package/package.json +3 -3
- package/src/app/[variants]/(main)/(mobile)/me/(home)/features/Category.tsx +1 -1
- package/src/app/[variants]/(main)/(mobile)/me/(home)/layout.tsx +3 -2
- package/src/app/[variants]/(main)/(mobile)/me/data/features/Category.tsx +1 -1
- package/src/app/[variants]/(main)/(mobile)/me/profile/features/Category.tsx +1 -1
- package/src/app/[variants]/(main)/(mobile)/me/settings/features/Category.tsx +1 -1
- package/src/app/[variants]/(main)/_layout/Desktop/RegisterHotkeys.tsx +11 -0
- package/src/app/[variants]/(main)/_layout/Desktop/SideBar/PinList/index.tsx +6 -23
- package/src/app/[variants]/(main)/_layout/Desktop/SideBar/TopActions.test.tsx +2 -0
- package/src/app/[variants]/(main)/_layout/Desktop/index.tsx +11 -4
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/SendMore.tsx +6 -21
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/ShortcutHint.tsx +13 -34
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/index.tsx +1 -1
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ZenModeToast/Toast.tsx +7 -4
- package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/HeaderAction.tsx +12 -8
- package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Main.tsx +24 -30
- package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/index.tsx +0 -2
- package/src/app/[variants]/(main)/chat/(workspace)/features/SettingButton.tsx +12 -7
- package/src/app/[variants]/(main)/chat/@session/features/SessionSearchBar.tsx +5 -1
- package/src/app/[variants]/(main)/chat/_layout/Desktop/RegisterHotkeys.tsx +10 -0
- package/src/app/[variants]/(main)/chat/_layout/Desktop/index.tsx +5 -0
- package/src/app/[variants]/(main)/chat/_layout/Mobile.tsx +1 -1
- package/src/app/[variants]/(main)/discover/features/StoreSearchBar.tsx +5 -1
- package/src/app/[variants]/(main)/settings/hooks/useCategory.tsx +31 -21
- package/src/app/[variants]/(main)/settings/hotkey/features/HotkeySetting.tsx +80 -0
- package/src/app/[variants]/(main)/settings/hotkey/index.tsx +9 -0
- package/src/app/[variants]/(main)/settings/hotkey/page.tsx +15 -0
- package/src/app/[variants]/layout.tsx +16 -13
- package/src/config/aiModels/infiniai.ts +52 -55
- package/src/config/aiModels/siliconcloud.ts +17 -1
- package/src/config/aiModels/tencentcloud.ts +17 -0
- package/src/const/hotkeys.ts +80 -10
- package/src/const/settings/hotkey.ts +10 -0
- package/src/const/settings/index.ts +3 -0
- package/src/database/client/migrations.json +46 -32
- package/src/database/migrations/0019_add_hotkey_user_settings.sql +2 -0
- package/src/database/migrations/meta/0019_snapshot.json +4218 -0
- package/src/database/migrations/meta/_journal.json +7 -0
- package/src/database/schemas/user.ts +1 -0
- package/src/database/server/models/user.ts +2 -0
- package/src/features/ChatInput/Desktop/InputArea/index.tsx +8 -0
- package/src/features/ChatInput/Desktop/index.tsx +0 -1
- package/src/features/ChatInput/Topic/index.tsx +10 -15
- package/src/features/FileManager/Header/FilesSearchBar.tsx +6 -2
- package/src/features/HotkeyHelperPanel/HotkeyContent.tsx +62 -0
- package/src/features/HotkeyHelperPanel/index.tsx +59 -0
- package/src/hooks/useHotkeys/chatScope.ts +105 -0
- package/src/hooks/useHotkeys/globalScope.ts +69 -0
- package/src/hooks/useHotkeys/index.ts +2 -0
- package/src/hooks/useHotkeys/useHotkeyById.test.ts +194 -0
- package/src/hooks/useHotkeys/useHotkeyById.ts +57 -0
- package/src/libs/agent-runtime/infiniai/index.ts +38 -3
- package/src/locales/default/hotkey.ts +50 -0
- package/src/locales/default/index.ts +2 -0
- package/src/locales/default/setting.ts +12 -0
- package/src/store/global/initialState.ts +3 -0
- package/src/store/user/slices/settings/selectors/__snapshots__/settings.test.ts.snap +79 -0
- package/src/store/user/slices/settings/selectors/settings.test.ts +131 -0
- package/src/store/user/slices/settings/selectors/settings.ts +6 -0
- package/src/types/hotkey.ts +59 -0
- package/src/types/user/settings/hotkey.ts +3 -0
- package/src/types/user/settings/index.ts +3 -0
- package/src/utils/format.ts +1 -1
- package/src/utils/parseModels.test.ts +14 -0
- package/src/utils/parseModels.ts +4 -0
- package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/HotKeys.tsx +0 -44
- package/src/components/HotKeys/index.tsx +0 -77
@@ -1,77 +0,0 @@
|
|
1
|
-
'use client';
|
2
|
-
|
3
|
-
import { Icon } from '@lobehub/ui';
|
4
|
-
import { createStyles } from 'antd-style';
|
5
|
-
import { isString } from 'lodash-es';
|
6
|
-
import { Command, Delete, Option } from 'lucide-react';
|
7
|
-
import { rgba } from 'polished';
|
8
|
-
import { memo, useEffect, useState } from 'react';
|
9
|
-
import { Flexbox } from 'react-layout-kit';
|
10
|
-
|
11
|
-
import { ALT_KEY, CLEAN_MESSAGE_KEY, META_KEY } from '@/const/hotkeys';
|
12
|
-
import { usePlatform } from '@/hooks/usePlatform';
|
13
|
-
|
14
|
-
const useStyles = createStyles(
|
15
|
-
({ css, token }, inverseTheme: boolean) => css`
|
16
|
-
font-size: 12px;
|
17
|
-
|
18
|
-
kbd {
|
19
|
-
min-width: 16px;
|
20
|
-
height: 22px;
|
21
|
-
padding-inline: 8px;
|
22
|
-
border-radius: ${token.borderRadius}px;
|
23
|
-
|
24
|
-
line-height: 22px;
|
25
|
-
color: ${inverseTheme ? token.colorTextTertiary : token.colorTextSecondary};
|
26
|
-
text-align: center;
|
27
|
-
|
28
|
-
background: ${inverseTheme ? rgba(token.colorTextTertiary, 0.15) : token.colorFillTertiary};
|
29
|
-
}
|
30
|
-
`,
|
31
|
-
);
|
32
|
-
|
33
|
-
export interface HotKeysProps {
|
34
|
-
desc?: string;
|
35
|
-
inverseTheme?: boolean;
|
36
|
-
keys: string;
|
37
|
-
}
|
38
|
-
|
39
|
-
const HotKeys = memo<HotKeysProps>(({ keys, desc, inverseTheme }) => {
|
40
|
-
const { styles } = useStyles(inverseTheme);
|
41
|
-
const [keysGroup, setKeysGroup] = useState(keys.split('+'));
|
42
|
-
const visibility = typeof window === 'undefined' ? 'hidden' : 'visible';
|
43
|
-
const { isApple } = usePlatform();
|
44
|
-
|
45
|
-
useEffect(() => {
|
46
|
-
const mapping: Record<string, any> = {
|
47
|
-
[ALT_KEY]: isApple ? <Icon icon={Option} /> : 'alt',
|
48
|
-
[CLEAN_MESSAGE_KEY]: isApple ? <Icon icon={Delete} /> : 'backspace',
|
49
|
-
[META_KEY]: isApple ? <Icon icon={Command} /> : 'ctrl',
|
50
|
-
};
|
51
|
-
const newValue = keys
|
52
|
-
.split('+')
|
53
|
-
.filter(Boolean)
|
54
|
-
.map((k) => mapping[k] ?? k);
|
55
|
-
setKeysGroup(newValue);
|
56
|
-
}, [keys]);
|
57
|
-
|
58
|
-
const content = (
|
59
|
-
<Flexbox align={'center'} className={styles} gap={4} horizontal>
|
60
|
-
{keysGroup.map((key, index) => (
|
61
|
-
<kbd key={index}>
|
62
|
-
<span style={{ visibility }}>{isString(key) ? key.toUpperCase() : key}</span>
|
63
|
-
</kbd>
|
64
|
-
))}
|
65
|
-
</Flexbox>
|
66
|
-
);
|
67
|
-
|
68
|
-
if (!desc) return content;
|
69
|
-
return (
|
70
|
-
<Flexbox gap={16} horizontal>
|
71
|
-
{desc}
|
72
|
-
{content}
|
73
|
-
</Flexbox>
|
74
|
-
);
|
75
|
-
});
|
76
|
-
|
77
|
-
export default HotKeys;
|