@opensumi/ide-ai-native 3.8.3-next-1741942697.0 → 3.8.3-next-1741943877.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 (89) hide show
  1. package/lib/browser/ai-core.contribution.d.ts +0 -1
  2. package/lib/browser/ai-core.contribution.d.ts.map +1 -1
  3. package/lib/browser/ai-core.contribution.js +1 -7
  4. package/lib/browser/ai-core.contribution.js.map +1 -1
  5. package/lib/browser/chat/chat-manager.service.d.ts +1 -1
  6. package/lib/browser/chat/chat-manager.service.d.ts.map +1 -1
  7. package/lib/browser/chat/chat-manager.service.js +2 -3
  8. package/lib/browser/chat/chat-manager.service.js.map +1 -1
  9. package/lib/browser/chat/chat-proxy.service.d.ts.map +1 -1
  10. package/lib/browser/chat/chat-proxy.service.js +0 -1
  11. package/lib/browser/chat/chat-proxy.service.js.map +1 -1
  12. package/lib/browser/chat/chat.internal.service.d.ts +1 -1
  13. package/lib/browser/chat/chat.internal.service.d.ts.map +1 -1
  14. package/lib/browser/chat/chat.internal.service.js +2 -2
  15. package/lib/browser/chat/chat.internal.service.js.map +1 -1
  16. package/lib/browser/chat/chat.view.d.ts.map +1 -1
  17. package/lib/browser/chat/chat.view.js +7 -10
  18. package/lib/browser/chat/chat.view.js.map +1 -1
  19. package/lib/browser/components/ChatEditor.d.ts +1 -2
  20. package/lib/browser/components/ChatEditor.d.ts.map +1 -1
  21. package/lib/browser/components/ChatEditor.js +2 -5
  22. package/lib/browser/components/ChatEditor.js.map +1 -1
  23. package/lib/browser/components/ChatInput.d.ts +1 -1
  24. package/lib/browser/components/ChatInput.d.ts.map +1 -1
  25. package/lib/browser/components/ChatInput.js +1 -1
  26. package/lib/browser/components/ChatInput.js.map +1 -1
  27. package/lib/browser/components/ChatMentionInput.d.ts +1 -3
  28. package/lib/browser/components/ChatMentionInput.d.ts.map +1 -1
  29. package/lib/browser/components/ChatMentionInput.js +3 -51
  30. package/lib/browser/components/ChatMentionInput.js.map +1 -1
  31. package/lib/browser/components/components.module.less +0 -49
  32. package/lib/browser/components/mention-input/mention-input.d.ts.map +1 -1
  33. package/lib/browser/components/mention-input/mention-input.js +3 -17
  34. package/lib/browser/components/mention-input/mention-input.js.map +1 -1
  35. package/lib/browser/components/mention-input/mention-input.module.less +0 -1
  36. package/lib/browser/components/mention-input/types.d.ts +1 -3
  37. package/lib/browser/components/mention-input/types.d.ts.map +1 -1
  38. package/lib/browser/components/mention-input/types.js.map +1 -1
  39. package/lib/browser/context/llm-context.service.d.ts.map +1 -1
  40. package/lib/browser/context/llm-context.service.js.map +1 -1
  41. package/lib/browser/index.d.ts.map +1 -1
  42. package/lib/browser/index.js +0 -5
  43. package/lib/browser/index.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 +15 -1
  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 -14
  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/ai-core.contribution.ts +0 -6
  66. package/src/browser/chat/chat-manager.service.ts +2 -3
  67. package/src/browser/chat/chat-proxy.service.ts +0 -1
  68. package/src/browser/chat/chat.internal.service.ts +2 -2
  69. package/src/browser/chat/chat.view.tsx +8 -18
  70. package/src/browser/components/ChatEditor.tsx +0 -8
  71. package/src/browser/components/ChatInput.tsx +2 -2
  72. package/src/browser/components/ChatMentionInput.tsx +4 -92
  73. package/src/browser/components/components.module.less +0 -49
  74. package/src/browser/components/mention-input/mention-input.module.less +0 -1
  75. package/src/browser/components/mention-input/mention-input.tsx +1 -18
  76. package/src/browser/components/mention-input/types.ts +1 -3
  77. package/src/browser/context/llm-context.service.ts +0 -2
  78. package/src/browser/index.ts +0 -8
  79. package/src/browser/mcp/config/components/mcp-config.view.tsx +15 -1
  80. package/src/browser/model/msg-history-manager.ts +1 -1
  81. package/src/browser/types.ts +1 -17
  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
  85. package/lib/browser/contrib/image-upload/image-upload.feature.registry.d.ts +0 -8
  86. package/lib/browser/contrib/image-upload/image-upload.feature.registry.d.ts.map +0 -1
  87. package/lib/browser/contrib/image-upload/image-upload.feature.registry.js +0 -19
  88. package/lib/browser/contrib/image-upload/image-upload.feature.registry.js.map +0 -1
  89. package/src/browser/contrib/image-upload/image-upload.feature.registry.ts +0 -18
