@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.
Files changed (147) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +1 -1
  3. package/README.zh-CN.md +1 -1
  4. package/changelog/v1.json +18 -0
  5. package/docs/developer/database-schema.dbml +1 -0
  6. package/docs/self-hosting/advanced/model-list.mdx +5 -3
  7. package/docs/self-hosting/advanced/model-list.zh-CN.mdx +5 -3
  8. package/docs/usage/providers/infiniai.zh-CN.mdx +4 -0
  9. package/locales/ar/hotkey.json +46 -0
  10. package/locales/ar/models.json +51 -54
  11. package/locales/ar/providers.json +3 -0
  12. package/locales/ar/setting.json +12 -0
  13. package/locales/bg-BG/hotkey.json +46 -0
  14. package/locales/bg-BG/models.json +51 -54
  15. package/locales/bg-BG/providers.json +3 -0
  16. package/locales/bg-BG/setting.json +12 -0
  17. package/locales/de-DE/hotkey.json +46 -0
  18. package/locales/de-DE/models.json +51 -54
  19. package/locales/de-DE/providers.json +3 -0
  20. package/locales/de-DE/setting.json +12 -0
  21. package/locales/en-US/hotkey.json +46 -0
  22. package/locales/en-US/models.json +51 -54
  23. package/locales/en-US/providers.json +3 -0
  24. package/locales/en-US/setting.json +12 -0
  25. package/locales/es-ES/hotkey.json +46 -0
  26. package/locales/es-ES/models.json +51 -54
  27. package/locales/es-ES/providers.json +3 -0
  28. package/locales/es-ES/setting.json +12 -0
  29. package/locales/fa-IR/hotkey.json +46 -0
  30. package/locales/fa-IR/models.json +51 -54
  31. package/locales/fa-IR/providers.json +3 -0
  32. package/locales/fa-IR/setting.json +12 -0
  33. package/locales/fr-FR/hotkey.json +46 -0
  34. package/locales/fr-FR/models.json +51 -54
  35. package/locales/fr-FR/providers.json +3 -0
  36. package/locales/fr-FR/setting.json +12 -0
  37. package/locales/it-IT/hotkey.json +46 -0
  38. package/locales/it-IT/models.json +51 -54
  39. package/locales/it-IT/providers.json +3 -0
  40. package/locales/it-IT/setting.json +12 -0
  41. package/locales/ja-JP/hotkey.json +46 -0
  42. package/locales/ja-JP/models.json +51 -54
  43. package/locales/ja-JP/providers.json +3 -0
  44. package/locales/ja-JP/setting.json +12 -0
  45. package/locales/ko-KR/hotkey.json +46 -0
  46. package/locales/ko-KR/models.json +51 -54
  47. package/locales/ko-KR/providers.json +3 -0
  48. package/locales/ko-KR/setting.json +12 -0
  49. package/locales/nl-NL/hotkey.json +46 -0
  50. package/locales/nl-NL/models.json +51 -54
  51. package/locales/nl-NL/providers.json +3 -0
  52. package/locales/nl-NL/setting.json +12 -0
  53. package/locales/pl-PL/hotkey.json +46 -0
  54. package/locales/pl-PL/models.json +51 -54
  55. package/locales/pl-PL/providers.json +3 -0
  56. package/locales/pl-PL/setting.json +12 -0
  57. package/locales/pt-BR/hotkey.json +46 -0
  58. package/locales/pt-BR/models.json +51 -54
  59. package/locales/pt-BR/providers.json +3 -0
  60. package/locales/pt-BR/setting.json +12 -0
  61. package/locales/ru-RU/hotkey.json +46 -0
  62. package/locales/ru-RU/models.json +51 -54
  63. package/locales/ru-RU/providers.json +3 -0
  64. package/locales/ru-RU/setting.json +12 -0
  65. package/locales/tr-TR/hotkey.json +46 -0
  66. package/locales/tr-TR/models.json +51 -54
  67. package/locales/tr-TR/providers.json +3 -0
  68. package/locales/tr-TR/setting.json +12 -0
  69. package/locales/vi-VN/hotkey.json +46 -0
  70. package/locales/vi-VN/models.json +51 -54
  71. package/locales/vi-VN/providers.json +3 -0
  72. package/locales/vi-VN/setting.json +12 -0
  73. package/locales/zh-CN/hotkey.json +46 -0
  74. package/locales/zh-CN/models.json +55 -58
  75. package/locales/zh-CN/providers.json +3 -0
  76. package/locales/zh-CN/setting.json +12 -0
  77. package/locales/zh-TW/hotkey.json +46 -0
  78. package/locales/zh-TW/models.json +51 -54
  79. package/locales/zh-TW/providers.json +3 -0
  80. package/locales/zh-TW/setting.json +12 -0
  81. package/package.json +3 -3
  82. package/src/app/[variants]/(main)/(mobile)/me/(home)/features/Category.tsx +1 -1
  83. package/src/app/[variants]/(main)/(mobile)/me/(home)/layout.tsx +3 -2
  84. package/src/app/[variants]/(main)/(mobile)/me/data/features/Category.tsx +1 -1
  85. package/src/app/[variants]/(main)/(mobile)/me/profile/features/Category.tsx +1 -1
  86. package/src/app/[variants]/(main)/(mobile)/me/settings/features/Category.tsx +1 -1
  87. package/src/app/[variants]/(main)/_layout/Desktop/RegisterHotkeys.tsx +11 -0
  88. package/src/app/[variants]/(main)/_layout/Desktop/SideBar/PinList/index.tsx +6 -23
  89. package/src/app/[variants]/(main)/_layout/Desktop/SideBar/TopActions.test.tsx +2 -0
  90. package/src/app/[variants]/(main)/_layout/Desktop/index.tsx +11 -4
  91. package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/SendMore.tsx +6 -21
  92. package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/ShortcutHint.tsx +13 -34
  93. package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/index.tsx +1 -1
  94. package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ZenModeToast/Toast.tsx +7 -4
  95. package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/HeaderAction.tsx +12 -8
  96. package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Main.tsx +24 -30
  97. package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/index.tsx +0 -2
  98. package/src/app/[variants]/(main)/chat/(workspace)/features/SettingButton.tsx +12 -7
  99. package/src/app/[variants]/(main)/chat/@session/features/SessionSearchBar.tsx +5 -1
  100. package/src/app/[variants]/(main)/chat/_layout/Desktop/RegisterHotkeys.tsx +10 -0
  101. package/src/app/[variants]/(main)/chat/_layout/Desktop/index.tsx +5 -0
  102. package/src/app/[variants]/(main)/chat/_layout/Mobile.tsx +1 -1
  103. package/src/app/[variants]/(main)/discover/features/StoreSearchBar.tsx +5 -1
  104. package/src/app/[variants]/(main)/settings/hooks/useCategory.tsx +31 -21
  105. package/src/app/[variants]/(main)/settings/hotkey/features/HotkeySetting.tsx +80 -0
  106. package/src/app/[variants]/(main)/settings/hotkey/index.tsx +9 -0
  107. package/src/app/[variants]/(main)/settings/hotkey/page.tsx +15 -0
  108. package/src/app/[variants]/layout.tsx +16 -13
  109. package/src/config/aiModels/infiniai.ts +52 -55
  110. package/src/config/aiModels/siliconcloud.ts +17 -1
  111. package/src/config/aiModels/tencentcloud.ts +17 -0
  112. package/src/const/hotkeys.ts +80 -10
  113. package/src/const/settings/hotkey.ts +10 -0
  114. package/src/const/settings/index.ts +3 -0
  115. package/src/database/client/migrations.json +46 -32
  116. package/src/database/migrations/0019_add_hotkey_user_settings.sql +2 -0
  117. package/src/database/migrations/meta/0019_snapshot.json +4218 -0
  118. package/src/database/migrations/meta/_journal.json +7 -0
  119. package/src/database/schemas/user.ts +1 -0
  120. package/src/database/server/models/user.ts +2 -0
  121. package/src/features/ChatInput/Desktop/InputArea/index.tsx +8 -0
  122. package/src/features/ChatInput/Desktop/index.tsx +0 -1
  123. package/src/features/ChatInput/Topic/index.tsx +10 -15
  124. package/src/features/FileManager/Header/FilesSearchBar.tsx +6 -2
  125. package/src/features/HotkeyHelperPanel/HotkeyContent.tsx +62 -0
  126. package/src/features/HotkeyHelperPanel/index.tsx +59 -0
  127. package/src/hooks/useHotkeys/chatScope.ts +105 -0
  128. package/src/hooks/useHotkeys/globalScope.ts +69 -0
  129. package/src/hooks/useHotkeys/index.ts +2 -0
  130. package/src/hooks/useHotkeys/useHotkeyById.test.ts +194 -0
  131. package/src/hooks/useHotkeys/useHotkeyById.ts +57 -0
  132. package/src/libs/agent-runtime/infiniai/index.ts +38 -3
  133. package/src/locales/default/hotkey.ts +50 -0
  134. package/src/locales/default/index.ts +2 -0
  135. package/src/locales/default/setting.ts +12 -0
  136. package/src/store/global/initialState.ts +3 -0
  137. package/src/store/user/slices/settings/selectors/__snapshots__/settings.test.ts.snap +79 -0
  138. package/src/store/user/slices/settings/selectors/settings.test.ts +131 -0
  139. package/src/store/user/slices/settings/selectors/settings.ts +6 -0
  140. package/src/types/hotkey.ts +59 -0
  141. package/src/types/user/settings/hotkey.ts +3 -0
  142. package/src/types/user/settings/index.ts +3 -0
  143. package/src/utils/format.ts +1 -1
  144. package/src/utils/parseModels.test.ts +14 -0
  145. package/src/utils/parseModels.ts +4 -0
  146. package/src/app/[variants]/(main)/chat/(workspace)/_layout/Desktop/HotKeys.tsx +0 -44
  147. 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;