@opensumi/ide-ai-native 3.8.3-next-1741927421.0 → 3.8.3-next-1741934038.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 (83) 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 -47
  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/model/msg-history-manager.d.ts +1 -1
  45. package/lib/browser/model/msg-history-manager.d.ts.map +1 -1
  46. package/lib/browser/model/msg-history-manager.js.map +1 -1
  47. package/lib/browser/types.d.ts +1 -14
  48. package/lib/browser/types.d.ts.map +1 -1
  49. package/lib/browser/types.js.map +1 -1
  50. package/lib/common/index.d.ts +0 -6
  51. package/lib/common/index.d.ts.map +1 -1
  52. package/lib/common/index.js.map +1 -1
  53. package/lib/common/llm-context.d.ts.map +1 -1
  54. package/lib/common/llm-context.js.map +1 -1
  55. package/lib/node/base-language-model.d.ts +1 -1
  56. package/lib/node/base-language-model.d.ts.map +1 -1
  57. package/lib/node/base-language-model.js +4 -15
  58. package/lib/node/base-language-model.js.map +1 -1
  59. package/package.json +23 -23
  60. package/src/browser/ai-core.contribution.ts +0 -6
  61. package/src/browser/chat/chat-manager.service.ts +2 -3
  62. package/src/browser/chat/chat-proxy.service.ts +0 -1
  63. package/src/browser/chat/chat.internal.service.ts +2 -2
  64. package/src/browser/chat/chat.view.tsx +8 -18
  65. package/src/browser/components/ChatEditor.tsx +0 -8
  66. package/src/browser/components/ChatInput.tsx +2 -2
  67. package/src/browser/components/ChatMentionInput.tsx +4 -92
  68. package/src/browser/components/components.module.less +0 -47
  69. package/src/browser/components/mention-input/mention-input.module.less +0 -1
  70. package/src/browser/components/mention-input/mention-input.tsx +1 -18
  71. package/src/browser/components/mention-input/types.ts +1 -3
  72. package/src/browser/context/llm-context.service.ts +0 -2
  73. package/src/browser/index.ts +0 -8
  74. package/src/browser/model/msg-history-manager.ts +1 -1
  75. package/src/browser/types.ts +1 -17
  76. package/src/common/index.ts +0 -6
  77. package/src/common/llm-context.ts +0 -2
  78. package/src/node/base-language-model.ts +3 -25
  79. package/lib/browser/contrib/image-upload/image-upload.feature.registry.d.ts +0 -8
  80. package/lib/browser/contrib/image-upload/image-upload.feature.registry.d.ts.map +0 -1
  81. package/lib/browser/contrib/image-upload/image-upload.feature.registry.js +0 -19
  82. package/lib/browser/contrib/image-upload/image-upload.feature.registry.js.map +0 -1
  83. package/src/browser/contrib/image-upload/image-upload.feature.registry.ts +0 -18
