@lobehub/lobehub 2.0.0-next.52 → 2.0.0-next.54

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 (39) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +8 -8
  3. package/README.zh-CN.md +8 -8
  4. package/apps/desktop/package.json +1 -1
  5. package/changelog/v1.json +21 -0
  6. package/package.json +2 -2
  7. package/packages/const/src/models.ts +2 -0
  8. package/packages/electron-server-ipc/src/ipcClient.ts +31 -31
  9. package/packages/electron-server-ipc/src/ipcServer.ts +15 -15
  10. package/packages/model-bank/src/aiModels/aihubmix.ts +106 -2
  11. package/packages/model-bank/src/aiModels/openai.ts +107 -3
  12. package/packages/model-bank/src/aiModels/qwen.ts +76 -7
  13. package/packages/model-bank/src/types/aiModel.ts +1 -0
  14. package/packages/types/src/agent/chatConfig.ts +9 -0
  15. package/src/app/[variants]/(main)/chat/components/WorkspaceLayout.tsx +32 -23
  16. package/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx +12 -0
  17. package/src/features/ChatInput/ActionBar/Model/GPT51ReasoningEffortSlider.tsx +58 -0
  18. package/src/features/ChatItem/components/MessageContent.tsx +3 -1
  19. package/src/features/Conversation/Messages/Assistant/index.tsx +7 -1
  20. package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/ApprovalActions.tsx +34 -13
  21. package/src/features/Conversation/Messages/User/index.tsx +11 -1
  22. package/src/libs/mcp/__tests__/__snapshots__/index.test.ts.snap +0 -6
  23. package/src/locales/default/chat.ts +2 -0
  24. package/src/locales/default/tool.ts +8 -0
  25. package/src/services/chat/index.ts +7 -0
  26. package/src/store/chat/slices/aiChat/actions/conversationControl.ts +42 -0
  27. package/src/store/chat/slices/builtinTool/actions/localSystem.ts +1 -1
  28. package/src/tools/interventions.ts +3 -5
  29. package/src/tools/local-system/Intervention/MoveLocalFiles/MoveFileItem.tsx +56 -0
  30. package/src/tools/local-system/Intervention/MoveLocalFiles/index.tsx +26 -0
  31. package/src/tools/local-system/Intervention/RunCommand/index.tsx +3 -5
  32. package/src/tools/local-system/Intervention/index.ts +11 -0
  33. package/src/tools/local-system/Render/MoveLocalFiles/MoveFileItem.tsx +56 -0
  34. package/src/tools/local-system/Render/MoveLocalFiles/index.tsx +26 -0
  35. package/src/tools/local-system/Render/ReadLocalFile/ReadFileView.tsx +2 -1
  36. package/src/tools/local-system/Render/index.ts +21 -0
  37. package/src/tools/local-system/index.ts +1 -0
  38. package/src/tools/renders.ts +6 -24
  39. package/src/tools/web-browsing/Render/index.ts +13 -0