@@ -95,7 +95,6 @@ import { ChatProxyService } from './chat/chat-proxy.service';
95
95
  import { ChatInternalService } from './chat/chat.internal.service';
96
96
  import { AIChatView } from './chat/chat.view';
97
97
  import { CodeActionSingleHandler } from './contrib/code-action/code-action.handler';
98
- import { ImageUploadProviderRegistryToken } from './contrib/image-upload/image-upload.feature.registry';
99
98
  import { AIInlineCompletionsProvider } from './contrib/inline-completions/completeProvider';
100
99
  import { InlineCompletionsController } from './contrib/inline-completions/inline-completions.controller';
101
100
  import { AICompletionsService } from './contrib/inline-completions/service/ai-completions.service';
@@ -115,7 +114,6 @@ import {
115
114
  AINativeCoreContribution,
116
115
  IChatFeatureRegistry,
117
116
  IChatRenderRegistry,
118
- IImageUploadProviderRegistry,
119
117
  IIntelligentCompletionsRegistry,
120
118
  IMCPServerRegistry,
121
119
  IProblemFixProviderRegistry,
@@ -198,9 +196,6 @@ export class AINativeBrowserContribution
198
196
  @Autowired(IntelligentCompletionsRegistryToken)
199
197
  private readonly intelligentCompletionsRegistry: IIntelligentCompletionsRegistry;
200
198
 
201
- @Autowired(ImageUploadProviderRegistryToken)
202
- private readonly imageUploadProviderRegistry: IImageUploadProviderRegistry;
203
-
204
199
  @Autowired(ProblemFixRegistryToken)
205
200
  private readonly problemFixProviderRegistry: IProblemFixProviderRegistry;
206
201
 
@@ -458,7 +453,6 @@ export class AINativeBrowserContribution
458
453
  contribution.registerIntelligentCompletionFeature?.(this.intelligentCompletionsRegistry);
459
454
  contribution.registerProblemFixFeature?.(this.problemFixProviderRegistry);
460
455
  contribution.registerChatAgentPromptProvider?.();
461
- contribution.registerImageUploadProvider?.(this.imageUploadProviderRegistry);
462
456
  });
463
457
 
464
458
  // 注册 Opensumi 框架提供的 MCP Server Tools 能力 (此时的 Opensumi 作为 MCP Server)
@@ -150,7 +150,7 @@ export class ChatManagerService extends Disposable {
150
150
  this.saveSessions();
151
151
  }
152
152
 
