Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update data reporting parameter #4000

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Autowired, INJECTOR_TOKEN, Injectable, Injector } from '@opensumi/di';
import { AINativeConfigService, IAIInlineChatService, PreferenceService } from '@opensumi/ide-core-browser';
import { AIActionItem } from '@opensumi/ide-core-browser/lib/components/ai-native/index';
import {
AIInlineChatContentWidgetId,
AINativeSettingSectionsId,
Expand Down Expand Up @@ -256,7 +255,10 @@ export class InlineChatHandler extends Disposable {
},
execute: handler.execute ? handler.execute!.bind(this, monacoEditor, this.cancelIndicator.token) : undefined,
providerPreview: previewer(),
action,
extraData: {
actionSource: source === 'codeAction' ? ActionSourceEnum.CodeAction : ActionSourceEnum.InlineChat,
actionType: action.name,
},
});
}),
);
Expand All @@ -278,8 +280,7 @@ export class InlineChatHandler extends Disposable {
message: value,
type: AISerivceType.InlineChatInput,
source: 'input',
actionSource: ActionSourceEnum.InlineChat,
actionType: ActionTypeEnum.Send,
actionSource: ActionSourceEnum.InlineChatInput,
});
return relationId;
},
Expand All @@ -291,6 +292,10 @@ export class InlineChatHandler extends Disposable {
handler.providePreviewStrategy && strategy === ERunStrategy.PREVIEW
? handler.providePreviewStrategy.bind(this, monacoEditor, value, this.cancelIndicator.token)
: undefined,
extraData: {
actionSource: ActionSourceEnum.InlineChatInput,
actionType: strategy,
},
});
}),
);
Expand Down Expand Up @@ -508,7 +513,6 @@ export class InlineChatHandler extends Disposable {
isDrop: false,
code: modifyContent,
originCode: originContent,
actionSource: ActionSourceEnum.InlineChat,
actionType: ActionTypeEnum.Accept,
});
runWhenIdle(() => {
Expand All @@ -522,7 +526,6 @@ export class InlineChatHandler extends Disposable {
isReceive: false,
code: modifyContent,
originCode: originContent,
actionSource: ActionSourceEnum.InlineChat,
actionType: ActionTypeEnum.Discard,
});
runWhenIdle(() => {
Expand All @@ -536,7 +539,6 @@ export class InlineChatHandler extends Disposable {
isReceive: false,
code: modifyContent,
originCode: originContent,
actionSource: ActionSourceEnum.InlineChat,
actionType: ActionTypeEnum.Regenerate,
});
this.handleDiffPreviewStrategy({
Expand Down Expand Up @@ -570,9 +572,12 @@ export class InlineChatHandler extends Disposable {
reporterFn: () => string;
execute?: () => MaybePromise<void>;
providerPreview?: () => MaybePromise<ChatResponse | InlineChatController>;
action?: AIActionItem;
extraData?: {
actionSource: string;
actionType: string;
};
}) {
const { monacoEditor, reporterFn, execute, providerPreview, action } = params;
const { monacoEditor, reporterFn, execute, providerPreview, extraData } = params;
const selection = monacoEditor.getSelection();
if (!selection) {
this.logger.error('No selection found, aborting inline chat action.');
Expand All @@ -597,8 +602,8 @@ export class InlineChatHandler extends Disposable {
crossSelection,
relationId,
isRetry: false,
actionSource: ActionSourceEnum.InlineChat,
actionType: action?.name,
actionSource: extraData?.actionSource,
actionType: extraData?.actionType,
});
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/core-common/src/types/ai-native/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export enum ActionSourceEnum {
Chat = 'chat',
// 编辑器内联 Chat
InlineChat = 'inlineChat',
// 编辑器内联 ChatInput
InlineChatInput = 'inlineChatInput',
// 编辑器内 Action
CodeAction = 'codeAction',
// 终端
Expand Down
Loading