@@ -17,6 +17,14 @@ export default {
17
17
  localFiles: {
18
18
  file: '文件',
19
19
  folder: '文件夹',
20
+ moveFiles: {
21
+ itemsMoved: '已移动 {{count}} 个项目:',
22
+ itemsMoved_one: '已移动 {{count}} 个项目:',
23
+ itemsMoved_other: '已移动 {{count}} 个项目:',
24
+ itemsToMove: '{{count}} 个项目待移动:',
25
+ itemsToMove_one: '{{count}} 个项目待移动:',
26
+ itemsToMove_other: '{{count}} 个项目待移动:',
27
+ },
20
28
  open: '打开',
21
29
  openFile: '打开文件',
22
30
  openFolder: '打开文件夹',
@@ -174,6 +174,13 @@ class ChatService {
174
174
  extendParams.reasoning_effort = chatConfig.gpt5ReasoningEffort;
175
175
  }
176
176
 
177
+ if (
178
+ modelExtendParams!.includes('gpt5_1ReasoningEffort') &&
179
+ chatConfig.gpt5_1ReasoningEffort
180
+ ) {
181
+ extendParams.reasoning_effort = chatConfig.gpt5_1ReasoningEffort;
182
+ }
183
+
177
184
  if (modelExtendParams!.includes('textVerbosity') && chatConfig.textVerbosity) {
178
185
  extendParams.verbosity = chatConfig.textVerbosity;
179
186
  }
@@ -43,6 +43,10 @@ export interface ConversationControlAction {
43
43
  * Reject tool intervention
44
44
  */
45
45
  rejectToolCalling: (messageId: string, reason?: string) => Promise<void>;
46
+ /**
47
+ * Reject tool intervention and continue
48
+ */
49
+ rejectAndContinueToolCalling: (messageId: string, reason?: string) => Promise<void>;
46
50
  /**
47
51
  * Toggle sendMessage operation state
48
52
  */
@@ -206,6 +210,44 @@ export const conversationControl: StateCreator<
206
210
  await get().optimisticUpdateMessageContent(messageId, toolContent);
207
211
  },
208
212
 
213
+ rejectAndContinueToolCalling: async (messageId, reason) => {
214
+ await get().rejectToolCalling(messageId, reason);
215
+
216
+ const toolMessage = dbMessageSelectors.getDbMessageById(messageId)(get());
217
+ if (!toolMessage) return;
218
+
219
+ // Get current messages for state construction
220
+ const currentMessages = displayMessageSelectors.mainAIChats(get());
221
+ const { activeThreadId, internal_execAgentRuntime } = get();
222
+
223
+ // Create agent state and context to continue from rejected tool message
224
+ const { state, context: initialContext } = get().internal_createAgentState({
225
+ messages: currentMessages,
226
+ parentMessageId: messageId,
227
+ threadId: activeThreadId,
228
+ });
229
+
230
+ // Override context with 'userInput' phase to continue as if user provided feedback
231
+ const context: AgentRuntimeContext = {
232
+ ...initialContext,
233
+ phase: 'user_input',
234
+ };
235
+
236
+ // Execute agent runtime from rejected tool message position to continue
237
+ try {
238
+ await internal_execAgentRuntime({
239
+ messages: currentMessages,
240
+ parentMessageId: messageId,
241
+ parentMessageType: 'tool',
242
+ threadId: activeThreadId,
243
+ initialState: state,
244
+ initialContext: context,
245
+ });
246
+ } catch (error) {
247
+ console.error('[rejectAndContinueToolCalling] Error executing agent runtime:', error);
248
+ }
249
+ },
250
+
209
251
  internal_updateSendMessageOperation: (key, value, actionName) => {
210
252
  const operationKey = typeof key === 'string' ? key : messageMapKey(key.sessionId, key.topicId);
211
253
 
@@ -252,7 +252,7 @@ export const localSystemSlice: StateCreator<
252
252
  if (result.shell_id) {
253
253
  message = `Command started in background with shell_id: ${result.shell_id}`;
254
254
  } else {
255
- message = `Command completed successfully. Exit code: ${result.exit_code}`;
255
+ message = `Command completed successfully.`;
256
256
  }
257
257
  } else {
258
258
  message = `Command failed: ${result.error}`;
@@ -1,7 +1,7 @@
1
1
  import { BuiltinIntervention } from '@lobechat/types';
2
2
 
3
- import { LocalSystemApiName, LocalSystemManifest } from './local-system';
4
- import RunCommand from './local-system/Intervention/RunCommand';
3
+ import { LocalSystemManifest } from './local-system';
4
+ import { LocalSystemInterventions } from './local-system/Intervention';
5
5
 
6
6
  /**
7
7
  * Builtin tools interventions registry
@@ -9,9 +9,7 @@ import RunCommand from './local-system/Intervention/RunCommand';
9
9
  * Only register APIs that have custom intervention UI
10
10
  */
11
11
  export const BuiltinToolInterventions: Record<string, Record<string, any>> = {
12
- [LocalSystemManifest.identifier]: {
13
- [LocalSystemApiName.runCommand]: RunCommand,
14
- },
12
+ [LocalSystemManifest.identifier]: LocalSystemInterventions,
15
13
  };
16
14
 
17
15
  /**
@@ -0,0 +1,56 @@
1
+ import { Icon, Text } from '@lobehub/ui';
2
+ import { createStyles } from 'antd-style';
3
+ import { ArrowRight } from 'lucide-react';
4
+ import { memo } from 'react';
5
+ import { Flexbox } from 'react-layout-kit';
6
+
7
+ import { useElectronStore } from '@/store/electron';
8
+ import { desktopStateSelectors } from '@/store/electron/selectors';
9
+
10
+ const useStyles = createStyles(({ css, token }) => ({
11
+ icon: css`
12
+ color: ${token.colorTextQuaternary};
13
+ `,
14
+ item: css`
15
+ padding-block: 4px;
16
+ padding-inline: 12px;
17
+ border-radius: ${token.borderRadius}px;
18
+ transition: all 0.2s ease;
19
+
20
+ &:hover {
21
+ background: ${token.colorFillQuaternary};
22
+ }
23
+ `,
24
+ path: css`
25
+ font-family: ${token.fontFamilyCode};
26
+ font-size: 12px;
27
+ word-break: break-all;
28
+ `,
29
+ }));
30
+
31
+ interface MoveFileItemProps {
32
+ newPath: string;
33
+ oldPath: string;
34
+ }
35
+
36
+ const MoveFileItem = memo<MoveFileItemProps>(({ oldPath, newPath }) => {
37
+ const { styles } = useStyles();
38
+ const displayOldPath = useElectronStore(desktopStateSelectors.displayRelativePath(oldPath));
39
+ const displayNewPath = useElectronStore(desktopStateSelectors.displayRelativePath(newPath));
40
+
41
+ return (
42
+ <Flexbox align="center" className={styles.item} gap={8} horizontal width="100%">
43
+ <Flexbox flex={1}>
44
+ <Text className={styles.path} type="secondary">
45
+ {displayOldPath}
46
+ </Text>
47
+ </Flexbox>
48
+ <Icon className={styles.icon} icon={ArrowRight} />
49
+ <Flexbox flex={2}>
50
+ <Text className={styles.path}>{displayNewPath}</Text>
51
+ </Flexbox>
52
+ </Flexbox>
53
+ );
54
+ });
55
+
56
+ export default MoveFileItem;
@@ -0,0 +1,26 @@
1
+ import { MoveLocalFilesParams } from '@lobechat/electron-client-ipc';
2
+ import { BuiltinInterventionProps } from '@lobechat/types';
3
+ import { Text } from '@lobehub/ui';
4
+ import { memo } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { Flexbox } from 'react-layout-kit';
7
+
8
+ import MoveFileItem from './MoveFileItem';
9
+
10
+ const MoveLocalFiles = memo<BuiltinInterventionProps<MoveLocalFilesParams>>(({ args }) => {
11
+ const { items } = args;
12
+ const { t } = useTranslation('tool');
13
+
14
+ return (
15
+ <Flexbox gap={8}>
16
+ <Text type="secondary">{t('localFiles.moveFiles.itemsToMove', { count: items.length })}</Text>
17
+ <Flexbox gap={6}>
18
+ {items.map((item, index) => (
19
+ <MoveFileItem key={index} newPath={item.newPath} oldPath={item.oldPath} />
20
+ ))}
21
+ </Flexbox>
22
+ </Flexbox>
23
+ );
24
+ });
25
+
26
+ export default MoveLocalFiles;
@@ -1,4 +1,5 @@
1
1
  import { RunCommandParams } from '@lobechat/electron-client-ipc';
2
+ import { BuiltinInterventionProps } from '@lobechat/types';
2
3
  import { Highlighter, Text } from '@lobehub/ui';
3
4
  import { memo } from 'react';
4
5
  import { Flexbox } from 'react-layout-kit';
@@ -23,11 +24,8 @@ const formatTimeout = (ms?: number) => {
23
24
  return `${ms}ms`;
24
25
  };
25
26
 
26
- interface RunCommandProps extends RunCommandParams {
27
- messageId: string;
28
- }
29
-
30
- const RunCommand = memo<RunCommandProps>(({ description, command, timeout }) => {
27
+ const RunCommand = memo<BuiltinInterventionProps<RunCommandParams>>(({ args }) => {
28
+ const { description, command, timeout } = args;
31
29
  return (
32
30
  <Flexbox gap={8}>
33
31
  <Flexbox horizontal justify={'space-between'}>
@@ -0,0 +1,11 @@
1
+ import { LocalSystemApiName } from '../index';
2
+ import MoveLocalFiles from './MoveLocalFiles';
3
+ import RunCommand from './RunCommand';
4
+
5
+ /**
6
+ * Local System Intervention Components Registry
7
+ */
8
+ export const LocalSystemInterventions = {
9
+ [LocalSystemApiName.moveLocalFiles]: MoveLocalFiles,
10
+ [LocalSystemApiName.runCommand]: RunCommand,
11
+ };
@@ -0,0 +1,56 @@
1
+ import { Icon, Text } from '@lobehub/ui';
2
+ import { createStyles } from 'antd-style';
3
+ import { ArrowRight } from 'lucide-react';
4
+ import { memo } from 'react';
5
+ import { Flexbox } from 'react-layout-kit';
6
+
7
+ import { useElectronStore } from '@/store/electron';
8
+ import { desktopStateSelectors } from '@/store/electron/selectors';
9
+
10
+ const useStyles = createStyles(({ css, token }) => ({
11
+ icon: css`
12
+ color: ${token.colorTextQuaternary};
13
+ `,
14
+ item: css`
15
+ padding-block: 4px;
16
+ padding-inline: 12px;
17
+ border-radius: ${token.borderRadius}px;
18
+ transition: all 0.2s ease;
19
+
20
+ &:hover {
21
+ background: ${token.colorFillQuaternary};
22
+ }
23
+ `,
24
+ path: css`
25
+ font-family: ${token.fontFamilyCode};
26
+ font-size: 12px;
27
+ word-break: break-all;
28
+ `,
29
+ }));
30
+
31
+ interface MoveFileItemProps {
32
+ newPath: string;
33
+ oldPath: string;
34
+ }
35
+
36
+ const MoveFileItem = memo<MoveFileItemProps>(({ oldPath, newPath }) => {
37
+ const { styles } = useStyles();
38
+ const displayOldPath = useElectronStore(desktopStateSelectors.displayRelativePath(oldPath));
39
+ const displayNewPath = useElectronStore(desktopStateSelectors.displayRelativePath(newPath));
40
+
41
+ return (
42
+ <Flexbox align="center" className={styles.item} gap={8} horizontal width="100%">
43
+ <Flexbox flex={1}>
44
+ <Text className={styles.path} type="secondary">
45
+ {displayOldPath}
46
+ </Text>
47
+ </Flexbox>
48
+ <Icon className={styles.icon} icon={ArrowRight} />
49
+ <Flexbox flex={2}>
50
+ <Text className={styles.path}>{displayNewPath}</Text>
51
+ </Flexbox>
52
+ </Flexbox>
53
+ );
54
+ });
55
+
56
+ export default MoveFileItem;
@@ -0,0 +1,26 @@
1
+ import { MoveLocalFilesParams } from '@lobechat/electron-client-ipc';
2
+ import { BuiltinRenderProps } from '@lobechat/types';
3
+ import { Text } from '@lobehub/ui';
4
+ import { memo } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { Flexbox } from 'react-layout-kit';
7
+
8
+ import MoveFileItem from './MoveFileItem';
9
+
10
+ const MoveLocalFiles = memo<BuiltinRenderProps<MoveLocalFilesParams>>(({ args }) => {
11
+ const { items } = args;
12
+ const { t } = useTranslation('tool');
13
+
14
+ return (
15
+ <Flexbox gap={8}>
16
+ <Text type="secondary">{t('localFiles.moveFiles.itemsMoved', { count: items.length })}</Text>
17
+ <Flexbox gap={6}>
18
+ {items.map((item, index) => (
19
+ <MoveFileItem key={index} newPath={item.newPath} oldPath={item.oldPath} />
20
+ ))}
21
+ </Flexbox>
22
+ </Flexbox>
23
+ );
24
+ });
25
+
26
+ export default MoveLocalFiles;
@@ -26,9 +26,10 @@ const useStyles = createStyles(({ css, token, cx }) => ({
26
26
 
27
27
  height: 64px;
28
28
  padding: 8px;
29
- border: 1px solid ${token.colorBorderSecondary};
30
29
  border-radius: ${token.borderRadiusLG}px;
31
30
 
31
+ background: ${token.colorFillQuaternary};
32
+
32
33
  transition: all 0.2s ${token.motionEaseInOut};
33
34
 
34
35
  .local-file-actions {
@@ -0,0 +1,21 @@
1
+ import { LocalSystemApiName } from '../index';
2
+ import ListFiles from './ListFiles';
3
+ import MoveLocalFiles from './MoveLocalFiles';
4
+ import ReadLocalFile from './ReadLocalFile';
5
+ import RenameLocalFile from './RenameLocalFile';
6
+ import RunCommand from './RunCommand';
7
+ import SearchFiles from './SearchFiles';
8
+ import WriteFile from './WriteFile';
9
+
10
+ /**
11
+ * Local System Render Components Registry
12
+ */
13
+ export const LocalSystemRenders = {
14
+ [LocalSystemApiName.listLocalFiles]: ListFiles,
15
+ [LocalSystemApiName.moveLocalFiles]: MoveLocalFiles,
16
+ [LocalSystemApiName.readLocalFile]: ReadLocalFile,
17
+ [LocalSystemApiName.renameLocalFile]: RenameLocalFile,
18
+ [LocalSystemApiName.runCommand]: RunCommand,
19
+ [LocalSystemApiName.searchLocalFiles]: SearchFiles,
20
+ [LocalSystemApiName.writeLocalFile]: WriteFile,
21
+ };
@@ -186,6 +186,7 @@ export const LocalSystemManifest: BuiltinToolManifest = {
186
186
  {
187
187
  description:
188
188
  'Write content to a specific file. Input should be the file path and content. Overwrites existing file or creates a new one.',
189
+ humanIntervention: 'required',
189
190
  name: LocalSystemApiName.writeLocalFile,
190
191
  parameters: {
191
192
  properties: {
@@ -3,37 +3,19 @@ import { BuiltinRender } from '@lobechat/types';
3
3
  import { CodeInterpreterManifest } from './code-interpreter';
4
4
  import CodeInterpreterRender from './code-interpreter/Render';
5
5
  // local-system
6
- import { LocalSystemApiName, LocalSystemManifest } from './local-system';
7
- import ListFiles from './local-system/Render/ListFiles';
8
- import ReadLocalFile from './local-system/Render/ReadLocalFile';
9
- import RenameLocalFile from './local-system/Render/RenameLocalFile';
10
- import RunCommand from './local-system/Render/RunCommand';
11
- import SearchFiles from './local-system/Render/SearchFiles';
12
- import WriteFile from './local-system/Render/WriteFile';
6
+ import { LocalSystemManifest } from './local-system';
7
+ import { LocalSystemRenders } from './local-system/Render';
13
8
  // web-browsing
14
- import { WebBrowsingApiName, WebBrowsingManifest } from './web-browsing';
15
- import CrawlMultiPages from './web-browsing/Render/CrawlMultiPages';
16
- import CrawlSinglePage from './web-browsing/Render/CrawlSinglePage';
17
- import Search from './web-browsing/Render/Search';
9
+ import { WebBrowsingManifest } from './web-browsing';
10
+ import { WebBrowsingRenders } from './web-browsing/Render';
18
11
 
19
12
  /**
20
13
  * Builtin tools renders registry
21
14
  * Organized by toolset (identifier) -> API name
22
15
  */
23
16
  const BuiltinToolsRenders: Record<string, Record<string, BuiltinRender>> = {
24
- [LocalSystemManifest.identifier]: {
25
- [LocalSystemApiName.searchLocalFiles]: SearchFiles as BuiltinRender,
26
- [LocalSystemApiName.listLocalFiles]: ListFiles as BuiltinRender,
27
- [LocalSystemApiName.readLocalFile]: ReadLocalFile as BuiltinRender,
28
- [LocalSystemApiName.renameLocalFile]: RenameLocalFile as BuiltinRender,
29
- [LocalSystemApiName.writeLocalFile]: WriteFile as BuiltinRender,
30
- [LocalSystemApiName.runCommand]: RunCommand as BuiltinRender,
31
- },
32
- [WebBrowsingManifest.identifier]: {
33
- [WebBrowsingApiName.search]: Search as BuiltinRender,
34
- [WebBrowsingApiName.crawlSinglePage]: CrawlSinglePage as BuiltinRender,
35
- [WebBrowsingApiName.crawlMultiPages]: CrawlMultiPages as BuiltinRender,
36
- },
17
+ [LocalSystemManifest.identifier]: LocalSystemRenders as Record<string, BuiltinRender>,
18
+ [WebBrowsingManifest.identifier]: WebBrowsingRenders as Record<string, BuiltinRender>,
37
19
  [CodeInterpreterManifest.identifier]: {
38
20
  python: CodeInterpreterRender as BuiltinRender,
39
21
  },
@@ -0,0 +1,13 @@
1
+ import { WebBrowsingApiName } from '../index';
2
+ import CrawlMultiPages from './CrawlMultiPages';
3
+ import CrawlSinglePage from './CrawlSinglePage';
4
+ import Search from './Search';
5
+
6
+ /**
7
+ * Web Browsing Render Components Registry
8
+ */
9
+ export const WebBrowsingRenders = {
10
+ [WebBrowsingApiName.crawlMultiPages]: CrawlMultiPages,
11
+ [WebBrowsingApiName.crawlSinglePage]: CrawlSinglePage,
12
+ [WebBrowsingApiName.search]: Search,
13
+ };