153
- createRequest(sessionId: string, message: string, agentId: string, command?: string, images?: string[]) {
153
+ createRequest(sessionId: string, message: string, agentId: string, command?: string) {
154
154
  const model = this.getSession(sessionId);
155
155
  if (!model) {
156
156
  throw new Error(`Unknown session: ${sessionId}`);
@@ -160,7 +160,7 @@ export class ChatManagerService extends Disposable {
160
160
  return;
161
161
  }
162
162
 
163
- return model.addRequest({ prompt: message, agentId, command, images });
163
+ return model.addRequest({ prompt: message, agentId, command });
164
164
  }
165
165
 
166
166
  async sendRequest(sessionId: string, request: ChatRequestModel, regenerate: boolean) {
@@ -191,7 +191,6 @@ export class ChatManagerService extends Disposable {
191
191
  requestId: request.requestId,
192
192
  message: request.message.prompt,
193
193
  command: request.message.command,
194
- images: request.message.images,
195
194
  regenerate,
196
195
  };
197
196
  const result = await this.chatAgentService.invokeAgent(
@@ -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,
@@ -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,34 +1,23 @@
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';
4
+ import { getIcon } from '@opensumi/ide-core-browser/lib/components';
7
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
12
  import { ChatInternalService } from '../chat/chat.internal.service';
16
- import { ImageUploadProviderRegistryToken } from '../contrib/image-upload/image-upload.feature.registry';
17
13
  import { OPEN_MCP_CONFIG_COMMAND } from '../mcp/config/mcp-config.commands';
18
- import { IImageUploadProviderRegistry } from '../types';
19
14
 
20
15
  import styles from './components.module.less';
21
16
  import { MentionInput } from './mention-input/mention-input';
22
17
  import { FooterButtonPosition, FooterConfig, MentionItem, MentionType } from './mention-input/types';
23
18
 
24
19
  export interface IChatMentionInputProps {
25
- onSend: (
26
- value: string,
27
- images?: string[],
28
- agentId?: string,
29
- command?: string,
30
- option?: { model: string; [key: string]: any },
31
- ) => void;
20
+ onSend: (value: string, agentId?: string, command?: string, option?: { model: string; [key: string]: any }) => void;
32
21
  onValueChange?: (value: string) => void;
33
22
  onExpand?: (value: boolean) => void;
34
23
  placeholder?: string;
@@ -37,7 +26,6 @@ export interface IChatMentionInputProps {
37
26
  sendBtnClassName?: string;
38
27
  defaultHeight?: number;
39
28
  value?: string;
40
- images?: Array<DataContent | URL>;
41
29
  autoFocus?: boolean;
42
30
  theme?: string | null;
43
31
  setTheme: (theme: string | null) => void;
@@ -53,7 +41,6 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
53
41
  const { onSend, disabled = false } = props;
54
42
 
55
43
  const [value, setValue] = useState(props.value || '');
56
- const [images, setImages] = useState(props.images || []);
57
44
  const aiChatService = useInjectable<ChatInternalService>(IChatInternalService);
58
45
  const commandService = useInjectable<CommandService>(CommandService);
59
46
  const searchService = useInjectable<IFileSearchService>(FileSearchServicePath);
@@ -61,8 +48,6 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
61
48
  const workspaceService = useInjectable<IWorkspaceService>(IWorkspaceService);
62
49
  const editorService = useInjectable<WorkbenchEditorService>(WorkbenchEditorService);
63
50
  const labelService = useInjectable<LabelService>(LabelService);
64
- const messageService = useInjectable<IMessageService>(IMessageService);
65
- const imageUploadProviderRegistry = useInjectable<IImageUploadProviderRegistry>(ImageUploadProviderRegistryToken);
66
51
 
67
52
  const handleShowMCPConfig = React.useCallback(() => {
68
53
  commandService.executeCommand(OPEN_MCP_CONFIG_COMMAND.id);
@@ -254,24 +239,6 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
254
239
  onClick: handleShowMCPConfig,
255
240
  position: FooterButtonPosition.LEFT,
256
241
  },
257
- {
258
- id: 'upload-image',
259
- iconClass: 'codicon codicon-file-media',
260
- title: 'Upload Image',
261
- onClick: () => {
262
- const input = document.createElement('input');
263
- input.type = 'file';
264
- input.accept = 'image/*';
265
- input.onchange = (e) => {
266
- const file = (e.target as HTMLInputElement).files?.[0];
267
- if (file) {
268
- handleImageUpload(file);
269
- }
270
- };
271
- input.click();
272
- },
273
- position: FooterButtonPosition.LEFT,
274
- },
275
242
  ],
276
243
  showModelSelector: true,
277
244
  }),
@@ -287,46 +254,13 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
287
254
  if (disabled) {
288
255
  return;
289
256
  }
290
- onSend(
291
- content,
292
- images.map((image) => image.toString()),
293
- undefined,
294
- undefined,
295
- option,
296
- );
257
+ onSend(content, undefined, undefined, option);
297
258
  },
298
- [onSend, images, disabled],
299
- );
300
-
301
- const handleImageUpload = useCallback(
302
- async (file: File) => {
303
- const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png', 'image/webp', 'image/gif'];
304
- if (!allowedTypes.includes(file.type)) {
305
- messageService.error('Only JPG, PNG, WebP and GIF images are supported');
306
- return;
307
- }
308
-
309
- const imageUploadProvider = imageUploadProviderRegistry.getImageUploadProvider();
310
- if (!imageUploadProvider) {
311
- messageService.error('No image upload provider found');
312
- return;
313
- }
314
- const data = await imageUploadProvider.imageUpload(file);
315
- setImages([...images, data]);
316
- },
317
- [images],
318
- );
319
-
320
- const handleDeleteImage = useCallback(
321
- (index: number) => {
322
- setImages(images.filter((_, i) => i !== index));
323
- },
324
- [images],
259
+ [onSend, editorService, disabled],
325
260
  );
326
261
 
327
262
  return (
328
263
  <div className={styles.chat_input_container}>
329
- {images.length > 0 && <ImagePreviewer images={images} onDelete={handleDeleteImage} />}
330
264
  <MentionInput
331
265
  mentionItems={defaultMenuItems}
332
266
  onSend={handleSend}
@@ -336,29 +270,7 @@ export const ChatMentionInput = (props: IChatMentionInputProps) => {
336
270
  workspaceService={workspaceService}
337
271
  placeholder={localize('aiNative.chat.input.placeholder.default')}
338
272
  footerConfig={defaultMentionInputFooterOptions}
339
- onImageUpload={handleImageUpload}
340
273
  />
341
274
  </div>
342
275
  );
343
276
  };
344
-
345
- const ImagePreviewer = ({
346
- images,
347
- onDelete,
348
- }: {
349
- images: Array<DataContent | URL>;
350
- onDelete: (index: number) => void;
351
- }) => (
352
- <div>
353
- <div className={styles.thumbnail_container}>
354
- {images.map((image, index) => (
355
- <div key={index} className={styles.thumbnail}>
356
- <Image src={image.toString()} />
357
- <button onClick={() => onDelete(index)} className={styles.delete_button}>
358
- <Icon iconClass='codicon codicon-close' />
359
- </button>
360
- </div>
361
- ))}
362
- </div>
363
- </div>
364
- );
@@ -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';
@@ -46,10 +46,6 @@ import { ChatRenderRegistry } from './chat/chat.render.registry';
46
46
  import { LlmContextContribution } from './context/llm-context.contribution';
47
47
  import { LLMContextServiceImpl } from './context/llm-context.service';
48
48
  import { AICodeActionContribution } from './contrib/code-action/code-action.contribution';
49
- import {
50
- ImageUploadProviderRegistry,
51
- ImageUploadProviderRegistryToken,
52
- } from './contrib/image-upload/image-upload.feature.registry';
53
49
  import { AIInlineCompletionsProvider } from './contrib/inline-completions/completeProvider';
54
50
  import { IntelligentCompletionsContribution } from './contrib/intelligent-completions/intelligent-completions.contribution';
55
51
  import { IntelligentCompletionsRegistry } from './contrib/intelligent-completions/intelligent-completions.feature.registry';
@@ -190,10 +186,6 @@ export class AINativeModule extends BrowserModule {
190
186
  token: TerminalRegistryToken,
191
187
  useClass: TerminalFeatureRegistry,
192
188
  },
193
- {
194
- token: ImageUploadProviderRegistryToken,
195
- useClass: ImageUploadProviderRegistry,
196
- },
197
189
  {
198
190
  token: LanguageParserService,
199
191
  useClass: LanguageParserService,
@@ -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,
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
 
@@ -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
 
@@ -141,14 +140,13 @@ export type ChatWelcomeRender = (props: {
141
140
  export type ChatAIRoleRender = (props: { content: string }) => React.ReactElement | React.JSX.Element;
142
141
  export type ChatUserRoleRender = (props: {
143
142
  content: string;
144
- images?: string[];
145
143
  agentId?: string;
146
144
  command?: string;
147
145
  }) => React.ReactElement | React.JSX.Element;
148
146
  export type ChatThinkingRender = (props: { thinkingText?: string }) => React.ReactElement | React.JSX.Element;
149
147
  export type ChatThinkingResultRender = (props: { thinkingResult?: string }) => React.ReactElement | React.JSX.Element;
150
148
  export type ChatInputRender = (props: {
151
- onSend: (value: string, images?: string[], agentId?: string, command?: string) => void;
149
+ onSend: (value: string, agentId?: string, command?: string) => void;
152
150
  onValueChange?: (value: string) => void;
153
151
  onExpand?: (value: boolean) => void;
154
152
  placeholder?: string;
@@ -291,15 +289,6 @@ export interface IProblemFixProviderRegistry {
291
289
  registerHoverFixProvider(handler: IHoverFixHandler): void;
292
290
  }
293
291
 
294
- export interface IImageUploadProvider {
295
- imageUpload(file: File): Promise<DataContent | URL>;
296
- }
297
-
298
- export interface IImageUploadProviderRegistry {
299
- registerImageUploadProvider(provider: IImageUploadProvider): void;
300
- getImageUploadProvider(): IImageUploadProvider | undefined;
301
- }
302
-
303
292
  export const AINativeCoreContribution = Symbol('AINativeCoreContribution');
304
293
 
305
294
  export interface AINativeCoreContribution {
@@ -343,11 +332,6 @@ export interface AINativeCoreContribution {
343
332
  * @param provider
344
333
  */
345
334
  registerChatAgentPromptProvider?(): void;
346
-
347
- /**
348
- * 注册图片上传的能力
349
- */
350
- registerImageUploadProvider?(registry: IImageUploadProviderRegistry): void;
351
335
  }
352
336
 
353
337
  // MCP Server 的 贡献点
@@ -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
  }