@opensumi/ide-ai-native 3.8.3-next-1741949132.0 → 3.8.3-next-1742180589.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 (84) hide show
  1. package/lib/browser/chat/chat-manager.service.d.ts +1 -1
  2. package/lib/browser/chat/chat-manager.service.d.ts.map +1 -1
  3. package/lib/browser/chat/chat-manager.service.js +2 -3
  4. package/lib/browser/chat/chat-manager.service.js.map +1 -1
  5. package/lib/browser/chat/chat-model.d.ts.map +1 -1
  6. package/lib/browser/chat/chat-model.js +2 -11
  7. package/lib/browser/chat/chat-model.js.map +1 -1
  8. package/lib/browser/chat/chat-proxy.service.d.ts.map +1 -1
  9. package/lib/browser/chat/chat-proxy.service.js +0 -1
  10. package/lib/browser/chat/chat-proxy.service.js.map +1 -1
  11. package/lib/browser/chat/chat.feature.registry.d.ts +1 -4
  12. package/lib/browser/chat/chat.feature.registry.d.ts.map +1 -1
  13. package/lib/browser/chat/chat.feature.registry.js +0 -6
  14. package/lib/browser/chat/chat.feature.registry.js.map +1 -1
  15. package/lib/browser/chat/chat.internal.service.d.ts +1 -1
  16. package/lib/browser/chat/chat.internal.service.d.ts.map +1 -1
  17. package/lib/browser/chat/chat.internal.service.js +2 -2
  18. package/lib/browser/chat/chat.internal.service.js.map +1 -1
  19. package/lib/browser/chat/chat.view.d.ts.map +1 -1
  20. package/lib/browser/chat/chat.view.js +7 -10
  21. package/lib/browser/chat/chat.view.js.map +1 -1
  22. package/lib/browser/components/ChatEditor.d.ts +1 -2
  23. package/lib/browser/components/ChatEditor.d.ts.map +1 -1
  24. package/lib/browser/components/ChatEditor.js +2 -5
  25. package/lib/browser/components/ChatEditor.js.map +1 -1
  26. package/lib/browser/components/ChatInput.d.ts +1 -1
  27. package/lib/browser/components/ChatInput.d.ts.map +1 -1
  28. package/lib/browser/components/ChatInput.js +1 -1
  29. package/lib/browser/components/ChatInput.js.map +1 -1
  30. package/lib/browser/components/ChatMentionInput.d.ts +1 -3
  31. package/lib/browser/components/ChatMentionInput.d.ts.map +1 -1
  32. package/lib/browser/components/ChatMentionInput.js +3 -51
  33. package/lib/browser/components/ChatMentionInput.js.map +1 -1
  34. package/lib/browser/components/components.module.less +0 -49
  35. package/lib/browser/components/mention-input/mention-input.d.ts.map +1 -1
  36. package/lib/browser/components/mention-input/mention-input.js +3 -17
  37. package/lib/browser/components/mention-input/mention-input.js.map +1 -1
  38. package/lib/browser/components/mention-input/mention-input.module.less +0 -1
  39. package/lib/browser/components/mention-input/types.d.ts +1 -3
  40. package/lib/browser/components/mention-input/types.d.ts.map +1 -1
  41. package/lib/browser/components/mention-input/types.js.map +1 -1
  42. package/lib/browser/context/llm-context.service.d.ts.map +1 -1
  43. package/lib/browser/context/llm-context.service.js.map +1 -1
  44. package/lib/browser/mcp/config/components/mcp-config.view.d.ts.map +1 -1
  45. package/lib/browser/mcp/config/components/mcp-config.view.js +17 -3
  46. package/lib/browser/mcp/config/components/mcp-config.view.js.map +1 -1
  47. package/lib/browser/mcp/mcp-server-proxy.service.d.ts +1 -0
  48. package/lib/browser/mcp/mcp-server-proxy.service.d.ts.map +1 -1
  49. package/lib/browser/model/msg-history-manager.d.ts +1 -1
  50. package/lib/browser/model/msg-history-manager.d.ts.map +1 -1
  51. package/lib/browser/model/msg-history-manager.js.map +1 -1
  52. package/lib/browser/types.d.ts +1 -7
  53. package/lib/browser/types.d.ts.map +1 -1
  54. package/lib/browser/types.js.map +1 -1
  55. package/lib/common/index.d.ts +1 -6
  56. package/lib/common/index.d.ts.map +1 -1
  57. package/lib/common/index.js.map +1 -1
  58. package/lib/common/llm-context.d.ts.map +1 -1
  59. package/lib/common/llm-context.js.map +1 -1
  60. package/lib/node/base-language-model.d.ts +1 -1
  61. package/lib/node/base-language-model.d.ts.map +1 -1
  62. package/lib/node/base-language-model.js +4 -15
  63. package/lib/node/base-language-model.js.map +1 -1
  64. package/package.json +23 -23
  65. package/src/browser/chat/chat-manager.service.ts +2 -3
  66. package/src/browser/chat/chat-model.ts +2 -10
  67. package/src/browser/chat/chat-proxy.service.ts +0 -1
  68. package/src/browser/chat/chat.feature.registry.ts +1 -10
  69. package/src/browser/chat/chat.internal.service.ts +2 -2
  70. package/src/browser/chat/chat.view.tsx +8 -18
  71. package/src/browser/components/ChatEditor.tsx +0 -8
  72. package/src/browser/components/ChatInput.tsx +2 -2
  73. package/src/browser/components/ChatMentionInput.tsx +6 -93
  74. package/src/browser/components/components.module.less +0 -49
  75. package/src/browser/components/mention-input/mention-input.module.less +0 -1
  76. package/src/browser/components/mention-input/mention-input.tsx +1 -18
  77. package/src/browser/components/mention-input/types.ts +1 -3
  78. package/src/browser/context/llm-context.service.ts +0 -2
  79. package/src/browser/mcp/config/components/mcp-config.view.tsx +17 -3
  80. package/src/browser/model/msg-history-manager.ts +1 -1
  81. package/src/browser/types.ts +1 -8
  82. package/src/common/index.ts +8 -7
  83. package/src/common/llm-context.ts +0 -2
  84. package/src/node/base-language-model.ts +3 -25
