@opensumi/ide-ai-native 3.8.2-next-1741418699.0 → 3.8.2
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/ai-core.contribution.d.ts.map +1 -1
- package/lib/browser/ai-core.contribution.js +20 -0
- package/lib/browser/ai-core.contribution.js.map +1 -1
- package/lib/browser/chat/apply.service.js +1 -1
- package/lib/browser/chat/apply.service.js.map +1 -1
- package/lib/browser/chat/chat-manager.service.d.ts +2 -1
- package/lib/browser/chat/chat-manager.service.d.ts.map +1 -1
- package/lib/browser/chat/chat-manager.service.js +26 -7
- package/lib/browser/chat/chat-manager.service.js.map +1 -1
- package/lib/browser/chat/chat-model.d.ts +3 -3
- package/lib/browser/chat/chat-model.d.ts.map +1 -1
- package/lib/browser/chat/chat-model.js +22 -9
- package/lib/browser/chat/chat-model.js.map +1 -1
- package/lib/browser/chat/chat-proxy.service.d.ts +1 -0
- package/lib/browser/chat/chat-proxy.service.d.ts.map +1 -1
- package/lib/browser/chat/chat-proxy.service.js +2 -0
- package/lib/browser/chat/chat-proxy.service.js.map +1 -1
- package/lib/browser/chat/chat.view.d.ts.map +1 -1
- package/lib/browser/chat/chat.view.js +59 -2
- package/lib/browser/chat/chat.view.js.map +1 -1
- package/lib/browser/components/ApplyStatus.d.ts +7 -0
- package/lib/browser/components/ApplyStatus.d.ts.map +1 -0
- package/lib/browser/components/ApplyStatus.js +32 -0
- package/lib/browser/components/ApplyStatus.js.map +1 -0
- package/lib/browser/components/ChangeList.d.ts +17 -0
- package/lib/browser/components/ChangeList.d.ts.map +1 -0
- package/lib/browser/components/ChangeList.js +72 -0
- package/lib/browser/components/ChangeList.js.map +1 -0
- package/lib/browser/components/change-list.module.less +126 -0
- package/lib/browser/components/chat-history.module.less +1 -1
- package/lib/browser/components/components.module.less +14 -0
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +4 -4
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/mcp/base-apply.service.d.ts +15 -7
- package/lib/browser/mcp/base-apply.service.d.ts.map +1 -1
- package/lib/browser/mcp/base-apply.service.js +84 -54
- package/lib/browser/mcp/base-apply.service.js.map +1 -1
- package/lib/browser/mcp/config/components/mcp-config.view.d.ts.map +1 -1
- package/lib/browser/mcp/config/components/mcp-config.view.js +18 -28
- package/lib/browser/mcp/config/components/mcp-config.view.js.map +1 -1
- package/lib/browser/mcp/config/components/mcp-server-form.d.ts.map +1 -1
- package/lib/browser/mcp/config/components/mcp-server-form.js +25 -33
- package/lib/browser/mcp/config/components/mcp-server-form.js.map +1 -1
- package/lib/browser/mcp/tools/components/EditFile.js +3 -24
- package/lib/browser/mcp/tools/components/EditFile.js.map +1 -1
- package/lib/browser/mcp/tools/components/ExpandableFileList.js +3 -2
- package/lib/browser/mcp/tools/components/ExpandableFileList.js.map +1 -1
- package/lib/browser/mcp/tools/handlers/EditFile.js +2 -2
- package/lib/browser/mcp/tools/handlers/EditFile.js.map +1 -1
- package/lib/browser/model/msg-history-manager.d.ts +0 -2
- package/lib/browser/model/msg-history-manager.d.ts.map +1 -1
- package/lib/browser/model/msg-history-manager.js +1 -6
- package/lib/browser/model/msg-history-manager.js.map +1 -1
- package/lib/browser/preferences/schema.d.ts.map +1 -1
- package/lib/browser/preferences/schema.js +8 -0
- package/lib/browser/preferences/schema.js.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff-manager.js +2 -2
- package/lib/browser/widget/inline-diff/inline-diff-manager.js.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff.controller.d.ts +1 -1
- package/lib/browser/widget/inline-diff/inline-diff.controller.d.ts.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff.controller.js.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff.service.d.ts +3 -2
- package/lib/browser/widget/inline-diff/inline-diff.service.d.ts.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff.service.js.map +1 -1
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.d.ts +1 -1
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.d.ts.map +1 -1
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.js.map +1 -1
- package/lib/browser/widget/inline-stream-diff/live-preview.component.d.ts +0 -33
- package/lib/browser/widget/inline-stream-diff/live-preview.component.d.ts.map +1 -1
- package/lib/browser/widget/inline-stream-diff/live-preview.component.js +1 -6
- package/lib/browser/widget/inline-stream-diff/live-preview.component.js.map +1 -1
- package/lib/browser/widget/inline-stream-diff/live-preview.decoration.d.ts.map +1 -1
- package/lib/browser/widget/inline-stream-diff/live-preview.decoration.js +15 -14
- package/lib/browser/widget/inline-stream-diff/live-preview.decoration.js.map +1 -1
- package/lib/common/index.d.ts +7 -2
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +3 -2
- package/lib/common/index.js.map +1 -1
- package/lib/common/types.d.ts +33 -0
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/types.js +6 -1
- package/lib/common/types.js.map +1 -1
- package/package.json +23 -23
- package/src/browser/ai-core.contribution.ts +28 -0
- package/src/browser/chat/apply.service.ts +1 -1
- package/src/browser/chat/chat-manager.service.ts +54 -33
- package/src/browser/chat/chat-model.ts +22 -8
- package/src/browser/chat/chat-proxy.service.ts +2 -0
- package/src/browser/chat/chat.view.tsx +78 -4
- package/src/browser/components/ApplyStatus.tsx +44 -0
- package/src/browser/components/ChangeList.tsx +131 -0
- package/src/browser/components/change-list.module.less +126 -0
- package/src/browser/components/chat-history.module.less +1 -1
- package/src/browser/components/components.module.less +14 -0
- package/src/browser/index.ts +5 -4
- package/src/browser/mcp/base-apply.service.ts +93 -64
- package/src/browser/mcp/config/components/mcp-config.view.tsx +12 -23
- package/src/browser/mcp/config/components/mcp-server-form.tsx +54 -68
- package/src/browser/mcp/tools/components/EditFile.tsx +3 -37
- package/src/browser/mcp/tools/components/ExpandableFileList.tsx +3 -1
- package/src/browser/mcp/tools/handlers/EditFile.ts +2 -2
- package/src/browser/model/msg-history-manager.ts +2 -11
- package/src/browser/preferences/schema.ts +8 -0
- package/src/browser/widget/inline-diff/inline-diff-manager.tsx +2 -2
- package/src/browser/widget/inline-diff/inline-diff.controller.ts +2 -1
- package/src/browser/widget/inline-diff/inline-diff.service.ts +3 -2
- package/src/browser/widget/inline-stream-diff/inline-stream-diff.handler.tsx +4 -4
- package/src/browser/widget/inline-stream-diff/live-preview.component.tsx +0 -34
- package/src/browser/widget/inline-stream-diff/live-preview.decoration.tsx +8 -9
- package/src/common/index.ts +9 -2
- package/src/common/types.ts +35 -0
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
path,
|
|
13
13
|
useInjectable,
|
|
14
14
|
} from '@opensumi/ide-core-browser';
|
|
15
|
-
import { Loading } from '@opensumi/ide-core-browser/lib/components/ai-native';
|
|
16
15
|
import { WorkbenchEditorService } from '@opensumi/ide-editor';
|
|
17
16
|
import { ILanguageService } from '@opensumi/monaco-editor-core/esm/vs/editor/common/languages/language';
|
|
18
17
|
import { IModelService } from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/model';
|
|
19
18
|
import { StandaloneServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
20
19
|
|
|
21
20
|
import { CodeBlockData } from '../../../../common/types';
|
|
21
|
+
import { ApplyStatus } from '../../../components/ApplyStatus';
|
|
22
22
|
import { ChatMarkdown } from '../../../components/ChatMarkdown';
|
|
23
23
|
import { IMCPServerToolComponentProps } from '../../../types';
|
|
24
24
|
import { BaseApplyService } from '../../base-apply.service';
|
|
@@ -76,7 +76,7 @@ export const EditFileToolComponent = (props: IMCPServerToolComponentProps) => {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
return [
|
|
79
|
-
instructions && <p>{instructions}</p>,
|
|
79
|
+
instructions && <p key={'edit-file-tool-instructions'}>{instructions}</p>,
|
|
80
80
|
<div className={styles['edit-file-tool']} key={'edit-file-tool'}>
|
|
81
81
|
<div
|
|
82
82
|
className={cls(styles['edit-file-tool-header'], {
|
|
@@ -96,7 +96,7 @@ export const EditFileToolComponent = (props: IMCPServerToolComponentProps) => {
|
|
|
96
96
|
{codeBlockData.iterationCount > 1 && (
|
|
97
97
|
<span className={styles['edit-file-tool-iteration-count']}>{codeBlockData.iterationCount}/3</span>
|
|
98
98
|
)}
|
|
99
|
-
{
|
|
99
|
+
<ApplyStatus status={codeBlockData.status} error={props.result} />
|
|
100
100
|
</div>
|
|
101
101
|
<div className={styles.right}>
|
|
102
102
|
<Popover title={'Show Code'} id={'edit-file-tool-show-code'}>
|
|
@@ -137,37 +137,3 @@ export const EditFileToolComponent = (props: IMCPServerToolComponentProps) => {
|
|
|
137
137
|
),
|
|
138
138
|
];
|
|
139
139
|
};
|
|
140
|
-
|
|
141
|
-
const renderStatus = (codeBlockData: CodeBlockData, error?: string) => {
|
|
142
|
-
const status = codeBlockData.status;
|
|
143
|
-
switch (status) {
|
|
144
|
-
case 'generating':
|
|
145
|
-
return <Loading />;
|
|
146
|
-
case 'pending':
|
|
147
|
-
return (
|
|
148
|
-
<Popover title='Pending' id={'edit-file-tool-status-pending'}>
|
|
149
|
-
<Icon iconClass='codicon codicon-circle-large' />
|
|
150
|
-
</Popover>
|
|
151
|
-
);
|
|
152
|
-
case 'success':
|
|
153
|
-
return (
|
|
154
|
-
<Popover title='Success' id={'edit-file-tool-status-success'}>
|
|
155
|
-
<Icon iconClass='codicon codicon-check-all' />
|
|
156
|
-
</Popover>
|
|
157
|
-
);
|
|
158
|
-
case 'failed':
|
|
159
|
-
return (
|
|
160
|
-
<Popover title={`Failed (${error})`} id={'edit-file-tool-status-failed'}>
|
|
161
|
-
<Icon iconClass='codicon codicon-error' style={{ color: 'var(--debugConsole-errorForeground)' }} />
|
|
162
|
-
</Popover>
|
|
163
|
-
);
|
|
164
|
-
case 'cancelled':
|
|
165
|
-
return (
|
|
166
|
-
<Popover title='Cancelled' id={'edit-file-tool-status-cancelled'}>
|
|
167
|
-
<Icon iconClass='codicon codicon-close' style={{ color: 'var(--input-placeholderForeground)' }} />
|
|
168
|
-
</Popover>
|
|
169
|
-
);
|
|
170
|
-
default:
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
};
|
|
@@ -71,7 +71,9 @@ const ExpandableFileList: React.FC<ExpandableFileListProps> = ({
|
|
|
71
71
|
|
|
72
72
|
useEffect(() => {
|
|
73
73
|
const toDispose = chatService.sessionModel.history.onMessageAdditionalChange((additional) => {
|
|
74
|
-
|
|
74
|
+
if (additional[toolCallId]) {
|
|
75
|
+
setFileList(additional[toolCallId].files || []);
|
|
76
|
+
}
|
|
75
77
|
});
|
|
76
78
|
return () => {
|
|
77
79
|
toDispose.dispose();
|
|
@@ -13,8 +13,8 @@ export class EditFileHandler {
|
|
|
13
13
|
private applyService: BaseApplyService;
|
|
14
14
|
|
|
15
15
|
async handler(params: { targetFile: string; codeEdit: string; instructions?: string }, toolCallId: string) {
|
|
16
|
-
const { targetFile, codeEdit } = params;
|
|
17
|
-
const block = await this.applyService.registerCodeBlock(targetFile, codeEdit, toolCallId);
|
|
16
|
+
const { targetFile, codeEdit, instructions } = params;
|
|
17
|
+
const block = await this.applyService.registerCodeBlock(targetFile, codeEdit, toolCallId, instructions);
|
|
18
18
|
const blockData = await this.applyService.apply(block);
|
|
19
19
|
return blockData;
|
|
20
20
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { Injectable } from '@opensumi/di';
|
|
2
1
|
import { Disposable, Emitter, Event, uuid } from '@opensumi/ide-core-common';
|
|
3
|
-
import { ChatMessageRole } from '@opensumi/ide-core-common/lib/types/ai-native';
|
|
4
|
-
import { IHistoryChatMessage } from '@opensumi/ide-core-common/lib/types/ai-native';
|
|
2
|
+
import { ChatMessageRole, IHistoryChatMessage } from '@opensumi/ide-core-common/lib/types/ai-native';
|
|
5
3
|
|
|
6
4
|
type IExcludeMessage = Omit<IHistoryChatMessage, 'id' | 'order'>;
|
|
7
5
|
|
|
@@ -31,7 +29,6 @@ export class MsgHistoryManager extends Disposable {
|
|
|
31
29
|
public clearMessages() {
|
|
32
30
|
this.messageMap.clear();
|
|
33
31
|
this.messageAdditionalMap.clear();
|
|
34
|
-
this.startIndex = 0;
|
|
35
32
|
}
|
|
36
33
|
|
|
37
34
|
private doAddMessage(message: IExcludeMessage): string {
|
|
@@ -55,19 +52,13 @@ export class MsgHistoryManager extends Disposable {
|
|
|
55
52
|
return Array.from(this.messageMap.values()).sort((a, b) => a.order - b.order);
|
|
56
53
|
}
|
|
57
54
|
|
|
58
|
-
private startIndex = 0;
|
|
59
|
-
|
|
60
|
-
public get slicedMessageCount(): number {
|
|
61
|
-
return this.startIndex;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
55
|
public get lastMessageId(): string | undefined {
|
|
65
56
|
const list = this.messageList;
|
|
66
57
|
return list[list.length - 1]?.id;
|
|
67
58
|
}
|
|
68
59
|
|
|
69
60
|
public getMessages(): IHistoryChatMessage[] {
|
|
70
|
-
return this.messageList
|
|
61
|
+
return this.messageList;
|
|
71
62
|
}
|
|
72
63
|
|
|
73
64
|
public addUserMessage(
|
|
@@ -97,6 +97,14 @@ export const aiNativePreferenceSchema: PreferenceSchema = {
|
|
|
97
97
|
default: '',
|
|
98
98
|
description: localize('preference.ai.native.openai.baseURL.description'),
|
|
99
99
|
},
|
|
100
|
+
[AINativeSettingSectionsId.ContextWindow]: {
|
|
101
|
+
type: 'number',
|
|
102
|
+
description: localize('preference.ai.native.contextWindow.description'),
|
|
103
|
+
},
|
|
104
|
+
[AINativeSettingSectionsId.MaxTokens]: {
|
|
105
|
+
type: 'number',
|
|
106
|
+
description: localize('preference.ai.native.maxTokens.description'),
|
|
107
|
+
},
|
|
100
108
|
[AINativeSettingSectionsId.MCPServers]: {
|
|
101
109
|
type: 'array',
|
|
102
110
|
default: [],
|
|
@@ -114,13 +114,13 @@ export const InlineDiffManager: React.FC<{ resource: IResource }> = (props) => {
|
|
|
114
114
|
<div className={styles.mid}>
|
|
115
115
|
<IconWithPopover
|
|
116
116
|
icon='codicon codicon-check'
|
|
117
|
-
onClick={() => applyService.processAll(props.resource.uri
|
|
117
|
+
onClick={() => applyService.processAll('accept', props.resource.uri)}
|
|
118
118
|
content={localize('aiNative.inlineDiff.acceptAll')}
|
|
119
119
|
id='inline-diff-manager-accept-all'
|
|
120
120
|
/>
|
|
121
121
|
<IconWithPopover
|
|
122
122
|
icon='codicon codicon-close'
|
|
123
|
-
onClick={() => applyService.processAll(props.resource.uri
|
|
123
|
+
onClick={() => applyService.processAll('reject', props.resource.uri)}
|
|
124
124
|
content={localize('aiNative.inlineDiff.rejectAll')}
|
|
125
125
|
id='inline-diff-manager-reject-all'
|
|
126
126
|
/>
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
import { BaseAIMonacoEditorController } from '../../contrib/base';
|
|
24
24
|
import { EInlineDiffPreviewMode } from '../../preferences/schema';
|
|
25
25
|
import { InlineChatController } from '../inline-chat/inline-chat-controller';
|
|
26
|
-
import { EResultKind } from '../inline-chat/inline-chat.service';
|
|
27
26
|
import { BaseInlineStreamDiffHandler } from '../inline-stream-diff/inline-stream-diff.handler';
|
|
28
27
|
|
|
29
28
|
import {
|
|
@@ -34,6 +33,8 @@ import {
|
|
|
34
33
|
} from './inline-diff-previewer';
|
|
35
34
|
import { InlineDiffWidget } from './inline-diff-widget';
|
|
36
35
|
|
|
36
|
+
import type { EResultKind } from '../inline-chat/inline-chat.service';
|
|
37
|
+
|
|
37
38
|
type IInlineDiffPreviewer = BaseInlineDiffPreviewer<InlineDiffWidget | BaseInlineStreamDiffHandler>;
|
|
38
39
|
|
|
39
40
|
export class InlineDiffController extends BaseAIMonacoEditorController {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Injectable } from '@opensumi/di';
|
|
2
2
|
import { Emitter } from '@opensumi/ide-utils';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import type { IInlineDiffService } from '../../../common/index';
|
|
5
|
+
import type { IPartialEditEvent } from '../../../common/types';
|
|
5
6
|
|
|
6
7
|
@Injectable()
|
|
7
|
-
export class InlineDiffService {
|
|
8
|
+
export class InlineDiffService implements IInlineDiffService {
|
|
8
9
|
/**
|
|
9
10
|
* Used in `codeblitz`, do not remove it.
|
|
10
11
|
*/
|
|
@@ -11,13 +11,13 @@ import { IModelService } from '@opensumi/monaco-editor-core/esm/vs/editor/common
|
|
|
11
11
|
import { LineTokens } from '@opensumi/monaco-editor-core/esm/vs/editor/common/tokens/lineTokens';
|
|
12
12
|
import { UndoRedoGroup } from '@opensumi/monaco-editor-core/esm/vs/platform/undoRedo/common/undoRedo';
|
|
13
13
|
|
|
14
|
-
import { IDecorationSerializableState } from '../../model/enhanceDecorationsCollection';
|
|
15
|
-
import { IDiffPreviewerOptions, IInlineDiffPreviewerNode } from '../inline-diff/inline-diff-previewer';
|
|
16
|
-
|
|
17
14
|
import { InlineStreamDiffComputer } from './inline-stream-diff-computer';
|
|
18
|
-
import { IRemovedWidgetState } from './live-preview.component';
|
|
19
15
|
import { LivePreviewDiffDecorationModel } from './live-preview.decoration';
|
|
20
16
|
|
|
17
|
+
import type { IRemovedWidgetState } from './live-preview.component';
|
|
18
|
+
import type { IDecorationSerializableState } from '../../model/enhanceDecorationsCollection';
|
|
19
|
+
import type { IDiffPreviewerOptions, IInlineDiffPreviewerNode } from '../inline-diff/inline-diff-previewer';
|
|
20
|
+
|
|
21
21
|
interface IRangeChangeData {
|
|
22
22
|
removedTextLines: string[];
|
|
23
23
|
removedLinesOriginalRange: LineRange;
|
|
@@ -46,40 +46,6 @@ export interface IRemovedWidgetState {
|
|
|
46
46
|
position: IPosition;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export enum EPartialEdit {
|
|
50
|
-
accept = 'accept',
|
|
51
|
-
discard = 'discard',
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface IPartialEditEvent {
|
|
55
|
-
uri: URI;
|
|
56
|
-
/**
|
|
57
|
-
* 总 diff 数
|
|
58
|
-
*/
|
|
59
|
-
totalPartialEditCount: number;
|
|
60
|
-
/**
|
|
61
|
-
* 已处理的个数
|
|
62
|
-
*/
|
|
63
|
-
resolvedPartialEditCount: number;
|
|
64
|
-
/**
|
|
65
|
-
* 已添加行数
|
|
66
|
-
*/
|
|
67
|
-
totalAddedLinesCount: number;
|
|
68
|
-
/**
|
|
69
|
-
* 已采纳的个数
|
|
70
|
-
*/
|
|
71
|
-
acceptPartialEditCount: number;
|
|
72
|
-
/**
|
|
73
|
-
* 已删除行数
|
|
74
|
-
*/
|
|
75
|
-
totalDeletedLinesCount: number;
|
|
76
|
-
currentPartialEdit: {
|
|
77
|
-
type: EPartialEdit;
|
|
78
|
-
addedLinesCount: number;
|
|
79
|
-
deletedLinesCount: number;
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
49
|
export interface ITextLinesTokens {
|
|
84
50
|
text: string;
|
|
85
51
|
lineTokens: LineTokens;
|
|
@@ -19,9 +19,10 @@ import { LineRange } from '@opensumi/monaco-editor-core/esm/vs/editor/common/cor
|
|
|
19
19
|
import { ModelDecorationOptions } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model/textModel';
|
|
20
20
|
import { IUndoRedoService, UndoRedoGroup } from '@opensumi/monaco-editor-core/esm/vs/platform/undoRedo/common/undoRedo';
|
|
21
21
|
|
|
22
|
+
import { IInlineDiffService, InlineDiffServiceToken } from '../../../common';
|
|
23
|
+
import { EPartialEdit, IPartialEditEvent } from '../../../common/types';
|
|
22
24
|
import { AINativeContextKey } from '../../ai-core.contextkeys';
|
|
23
25
|
import { IDecorationSerializableState, IEnhanceModelDeltaDecoration } from '../../model/enhanceDecorationsCollection';
|
|
24
|
-
import { InlineDiffService } from '../inline-diff';
|
|
25
26
|
|
|
26
27
|
import styles from './inline-stream-diff.module.less';
|
|
27
28
|
import { InlineStreamDiffService } from './inline-stream-diff.service';
|
|
@@ -31,8 +32,6 @@ import {
|
|
|
31
32
|
ActiveLineDecoration,
|
|
32
33
|
AddedRangeDecoration,
|
|
33
34
|
AddedRangeDecorationsCollection,
|
|
34
|
-
EPartialEdit,
|
|
35
|
-
IPartialEditEvent,
|
|
36
35
|
IPartialEditWidgetOptions,
|
|
37
36
|
IRemovedWidgetState,
|
|
38
37
|
IRemovedZoneWidgetOptions,
|
|
@@ -66,8 +65,8 @@ export class LivePreviewDiffDecorationModel extends Disposable {
|
|
|
66
65
|
@Autowired(InlineStreamDiffService)
|
|
67
66
|
private readonly inlineStreamDiffService: InlineStreamDiffService;
|
|
68
67
|
|
|
69
|
-
@Autowired(
|
|
70
|
-
private readonly inlineDiffService:
|
|
68
|
+
@Autowired(InlineDiffServiceToken)
|
|
69
|
+
private readonly inlineDiffService: IInlineDiffService;
|
|
71
70
|
|
|
72
71
|
@Autowired(IMessageService)
|
|
73
72
|
private readonly messageService: IMessageService;
|
|
@@ -537,15 +536,15 @@ export class LivePreviewDiffDecorationModel extends Disposable {
|
|
|
537
536
|
}
|
|
538
537
|
|
|
539
538
|
public acceptUnProcessed(): void {
|
|
540
|
-
const
|
|
541
|
-
|
|
539
|
+
const pendingWidgets = this.partialEditWidgetList.filter((widget) => widget.isPending);
|
|
540
|
+
pendingWidgets.forEach((widget) => {
|
|
542
541
|
this.handlePartialEditAction(EPartialEdit.accept, widget, false);
|
|
543
542
|
});
|
|
544
543
|
}
|
|
545
544
|
|
|
546
545
|
public discardUnProcessed(): void {
|
|
547
|
-
const
|
|
548
|
-
|
|
546
|
+
const pendingWidgets = this.partialEditWidgetList.filter((widget) => widget.isPending);
|
|
547
|
+
pendingWidgets.forEach((widget) => {
|
|
549
548
|
this.handlePartialEditAction(EPartialEdit.discard, widget, false);
|
|
550
549
|
});
|
|
551
550
|
}
|
package/src/common/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { DESIGN_MENUBAR_CONTAINER_VIEW_ID } from '@opensumi/ide-design/lib/commo
|
|
|
16
16
|
import { IPosition, ITextModel, InlineCompletionContext } from '@opensumi/ide-monaco/lib/common';
|
|
17
17
|
|
|
18
18
|
import { MCPServerDescription } from './mcp-server-manager';
|
|
19
|
-
import { MCPTool } from './types';
|
|
19
|
+
import { IPartialEditEvent, MCPTool } from './types';
|
|
20
20
|
|
|
21
21
|
import type { CoreMessage } from 'ai';
|
|
22
22
|
|
|
@@ -37,7 +37,7 @@ export const AI_CHAT_LOGO_AVATAR_ID = 'AI-Chat-Logo-Avatar';
|
|
|
37
37
|
export const AI_MENU_BAR_DEBUG_TOOLBAR = 'AI_MENU_BAR_DEBUG_TOOLBAR';
|
|
38
38
|
|
|
39
39
|
// 内置 MCP 服务器名称
|
|
40
|
-
export const BUILTIN_MCP_SERVER_NAME = '
|
|
40
|
+
export const BUILTIN_MCP_SERVER_NAME = 'builtin';
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @deprecated Use {@link DESIGN_MENUBAR_CONTAINER_VIEW_ID} instead
|
|
@@ -309,3 +309,10 @@ export interface IAIInlineCompletionsProvider {
|
|
|
309
309
|
): Promise<T>;
|
|
310
310
|
setVisibleCompletion(arg0: boolean): void;
|
|
311
311
|
}
|
|
312
|
+
|
|
313
|
+
export interface IInlineDiffService {
|
|
314
|
+
onPartialEdit: Event<IPartialEditEvent>;
|
|
315
|
+
firePartialEdit(event: IPartialEditEvent): void;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export const InlineDiffServiceToken = Symbol('InlineDiffService');
|
package/src/common/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IMarker } from '@opensumi/ide-core-browser';
|
|
2
|
+
import { Uri } from '@opensumi/monaco-editor-core';
|
|
2
3
|
|
|
3
4
|
export enum NearestCodeBlockType {
|
|
4
5
|
Block = 'block',
|
|
@@ -83,3 +84,37 @@ export interface CodeBlockData {
|
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
export type CodeBlockStatus = 'generating' | 'pending' | 'success' | 'rejected' | 'failed' | 'cancelled';
|
|
87
|
+
|
|
88
|
+
export enum EPartialEdit {
|
|
89
|
+
accept = 'accept',
|
|
90
|
+
discard = 'discard',
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface IPartialEditEvent {
|
|
94
|
+
uri: Uri;
|
|
95
|
+
/**
|
|
96
|
+
* 总 diff 数
|
|
97
|
+
*/
|
|
98
|
+
totalPartialEditCount: number;
|
|
99
|
+
/**
|
|
100
|
+
* 已处理的个数
|
|
101
|
+
*/
|
|
102
|
+
resolvedPartialEditCount: number;
|
|
103
|
+
/**
|
|
104
|
+
* 已添加行数
|
|
105
|
+
*/
|
|
106
|
+
totalAddedLinesCount: number;
|
|
107
|
+
/**
|
|
108
|
+
* 已采纳的个数
|
|
109
|
+
*/
|
|
110
|
+
acceptPartialEditCount: number;
|
|
111
|
+
/**
|
|
112
|
+
* 已删除行数
|
|
113
|
+
*/
|
|
114
|
+
totalDeletedLinesCount: number;
|
|
115
|
+
currentPartialEdit: {
|
|
116
|
+
type: EPartialEdit;
|
|
117
|
+
addedLinesCount: number;
|
|
118
|
+
deletedLinesCount: number;
|
|
119
|
+
};
|
|
120
|
+
}
|