@opensumi/ide-ai-native 3.8.3-next-1742180589.0 → 3.8.3-next-1742193440.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.
- package/lib/browser/chat/chat-manager.service.d.ts +1 -1
- package/lib/browser/chat/chat-manager.service.d.ts.map +1 -1
- package/lib/browser/chat/chat-manager.service.js +3 -2
- package/lib/browser/chat/chat-manager.service.js.map +1 -1
- package/lib/browser/chat/chat-model.d.ts.map +1 -1
- package/lib/browser/chat/chat-model.js +11 -2
- package/lib/browser/chat/chat-model.js.map +1 -1
- package/lib/browser/chat/chat-proxy.service.d.ts.map +1 -1
- package/lib/browser/chat/chat-proxy.service.js +1 -0
- package/lib/browser/chat/chat-proxy.service.js.map +1 -1
- package/lib/browser/chat/chat.feature.registry.d.ts +4 -1
- package/lib/browser/chat/chat.feature.registry.d.ts.map +1 -1
- package/lib/browser/chat/chat.feature.registry.js +6 -0
- package/lib/browser/chat/chat.feature.registry.js.map +1 -1
- package/lib/browser/chat/chat.internal.service.d.ts +1 -1
- package/lib/browser/chat/chat.internal.service.d.ts.map +1 -1
- package/lib/browser/chat/chat.internal.service.js +2 -2
- package/lib/browser/chat/chat.internal.service.js.map +1 -1
- package/lib/browser/chat/chat.view.d.ts.map +1 -1
- package/lib/browser/chat/chat.view.js +10 -7
- package/lib/browser/chat/chat.view.js.map +1 -1
- package/lib/browser/components/ChatEditor.d.ts +2 -1
- package/lib/browser/components/ChatEditor.d.ts.map +1 -1
- package/lib/browser/components/ChatEditor.js +5 -2
- package/lib/browser/components/ChatEditor.js.map +1 -1
- package/lib/browser/components/ChatInput.d.ts +1 -1
- package/lib/browser/components/ChatInput.d.ts.map +1 -1
- package/lib/browser/components/ChatInput.js +1 -1
- package/lib/browser/components/ChatInput.js.map +1 -1
- package/lib/browser/components/ChatMentionInput.d.ts +3 -1
- package/lib/browser/components/ChatMentionInput.d.ts.map +1 -1
- package/lib/browser/components/ChatMentionInput.js +54 -3
- package/lib/browser/components/ChatMentionInput.js.map +1 -1
- package/lib/browser/components/components.module.less +49 -0
- package/lib/browser/components/mention-input/mention-input.d.ts.map +1 -1
- package/lib/browser/components/mention-input/mention-input.js +124 -60
- package/lib/browser/components/mention-input/mention-input.js.map +1 -1
- package/lib/browser/components/mention-input/types.d.ts +3 -1
- package/lib/browser/components/mention-input/types.d.ts.map +1 -1
- package/lib/browser/components/mention-input/types.js.map +1 -1
- package/lib/browser/context/llm-context.service.d.ts.map +1 -1
- package/lib/browser/context/llm-context.service.js.map +1 -1
- package/lib/browser/mcp/base-apply.service.d.ts.map +1 -1
- package/lib/browser/mcp/base-apply.service.js +5 -6
- package/lib/browser/mcp/base-apply.service.js.map +1 -1
- package/lib/browser/mcp/config/components/mcp-config.view.js +3 -3
- package/lib/browser/mcp/config/components/mcp-config.view.js.map +1 -1
- package/lib/browser/model/msg-history-manager.d.ts +1 -1
- package/lib/browser/model/msg-history-manager.d.ts.map +1 -1
- package/lib/browser/model/msg-history-manager.js.map +1 -1
- package/lib/browser/types.d.ts +7 -1
- package/lib/browser/types.d.ts.map +1 -1
- package/lib/browser/types.js.map +1 -1
- package/lib/common/index.d.ts +6 -0
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/llm-context.d.ts.map +1 -1
- package/lib/common/llm-context.js.map +1 -1
- package/lib/node/base-language-model.d.ts +1 -1
- package/lib/node/base-language-model.d.ts.map +1 -1
- package/lib/node/base-language-model.js +15 -4
- package/lib/node/base-language-model.js.map +1 -1
- package/package.json +23 -23
- package/src/browser/chat/chat-manager.service.ts +3 -2
- package/src/browser/chat/chat-model.ts +10 -2
- package/src/browser/chat/chat-proxy.service.ts +1 -0
- package/src/browser/chat/chat.feature.registry.ts +10 -1
- package/src/browser/chat/chat.internal.service.ts +2 -2
- package/src/browser/chat/chat.view.tsx +18 -8
- package/src/browser/components/ChatEditor.tsx +8 -0
- package/src/browser/components/ChatInput.tsx +2 -2
- package/src/browser/components/ChatMentionInput.tsx +100 -6
- package/src/browser/components/components.module.less +49 -0
- package/src/browser/components/mention-input/mention-input.tsx +145 -64
- package/src/browser/components/mention-input/types.ts +3 -1
- package/src/browser/context/llm-context.service.ts +2 -0
- package/src/browser/mcp/base-apply.service.ts +7 -6
- package/src/browser/mcp/config/components/mcp-config.view.tsx +3 -3
- package/src/browser/model/msg-history-manager.ts +1 -1
- package/src/browser/types.ts +8 -1
- package/src/common/index.ts +6 -0
- package/src/common/llm-context.ts +2 -0
- package/src/node/base-language-model.ts +25 -3
|
@@ -288,8 +288,11 @@ export abstract class BaseApplyService extends WithEventBus {
|
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
if (this.activePreviewerMap.has(codeBlock.relativePath)) {
|
|
291
|
-
// 有正在进行的 apply
|
|
292
|
-
this.
|
|
291
|
+
// 有正在进行的 apply,则销毁previewer和监听器(不需要操作 reject,因为总是基于磁盘版本改写的)
|
|
292
|
+
this.editorListenerMap.disposeKey(
|
|
293
|
+
URI.file(path.join(this.appConfig.workspaceDir, codeBlock.relativePath)).toString(),
|
|
294
|
+
);
|
|
295
|
+
this.activePreviewerMap.disposeKey(codeBlock.relativePath);
|
|
293
296
|
}
|
|
294
297
|
// trigger diffPreivewer & return expected diff result directly
|
|
295
298
|
const result = await this.editorService.open(
|
|
@@ -449,10 +452,8 @@ export abstract class BaseApplyService extends WithEventBus {
|
|
|
449
452
|
?.livePreviewDiffDecorationModel.discardUnProcessed();
|
|
450
453
|
this.activePreviewerMap.disposeKey(blockData.relativePath);
|
|
451
454
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
this.updateCodeBlock(blockData);
|
|
455
|
-
}
|
|
455
|
+
blockData.status = 'cancelled';
|
|
456
|
+
this.updateCodeBlock(blockData);
|
|
456
457
|
}
|
|
457
458
|
}
|
|
458
459
|
|
|
@@ -34,7 +34,7 @@ export const MCPConfigView: React.FC = () => {
|
|
|
34
34
|
return {
|
|
35
35
|
...server,
|
|
36
36
|
name: server.name,
|
|
37
|
-
isStarted: runningServer
|
|
37
|
+
isStarted: !!runningServer,
|
|
38
38
|
tools: runningServer?.tools,
|
|
39
39
|
};
|
|
40
40
|
}) as MCPServer[];
|
|
@@ -107,8 +107,8 @@ export const MCPConfigView: React.FC = () => {
|
|
|
107
107
|
setLoadingServer(undefined);
|
|
108
108
|
} catch (error) {
|
|
109
109
|
const msg = error.message || error;
|
|
110
|
-
logger.error(`Failed to ${start ? 'start' : 'stop'} server ${serverName}:`,
|
|
111
|
-
messageService.error(
|
|
110
|
+
logger.error(`Failed to ${start ? 'start' : 'stop'} server ${serverName}:`, error);
|
|
111
|
+
messageService.error(error.message);
|
|
112
112
|
setLoadingServer(undefined);
|
|
113
113
|
}
|
|
114
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'>>,
|
|
65
|
+
message: Required<Pick<IExcludeMessage, 'agentId' | 'agentCommand' | 'content' | 'relationId' | 'images'>>,
|
|
66
66
|
): string {
|
|
67
67
|
return this.doAddMessage({
|
|
68
68
|
...message,
|
package/src/browser/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DataContent } from 'ai';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { ZodSchema } from 'zod';
|
|
3
4
|
|
|
@@ -129,6 +130,7 @@ export interface IChatSlashCommandHandler {
|
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
export interface IChatFeatureRegistry {
|
|
133
|
+
registerImageUploadProvider(provider: IImageUploadProvider): void;
|
|
132
134
|
registerWelcome(content: IChatWelcomeMessageContent | React.ReactNode, sampleQuestions?: ISampleQuestions[]): void;
|
|
133
135
|
registerSlashCommand(command: IChatSlashCommandItem, handler: IChatSlashCommandHandler): void;
|
|
134
136
|
}
|
|
@@ -140,13 +142,14 @@ export type ChatWelcomeRender = (props: {
|
|
|
140
142
|
export type ChatAIRoleRender = (props: { content: string }) => React.ReactElement | React.JSX.Element;
|
|
141
143
|
export type ChatUserRoleRender = (props: {
|
|
142
144
|
content: string;
|
|
145
|
+
images?: string[];
|
|
143
146
|
agentId?: string;
|
|
144
147
|
command?: string;
|
|
145
148
|
}) => React.ReactElement | React.JSX.Element;
|
|
146
149
|
export type ChatThinkingRender = (props: { thinkingText?: string }) => React.ReactElement | React.JSX.Element;
|
|
147
150
|
export type ChatThinkingResultRender = (props: { thinkingResult?: string }) => React.ReactElement | React.JSX.Element;
|
|
148
151
|
export type ChatInputRender = (props: {
|
|
149
|
-
onSend: (value: string, agentId?: string, command?: string) => void;
|
|
152
|
+
onSend: (value: string, images?: string[], agentId?: string, command?: string) => void;
|
|
150
153
|
onValueChange?: (value: string) => void;
|
|
151
154
|
onExpand?: (value: boolean) => void;
|
|
152
155
|
placeholder?: string;
|
|
@@ -289,6 +292,10 @@ export interface IProblemFixProviderRegistry {
|
|
|
289
292
|
registerHoverFixProvider(handler: IHoverFixHandler): void;
|
|
290
293
|
}
|
|
291
294
|
|
|
295
|
+
export interface IImageUploadProvider {
|
|
296
|
+
imageUpload(file: File): Promise<DataContent | URL>;
|
|
297
|
+
}
|
|
298
|
+
|
|
292
299
|
export const AINativeCoreContribution = Symbol('AINativeCoreContribution');
|
|
293
300
|
|
|
294
301
|
export interface AINativeCoreContribution {
|
package/src/common/index.ts
CHANGED
|
@@ -52,6 +52,10 @@ export interface IChatMessageStructure {
|
|
|
52
52
|
* 用于 chat 面板展示
|
|
53
53
|
*/
|
|
54
54
|
message: string;
|
|
55
|
+
/**
|
|
56
|
+
* 图片
|
|
57
|
+
*/
|
|
58
|
+
images?: string[];
|
|
55
59
|
/**
|
|
56
60
|
* 实际调用的 prompt
|
|
57
61
|
*/
|
|
@@ -207,6 +211,7 @@ export interface IChatAgentRequest {
|
|
|
207
211
|
requestId: string;
|
|
208
212
|
command?: string;
|
|
209
213
|
message: string;
|
|
214
|
+
images?: string[];
|
|
210
215
|
regenerate?: boolean;
|
|
211
216
|
}
|
|
212
217
|
|
|
@@ -244,6 +249,7 @@ export type IChatFollowup = IChatReplyFollowup | IChatResponseCommandFollowup;
|
|
|
244
249
|
|
|
245
250
|
export interface IChatRequestMessage {
|
|
246
251
|
prompt: string;
|
|
252
|
+
images?: string[];
|
|
247
253
|
agentId: string;
|
|
248
254
|
command?: string;
|
|
249
255
|
}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
CoreMessage,
|
|
3
|
+
CoreUserMessage,
|
|
4
|
+
ImagePart,
|
|
5
|
+
TextPart,
|
|
6
|
+
ToolExecutionOptions,
|
|
7
|
+
jsonSchema,
|
|
8
|
+
streamText,
|
|
9
|
+
tool,
|
|
10
|
+
} from 'ai';
|
|
2
11
|
|
|
3
12
|
import { Autowired, Injectable } from '@opensumi/di';
|
|
4
13
|
import { IAIBackServiceOption } from '@opensumi/ide-core-common';
|
|
@@ -48,6 +57,7 @@ export abstract class BaseLanguageModel {
|
|
|
48
57
|
options.trimTexts,
|
|
49
58
|
options.system,
|
|
50
59
|
options.maxTokens,
|
|
60
|
+
options.images,
|
|
51
61
|
cancellationToken,
|
|
52
62
|
);
|
|
53
63
|
}
|
|
@@ -77,6 +87,7 @@ export abstract class BaseLanguageModel {
|
|
|
77
87
|
trimTexts?: [string, string],
|
|
78
88
|
systemPrompt?: string,
|
|
79
89
|
maxTokens?: number,
|
|
90
|
+
images?: string[],
|
|
80
91
|
cancellationToken?: CancellationToken,
|
|
81
92
|
): Promise<any> {
|
|
82
93
|
try {
|
|
@@ -89,7 +100,18 @@ export abstract class BaseLanguageModel {
|
|
|
89
100
|
});
|
|
90
101
|
}
|
|
91
102
|
|
|
92
|
-
const messages: CoreMessage[] = [
|
|
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
|
+
];
|
|
93
115
|
const modelInfo = modelId ? this.getModelInfo(modelId) : undefined;
|
|
94
116
|
const stream = streamText({
|
|
95
117
|
model: this.getModelIdentifier(provider, modelId),
|
|
@@ -101,9 +123,9 @@ export abstract class BaseLanguageModel {
|
|
|
101
123
|
maxTokens,
|
|
102
124
|
temperature: modelInfo?.temperature || 0,
|
|
103
125
|
topP: modelInfo?.topP || 0.8,
|
|
104
|
-
topK: modelInfo?.topK || 1,
|
|
105
126
|
system: systemPrompt,
|
|
106
127
|
providerOptions,
|
|
128
|
+
...(!images?.length && { topK: modelInfo?.topK || 1 }),
|
|
107
129
|
});
|
|
108
130
|
|
|
109
131
|
// 状态跟踪变量
|