@@ -27,7 +27,7 @@ import {
27
27
  import { MsgHistoryManager } from '../model/msg-history-manager';
28
28
  import { IChatSlashCommandItem } from '../types';
29
29
 
30
- import type { ImagePart, TextPart, ToolCallPart } from 'ai';
30
+ import type { TextPart, ToolCallPart } from 'ai';
31
31
 
32
32
  export type IChatProgressResponseContent =
33
33
  | IChatMarkdownContent
@@ -330,15 +330,7 @@ export class ChatModel extends Disposable implements IChatModel {
330
330
  if (!request.response.isComplete) {
331
331
  continue;
332
332
  }
333
- history.push({
334
- role: 'user',
335
- content: request.message.images?.length
336
- ? [
337
- { type: 'text', text: request.message.prompt },
338
- ...request.message.images.map((image) => ({ type: 'image', image: new URL(image) } as ImagePart)),
339
- ]
340
- : request.message.prompt,
341
- });
333
+ history.push({ role: 'user', content: request.message.prompt });
342
334
  for (const part of request.response.responseParts) {
343
335
  if (part.kind === 'treeData' || part.kind === 'component') {
344
336
  continue;
@@ -151,7 +151,6 @@ export class ChatProxyService extends Disposable {
151
151
  requestId: request.requestId,
152
152
  sessionId: request.sessionId,
153
153
  history,
154
- images: request.images,
155
154
  ...this.getRequestOptions(),
156
155
  },
157
156
  token,
@@ -2,7 +2,7 @@ import { Injectable } from '@opensumi/di';
2
2
  import { Disposable, Emitter, Event, getDebugLogger } from '@opensumi/ide-core-common';
3
3
 
4
4
  import { IChatWelcomeMessageContent, ISampleQuestions, SLASH_SYMBOL } from '../../common';
5
- import { IChatFeatureRegistry, IChatSlashCommandHandler, IChatSlashCommandItem, IImageUploadProvider } from '../types';
5
+ import { IChatFeatureRegistry, IChatSlashCommandHandler, IChatSlashCommandItem } from '../types';
6
6
 
7
7
  import { ChatSlashCommandItemModel, ChatWelcomeMessageModel } from './chat-model';
8
8
  import { ChatProxyService } from './chat-proxy.service';
@@ -12,15 +12,6 @@ export class ChatFeatureRegistry extends Disposable implements IChatFeatureRegis
12
12
  private readonly logger = getDebugLogger();
13
13
  private slashCommandsMap: Map<string, ChatSlashCommandItemModel> = new Map();
14
14
  private slashCommandsHandlerMap: Map<string, IChatSlashCommandHandler> = new Map();
15
- private imageUploadProvider: IImageUploadProvider | undefined;
16
-
17
- public registerImageUploadProvider(provider: IImageUploadProvider): void {
18
- this.imageUploadProvider = provider;
19
- }
20
-
21
- public getImageUploadProvider(): IImageUploadProvider | undefined {
22
- return this.imageUploadProvider;
23
- }
24
15
 
25
16
  public chatWelcomeMessageModel?: ChatWelcomeMessageModel;
26
17
 
@@ -62,8 +62,8 @@ export class ChatInternalService extends Disposable {
62
62
  this._onChangeRequestId.fire(id);
63
63
  }
64
64
 
65
- createRequest(input: string, agentId: string, images?: string[], command?: string) {
66
- return this.chatManagerService.createRequest(this.#sessionModel.sessionId, input, agentId, command, images);
65
+ createRequest(input: string, agentId: string, command?: string) {
66
+ return this.chatManagerService.createRequest(this.#sessionModel.sessionId, input, agentId, command);
67
67
  }
68
68
 
69
69
  sendRequest(request: ChatRequestModel, regenerate = false) {
@@ -281,7 +281,7 @@ export const AIChatView = () => {
281
281
  if (loading) {
282
282
  return;
283
283
  }
284
- await handleSend(message.message, message.images, message.agentId, message.command);
284
+ await handleSend(message.message, message.agentId, message.command);
285
285
  } else {
286
286
  if (message.agentId) {
287
287
  setAgentId(message.agentId);
@@ -462,16 +462,10 @@ export const AIChatView = () => {
462
462
  );
463
463
 
464
464
  const renderUserMessage = React.useCallback(
465
- async (renderModel: {
466
- message: string;
467
- images?: string[];
468
- agentId?: string;
469
- relationId: string;
470
- command?: string;
471
- }) => {
465
+ async (renderModel: { message: string; agentId?: string; relationId: string; command?: string }) => {
472
466
  const ChatUserRoleRender = chatRenderRegistry.chatUserRoleRender;
473
467
 
474
- const { message, images, agentId, relationId, command } = renderModel;
468
+ const { message, agentId, relationId, command } = renderModel;
475
469
 
476
470
  const visibleAgentId = agentId === ChatProxyService.AGENT_ID ? '' : agentId;
477
471
 
@@ -480,13 +474,12 @@ export const AIChatView = () => {
480
474
  id: uuid(6),
481
475
  relationId,
482
476
  text: ChatUserRoleRender ? (
483
- <ChatUserRoleRender content={message} images={images} agentId={visibleAgentId} command={command} />
477
+ <ChatUserRoleRender content={message} agentId={visibleAgentId} command={command} />
484
478
  ) : (
485
479
  <CodeBlockWrapperInput
486
480
  labelService={labelService}
487
481
  relationId={relationId}
488
482
  text={message}
489
- images={images}
490
483
  agentId={visibleAgentId}
491
484
  command={command}
492
485
  workspaceService={workspaceService}
@@ -605,10 +598,10 @@ export const AIChatView = () => {
605
598
 
606
599
  const handleAgentReply = React.useCallback(
607
600
  async (value: IChatMessageStructure) => {
608
- const { message, images, agentId, command, reportExtra } = value;
601
+ const { message, agentId, command, reportExtra } = value;
609
602
  const { actionType, actionSource } = reportExtra || {};
610
603
 
611
- const request = aiChatService.createRequest(message, agentId!, images, command);
604
+ const request = aiChatService.createRequest(message, agentId!, command);
612
605
  if (!request) {
613
606
  return;
614
607
  }
@@ -634,7 +627,6 @@ export const AIChatView = () => {
634
627
 
635
628
  msgHistoryManager.addUserMessage({
636
629
  content: message,
637
- images: images || [],
638
630
  agentId: agentId!,
639
631
  agentCommand: command!,
640
632
  relationId,
@@ -643,7 +635,6 @@ export const AIChatView = () => {
643
635
  await renderUserMessage({
644
636
  relationId,
645
637
  message,
646
- images,
647
638
  command,
648
639
  agentId,
649
640
  });
@@ -677,7 +668,7 @@ export const AIChatView = () => {
677
668
  );
678
669
 
679
670
  const handleSend = React.useCallback(
680
- async (message: string, images?: string[], agentId?: string, command?: string) => {
671
+ async (message: string, agentId?: string, command?: string) => {
681
672
  const reportExtra = {
682
673
  actionSource: ActionSourceEnum.Chat,
683
674
  actionType: ActionTypeEnum.Send,
@@ -716,7 +707,7 @@ export const AIChatView = () => {
716
707
  processedContent = processedContent.replace(match, `\`<attached_folder>${relativePath}\``);
717
708
  }
718
709
  }
719
- return handleAgentReply({ message: processedContent, images, agentId, command, reportExtra });
710
+ return handleAgentReply({ message: processedContent, agentId, command, reportExtra });
720
711
  },
721
712
  [handleAgentReply],
722
713
  );
@@ -759,7 +750,6 @@ export const AIChatView = () => {
759
750
  message: msg.content,
760
751
  agentId: msg.agentId,
761
752
  command: msg.agentCommand,
762
- images: msg.images,
763
753
  });
764
754
  } else if (msg.role === ChatMessageRole.Assistant && msg.requestId) {
765
755
  const request = aiChatService.sessionModel.getRequest(msg.requestId)!;
@@ -2,7 +2,6 @@ import capitalize from 'lodash/capitalize';
2
2
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
3
  import Highlight from 'react-highlight';
4
4
 
5
- import { Image } from '@opensumi/ide-components/lib/image';
6
5
  import {
7
6
  EDITOR_COMMANDS,
8
7
  FILE_COMMANDS,
@@ -337,7 +336,6 @@ export const CodeBlockWrapper = ({
337
336
 
338
337
  export const CodeBlockWrapperInput = ({
339
338
  text,
340
- images,
341
339
  relationId,
342
340
  agentId,
343
341
  command,
@@ -346,7 +344,6 @@ export const CodeBlockWrapperInput = ({
346
344
  commandService,
347
345
  }: {
348
346
  text: string;
349
- images?: string[];
350
347
  relationId: string;
351
348
  agentId?: string;
352
349
  command?: string;
@@ -373,11 +370,6 @@ export const CodeBlockWrapperInput = ({
373
370
 
374
371
  return (
375
372
  <div className={styles.ai_chat_code_wrapper}>
376
- {images?.map((image) => (
377
- <div className={styles.image_wrapper}>
378
- <Image src={image} />
379
- </div>
380
- ))}
381
373
  <div className={styles.render_text}>
382
374
  {tag && (
383
375
  <div className={styles.tag_wrapper}>
@@ -162,7 +162,7 @@ const AgentWidget = ({ agentId, command }) => (
162
162
  );
163
163
 
164
164
  export interface IChatInputProps {
165
- onSend: (value: string, images?: string[], agentId?: string, command?: string) => void;
165
+ onSend: (value: string, agentId?: string, command?: string) => void;
166
166
  onValueChange?: (value: string) => void;
167
167
  onExpand?: (value: boolean) => void;
168
168
  placeholder?: string;
@@ -341,7 +341,7 @@ export const ChatInput = React.forwardRef((props: IChatInputProps, ref) => {
341
341
  }
342
342
 
343
343
  const handleSendLogic = (newValue: string = value) => {
344
- onSend(newValue, [], agentId, command);
344
+ onSend(newValue, agentId, command);
345
345
  setValue('');
346
346
  setTheme('');
347
347
  setAgentId('');
@@ -1,18 +1,14 @@
1
- import { DataContent } from 'ai';
2
1
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
2
 
4
- import { Image } from '@opensumi/ide-components/lib/image';
5
3
  import { LabelService, RecentFilesManager, useInjectable } from '@opensumi/ide-core-browser';
6
- import { Icon, getIcon } from '@opensumi/ide-core-browser/lib/components';
7
- import { ChatFeatureRegistryToken, URI, localize } from '@opensumi/ide-core-common';
4
+ import { getIcon } from '@opensumi/ide-core-browser/lib/components';
5
+ import { URI, localize } from '@opensumi/ide-core-common';
8
6
  import { CommandService } from '@opensumi/ide-core-common/lib/command';
9
7
  import { WorkbenchEditorService } from '@opensumi/ide-editor';
10
8
  import { FileSearchServicePath, IFileSearchService } from '@opensumi/ide-file-search';
11
- import { IMessageService } from '@opensumi/ide-overlay';
12
9
  import { IWorkspaceService } from '@opensumi/ide-workspace';
13
10
 
14
11
  import { IChatInternalService } from '../../common';
15
- import { ChatFeatureRegistry } from '../chat/chat.feature.registry';
16
12
  import { ChatInternalService } from '../chat/chat.internal.service';
17
13
  import { OPEN_MCP_CONFIG_COMMAND } from '../mcp/config/mcp-config.commands';
18
14
 
@@ -21,13 +17,7 @@ import { MentionInput } from './mention-input/mention-input';
21
17
  import { FooterButtonPosition, FooterConfig, MentionItem, MentionType } from './mention-input/types';
22
18
 
23
19
  export interface IChatMentionInputProps {
24
- onSend: (
25
- value: string,
26
- images?: string[],
27
- agentId?: string,
28
- command?: string,
29
- option?: { model: string; [key: string]: any },
30
- ) => void;
20
+ onSend: (value: string, agentId?: string, command?: string, option?: { model: string; [key: string]: any }) => void;
31
21
  onValueChange?: (value: string) => void;
32
22
  onExpand?: (value: boolean) => void;
33
23
  placeholder?: string;
@@ -36,7 +26,6 @@ export interface IChatMentionInputProps {
36
26
  sendBtnClassName?: string;
37
27
  defaultHeight?: number;
38
28
  value?: string;
39
- images?: Array<DataContent | URL>;
40
29
  autoFocus?: boolean;
41
30
  theme?: string | null;
42
31
  setTheme: (theme: string | null) => void;
@@ -52,7 +41,6 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
52
41
  const { onSend, disabled = false } = props;
53
42
 
54
43
  const [value, setValue] = useState(props.value || '');
55
- const [images, setImages] = useState(props.images || []);
56
44
  const aiChatService = useInjectable<ChatInternalService>(IChatInternalService);
57
45
  const commandService = useInjectable<CommandService>(CommandService);
58
46
  const searchService = useInjectable<IFileSearchService>(FileSearchServicePath);
@@ -60,8 +48,7 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
60
48
  const workspaceService = useInjectable<IWorkspaceService>(IWorkspaceService);
61
49
  const editorService = useInjectable<WorkbenchEditorService>(WorkbenchEditorService);
62
50
  const labelService = useInjectable<LabelService>(LabelService);
63
- const messageService = useInjectable<IMessageService>(IMessageService);
64
- const chatFeatureRegistry = useInjectable<ChatFeatureRegistry>(ChatFeatureRegistryToken);
51
+
65
52
  const handleShowMCPConfig = React.useCallback(() => {
66
53
  commandService.executeCommand(OPEN_MCP_CONFIG_COMMAND.id);
67
54
  }, [commandService]);
@@ -252,24 +239,6 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
252
239
  onClick: handleShowMCPConfig,
253
240
  position: FooterButtonPosition.LEFT,
254
241
  },
255
- {
256
- id: 'upload-image',
257
- iconClass: 'codicon codicon-file-media',
258
- title: 'Upload Image',
259
- onClick: () => {
260
- const input = document.createElement('input');
261
- input.type = 'file';
262
- input.accept = 'image/*';
263
- input.onchange = (e) => {
264
- const file = (e.target as HTMLInputElement).files?.[0];
265
- if (file) {
266
- handleImageUpload(file);
267
- }
268
- };
269
- input.click();
270
- },
271
- position: FooterButtonPosition.LEFT,
272
- },
273
242
  ],
274
243
  showModelSelector: true,
275
244
  }),
@@ -285,47 +254,13 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
285
254
  if (disabled) {
286
255
  return;
287
256
  }
288
- onSend(
289
- content,
290
- images.map((image) => image.toString()),
291
- undefined,
292
- undefined,
293
- option,
294
- );
295
- setImages(props.images || []);
296
- },
297
- [onSend, images, disabled],
298
- );
299
-
300
- const handleImageUpload = useCallback(
301
- async (file: File) => {
302
- const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png', 'image/webp', 'image/gif'];
303
- if (!allowedTypes.includes(file.type)) {
304
- messageService.error('Only JPG, PNG, WebP and GIF images are supported');
305
- return;
306
- }
307
-
308
- const imageUploadProvider = chatFeatureRegistry.getImageUploadProvider();
309
- if (!imageUploadProvider) {
310
- messageService.error('No image upload provider found');
311
- return;
312
- }
313
- const data = await imageUploadProvider.imageUpload(file);
314
- setImages([...images, data]);
257
+ onSend(content, undefined, undefined, option);
315
258
  },
316
- [images],
317
- );
318
-
319
- const handleDeleteImage = useCallback(
320
- (index: number) => {
321
- setImages(images.filter((_, i) => i !== index));
322
- },
323
- [images],
259
+ [onSend, editorService, disabled],
324
260
  );
325
261
 
326
262
  return (
327
263
  <div className={styles.chat_input_container}>
328
- {images.length > 0 && <ImagePreviewer images={images} onDelete={handleDeleteImage} />}
329
264
  <MentionInput
330
265
  mentionItems={defaultMenuItems}
331
266
  onSend={handleSend}
@@ -335,29 +270,7 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
335
270
  workspaceService={workspaceService}
336
271
  placeholder={localize('aiNative.chat.input.placeholder.default')}
337
272
  footerConfig={defaultMentionInputFooterOptions}
338
- onImageUpload={handleImageUpload}
339
273
  />
340
274
  </div>
341
275
  );
342
276
  };
343
-
344
- const ImagePreviewer = ({
345
- images,
346
- onDelete,
347
- }: {
348
- images: Array<DataContent | URL>;
349
- onDelete: (index: number) => void;
350
- }) => (
351
- <div>
352
- <div className={styles.thumbnail_container}>
353
- {images.map((image, index) => (
354
- <div key={index} className={styles.thumbnail}>
355
- <Image src={image.toString()} />
356
- <button onClick={() => onDelete(index)} className={styles.delete_button}>
357
- <Icon iconClass='codicon codicon-close' />
358
- </button>
359
- </div>
360
- ))}
361
- </div>
362
- </div>
363
- );
@@ -601,52 +601,3 @@
601
601
  vertical-align: middle;
602
602
  font-size: 12px;
603
603
  }
604
-
605
- .thumbnail_container {
606
- display: flex;
607
- gap: 4px;
608
- padding: 4px 12px;
609
- .thumbnail {
610
- width: 36px;
611
- height: 36px;
612
- border-radius: 4px;
613
- position: relative;
614
- box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.3);
615
- padding: 2px;
616
- display: inline-flex;
617
- align-items: center;
618
- img {
619
- width: 100%;
620
- height: 100%;
621
- object-fit: cover;
622
- }
623
- }
624
- .delete_button {
625
- position: absolute;
626
- top: -5px;
627
- right: -5px;
628
- font-size: 12px;
629
- padding: 2px;
630
- border: 0;
631
- border-radius: 50%;
632
- transition: transform 0.2s ease-in-out;
633
- width: 16px;
634
- height: 16px;
635
- display: flex;
636
- justify-content: center;
637
- align-items: center;
638
- background-color: var(--badge-background);
639
- &:hover {
640
- cursor: pointer;
641
- transform: scale(1.2);
642
- }
643
- :global(.codicon) {
644
- font-size: 12px;
645
- color: var(--badge-foreground);
646
- }
647
- }
648
- }
649
-
650
- .image_wrapper {
651
- display: inline-block;
652
- }
@@ -50,7 +50,6 @@
50
50
  display: flex;
51
51
  align-items: center;
52
52
  cursor: pointer;
53
- text-wrap: nowrap;
54
53
  white-space: nowrap;
55
54
  box-sizing: border-box;
56
55
 
@@ -18,7 +18,6 @@ export const MentionInput: React.FC<MentionInputProps> = ({
18
18
  loading = false,
19
19
  mentionKeyword = MENTION_KEYWORD,
20
20
  onSelectionChange,
21
- onImageUpload,
22
21
  labelService,
23
22
  workspaceService,
24
23
  placeholder = 'Ask anything, @ to mention',
@@ -276,21 +275,6 @@ export const MentionInput: React.FC<MentionInputProps> = ({
276
275
  }
277
276
  };
278
277
 
279
- // 处理图片粘贴事件
280
- const handlePaste = (e: React.ClipboardEvent<HTMLDivElement>) => {
281
- const items = e.clipboardData.items;
282
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
283
- for (let i = 0; i < items.length; i++) {
284
- if (items[i].kind === 'file' && items[i].type.startsWith('image/')) {
285
- const file = items[i].getAsFile();
286
- if (file && onImageUpload) {
287
- e.preventDefault();
288
- onImageUpload(file);
289
- }
290
- }
291
- }
292
- };
293
-
294
278
  // 处理键盘事件
295
279
  const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
296
280
  // 如果按下ESC键且提及面板处于活动状态或内联搜索处于活动状态
@@ -883,7 +867,7 @@ export const MentionInput: React.FC<MentionInputProps> = ({
883
867
  title={button.title}
884
868
  >
885
869
  <EnhanceIcon
886
- className={cls(button.icon ? getIcon(button.icon) : button.iconClass, styles[`${button.id}_logo`])}
870
+ className={cls(getIcon(button.icon), styles[`${button.id}_logo`])}
887
871
  tabIndex={0}
888
872
  role='button'
889
873
  ariaLabel={button.title}
@@ -917,7 +901,6 @@ export const MentionInput: React.FC<MentionInputProps> = ({
917
901
  contentEditable={true}
918
902
  onInput={handleInput}
919
903
  onKeyDown={handleKeyDown}
920
- onPaste={handlePaste}
921
904
  onCompositionEnd={handleCompositionEnd}
922
905
  />
923
906
  </div>
@@ -55,8 +55,7 @@ export enum MentionType {
55
55
 
56
56
  interface FooterButton {
57
57
  id: string;
58
- icon?: string;
59
- iconClass?: string;
58
+ icon: string;
60
59
  title: string;
61
60
  onClick?: () => void;
62
61
  position: FooterButtonPosition;
@@ -76,7 +75,6 @@ export interface MentionInputProps {
76
75
  placeholder?: string;
77
76
  loading?: boolean;
78
77
  onSelectionChange?: (value: string) => void;
79
- onImageUpload?: (file: File) => void;
80
78
  footerConfig?: FooterConfig; // 新增配置项
81
79
  mentionKeyword?: string;
82
80
  labelService?: LabelService;
@@ -1,5 +1,3 @@
1
- import { DataContent } from 'ai';
2
-
3
1
  import { Autowired, Injectable } from '@opensumi/di';
4
2
  import { AppConfig } from '@opensumi/ide-core-browser/lib/react-providers/config-provider';
5
3
  import { WithEventBus } from '@opensumi/ide-core-common/lib/event-bus/event-decorator';
@@ -26,7 +26,21 @@ export const MCPConfigView: React.FC = () => {
26
26
  const [editingServer, setEditingServer] = React.useState<MCPServerFormData | undefined>();
27
27
  const [loadingServer, setLoadingServer] = React.useState<string | undefined>();
28
28
  const loadServers = useCallback(async () => {
29
- const allServers = await mcpServerProxyService.$getServers();
29
+ const userServers = preferenceService.get<MCPServerDescription[]>(AINativeSettingSectionsId.MCPServers, []);
30
+ const runningServers = await mcpServerProxyService.$getServers();
31
+ const builtinServer = runningServers.find((server) => server.name === BUILTIN_MCP_SERVER_NAME);
32
+ const allServers = userServers.map((server) => {
33
+ const runningServer = runningServers.find((s) => s.name === server.name);
34
+ return {
35
+ ...server,
36
+ name: server.name,
37
+ isStarted: runningServer?.isStarted,
38
+ tools: runningServer?.tools,
39
+ };
40
+ }) as MCPServer[];
41
+ if (builtinServer) {
42
+ allServers.unshift(builtinServer);
43
+ }
30
44
  setServers(allServers);
31
45
  }, [mcpServerProxyService]);
32
46
 
@@ -93,8 +107,8 @@ export const MCPConfigView: React.FC = () => {
93
107
  setLoadingServer(undefined);
94
108
  } catch (error) {
95
109
  const msg = error.message || error;
96
- logger.error(`Failed to ${start ? 'start' : 'stop'} server ${serverName}:`, error);
97
- messageService.error(error.message);
110
+ logger.error(`Failed to ${start ? 'start' : 'stop'} server ${serverName}:`, msg);
111
+ messageService.error(msg);
98
112
  setLoadingServer(undefined);
99
113
  }
100
114
  },
@@ -62,7 +62,7 @@ export class MsgHistoryManager extends Disposable {
62
62
  }
63
63
 
64
64
  public addUserMessage(
65
- message: Required<Pick<IExcludeMessage, 'agentId' | 'agentCommand' | 'content' | 'relationId' | 'images'>>,
65
+ message: Required<Pick<IExcludeMessage, 'agentId' | 'agentCommand' | 'content' | 'relationId'>>,
66
66
  ): string {
67
67
  return this.doAddMessage({
68
68
  ...message,
@@ -1,4 +1,3 @@
1
- import { DataContent } from 'ai';
2
1
  import React from 'react';
3
2
  import { ZodSchema } from 'zod';
4
3
 
@@ -130,7 +129,6 @@ export interface IChatSlashCommandHandler {
130
129
  }
131
130
 
132
131
  export interface IChatFeatureRegistry {
133
- registerImageUploadProvider(provider: IImageUploadProvider): void;
134
132
  registerWelcome(content: IChatWelcomeMessageContent | React.ReactNode, sampleQuestions?: ISampleQuestions[]): void;
135
133
  registerSlashCommand(command: IChatSlashCommandItem, handler: IChatSlashCommandHandler): void;
136
134
  }
@@ -142,14 +140,13 @@ export type ChatWelcomeRender = (props: {
142
140
  export type ChatAIRoleRender = (props: { content: string }) => React.ReactElement | React.JSX.Element;
143
141
  export type ChatUserRoleRender = (props: {
144
142
  content: string;
145
- images?: string[];
146
143
  agentId?: string;
147
144
  command?: string;
148
145
  }) => React.ReactElement | React.JSX.Element;
149
146
  export type ChatThinkingRender = (props: { thinkingText?: string }) => React.ReactElement | React.JSX.Element;
150
147
  export type ChatThinkingResultRender = (props: { thinkingResult?: string }) => React.ReactElement | React.JSX.Element;
151
148
  export type ChatInputRender = (props: {
152
- onSend: (value: string, images?: string[], agentId?: string, command?: string) => void;
149
+ onSend: (value: string, agentId?: string, command?: string) => void;
153
150
  onValueChange?: (value: string) => void;
154
151
  onExpand?: (value: boolean) => void;
155
152
  placeholder?: string;
@@ -292,10 +289,6 @@ export interface IProblemFixProviderRegistry {
292
289
  registerHoverFixProvider(handler: IHoverFixHandler): void;
293
290
  }
294
291
 
295
- export interface IImageUploadProvider {
296
- imageUpload(file: File): Promise<DataContent | URL>;
297
- }
298
-
299
292
  export const AINativeCoreContribution = Symbol('AINativeCoreContribution');
300
293
 
301
294
  export interface AINativeCoreContribution {
@@ -52,10 +52,6 @@ export interface IChatMessageStructure {
52
52
  * 用于 chat 面板展示
53
53
  */
54
54
  message: string;
55
- /**
56
- * 图片
57
- */
58
- images?: string[];
59
55
  /**
60
56
  * 实际调用的 prompt
61
57
  */
@@ -138,7 +134,14 @@ export interface ISumiMCPServerBackend {
138
134
  initBuiltinMCPServer(enabled: boolean): void;
139
135
  initExternalMCPServers(servers: MCPServerDescription[]): void;
140
136
  getAllMCPTools(): Promise<MCPTool[]>;
141
- getServers(): Promise<Array<{ name: string; isStarted: boolean; tools: MCPTool[] }>>;
137
+ getServers(): Promise<
138
+ Array<{
139
+ name: string;
140
+ isStarted: boolean;
141
+ type: string;
142
+ tools: MCPTool[];
143
+ }>
144
+ >;
142
145
  startServer(serverName: string): Promise<void>;
143
146
  stopServer(serverName: string): Promise<void>;
144
147
  addOrUpdateServer(description: MCPServerDescription): void;
@@ -204,7 +207,6 @@ export interface IChatAgentRequest {
204
207
  requestId: string;
205
208
  command?: string;
206
209
  message: string;
207
- images?: string[];
208
210
  regenerate?: boolean;
209
211
  }
210
212
 
@@ -242,7 +244,6 @@ export type IChatFollowup = IChatReplyFollowup | IChatResponseCommandFollowup;
242
244
 
243
245
  export interface IChatRequestMessage {
244
246
  prompt: string;
245
- images?: string[];
246
247
  agentId: string;
247
248
  command?: string;
248
249
  }
@@ -1,5 +1,3 @@
1
- import { DataContent } from 'ai';
2
-
3
1
  import { Event, URI } from '@opensumi/ide-core-common/lib/utils';
4
2
 
5
3
  export interface LLMContextService {