@@ -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,50 +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
- &:hover {
639
- cursor: pointer;
640
- transform: scale(1.2);
641
- }
642
- :global(.codicon) {
643
- font-size: 12px;
644
- }
645
- }
646
- }
647
-
648
- .image_wrapper {
649
- display: inline-block;
650
- }
@@ -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
- e.preventDefault();
282
- const items = e.clipboardData.items;
283
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
284
- for (let i = 0; i < items.length; i++) {
285
- if (items[i].kind === 'file' && items[i].type.startsWith('image/')) {
286
- const file = items[i].getAsFile();
287
- if (file && onImageUpload) {
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,
@@ -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
  */
@@ -204,7 +200,6 @@ export interface IChatAgentRequest {
204
200
  requestId: string;
205
201
  command?: string;
206
202
  message: string;
207
- images?: string[];
208
203
  regenerate?: boolean;
209
204
  }
210
205
 
@@ -242,7 +237,6 @@ export type IChatFollowup = IChatReplyFollowup | IChatResponseCommandFollowup;
242
237
 
243
238
  export interface IChatRequestMessage {
244
239
  prompt: string;
245
- images?: string[];
246
240
  agentId: string;
247
241
  command?: string;
248
242
  }
@@ -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 {
@@ -1,13 +1,4 @@
1
- import {
2
- CoreMessage,
3
- CoreUserMessage,
4
- ImagePart,
5
- TextPart,
6
- ToolExecutionOptions,
7
- jsonSchema,
8
- streamText,
9
- tool,
10
- } from 'ai';
1
+ import { CoreMessage, ToolExecutionOptions, jsonSchema, streamText, tool } from 'ai';
11
2
 
12
3
  import { Autowired, Injectable } from '@opensumi/di';
13
4
  import { IAIBackServiceOption } from '@opensumi/ide-core-common';
@@ -57,7 +48,6 @@ export abstract class BaseLanguageModel {
57
48
  options.trimTexts,
58
49
  options.system,
59
50
  options.maxTokens,
60
- options.images,
61
51
  cancellationToken,
62
52
  );
63
53
  }
@@ -87,7 +77,6 @@ export abstract class BaseLanguageModel {
87
77
  trimTexts?: [string, string],
88
78
  systemPrompt?: string,
89
79
  maxTokens?: number,
90
- images?: string[],
91
80
  cancellationToken?: CancellationToken,
92
81
  ): Promise<any> {
93
82
  try {
@@ -100,18 +89,7 @@ export abstract class BaseLanguageModel {
100
89
  });
101
90
  }
102
91
 
103
- const messages: CoreMessage[] = [
104
- ...history,
105
- {
106
- role: 'user',
107
- content: images?.length
108
- ? [
109
- { type: 'text', text: request } as TextPart,
110
- ...images.map((image) => ({ type: 'image', image: new URL(image) } as ImagePart)),
111
- ]
112
- : request,
113
- },
114
- ];
92
+ const messages: CoreMessage[] = [...history, { role: 'user', content: request }];
115
93
  const modelInfo = modelId ? this.getModelInfo(modelId) : undefined;
116
94
  const stream = streamText({
117
95
  model: this.getModelIdentifier(provider, modelId),
@@ -123,9 +101,9 @@ export abstract class BaseLanguageModel {
123
101
  maxTokens,
124
102
  temperature: modelInfo?.temperature || 0,
125
103
  topP: modelInfo?.topP || 0.8,
104
+ topK: modelInfo?.topK || 1,
126
105
  system: systemPrompt,
127
106
  providerOptions,
128
- ...(!images?.length && { topK: modelInfo?.topK || 1 }),
129
107
  });
130
108
 
131
109
  // 状态跟踪变量
@@ -1,8 +0,0 @@
1
- import { IImageUploadProvider, IImageUploadProviderRegistry } from '../../types';
2
- export declare class ImageUploadProviderRegistry implements IImageUploadProviderRegistry {
3
- private imageUploadProvider;
4
- registerImageUploadProvider(provider: IImageUploadProvider): void;
5
- getImageUploadProvider(): IImageUploadProvider | undefined;
6
- }
7
- export declare const ImageUploadProviderRegistryToken: unique symbol;
8
- //# sourceMappingURL=image-upload.feature.registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"image-upload.feature.registry.d.ts","sourceRoot":"","sources":["../../../../src/browser/contrib/image-upload/image-upload.feature.registry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAEjF,qBACa,2BAA4B,YAAW,4BAA4B;IAC9E,OAAO,CAAC,mBAAmB,CAAmC;IAE9D,2BAA2B,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI;IAIjE,sBAAsB,IAAI,oBAAoB,GAAG,SAAS;CAG3D;AAED,eAAO,MAAM,gCAAgC,eAAwC,CAAC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImageUploadProviderRegistryToken = exports.ImageUploadProviderRegistry = void 0;
4
- const tslib_1 = require("tslib");
5
- const di_1 = require("@opensumi/di");
6
- let ImageUploadProviderRegistry = class ImageUploadProviderRegistry {
7
- registerImageUploadProvider(provider) {
8
- this.imageUploadProvider = provider;
9
- }
10
- getImageUploadProvider() {
11
- return this.imageUploadProvider;
12
- }
13
- };
14
- exports.ImageUploadProviderRegistry = ImageUploadProviderRegistry;
15
- exports.ImageUploadProviderRegistry = ImageUploadProviderRegistry = tslib_1.__decorate([
16
- (0, di_1.Injectable)()
17
- ], ImageUploadProviderRegistry);
18
- exports.ImageUploadProviderRegistryToken = Symbol('ImageUploadProviderRegistry');
19
- //# sourceMappingURL=image-upload.feature.registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"image-upload.feature.registry.js","sourceRoot":"","sources":["../../../../src/browser/contrib/image-upload/image-upload.feature.registry.ts"],"names":[],"mappings":";;;;AAAA,qCAA0C;AAKnC,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAGtC,2BAA2B,CAAC,QAA8B;QACxD,IAAI,CAAC,mBAAmB,GAAG,QAAQ,CAAC;IACtC,CAAC;IAED,sBAAsB;QACpB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;CACF,CAAA;AAVY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,eAAU,GAAE;GACA,2BAA2B,CAUvC;AAEY,QAAA,gCAAgC,GAAG,MAAM,CAAC,6BAA6B,CAAC,CAAC"}
@@ -1,18 +0,0 @@
1
- import { Injectable } from '@opensumi/di';
2
-
3
- import { IImageUploadProvider, IImageUploadProviderRegistry } from '../../types';
4
-
5
- @Injectable()
6
- export class ImageUploadProviderRegistry implements IImageUploadProviderRegistry {
7
- private imageUploadProvider: IImageUploadProvider | undefined;
8
-
9
- registerImageUploadProvider(provider: IImageUploadProvider): void {
10
- this.imageUploadProvider = provider;
11
- }
12
-
13
- getImageUploadProvider(): IImageUploadProvider | undefined {
14
- return this.imageUploadProvider;
15
- }
16
- }
17
-
18
- export const ImageUploadProviderRegistryToken = Symbol('ImageUploadProviderRegistry');