Skip to content
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
Expand Up @@ -347,7 +347,7 @@ export class IntelligentCompletionsController extends BaseAIMonacoEditorControll
const { range, insertText } = codeEditsResult.items[0];
const newCode = insertText;
const originCode = this.model.getValueInRange(range);
return (type: keyof Pick<CodeEditsRT, 'accept' | 'discard' | 'isCancel'>) => {
return (type: keyof Pick<CodeEditsRT, 'isReceive' | 'isDrop' | 'isValid'>) => {
contextBean.reporterEnd({
[type]: true,
code: newCode,
Expand All @@ -368,17 +368,17 @@ export class IntelligentCompletionsController extends BaseAIMonacoEditorControll

// 在可见的情况下超过 750ms 弃用才算有效数据,否则视为取消
if (lastVisibleTime && Date.now() - lastVisibleTime > 750) {
report?.('discard');
report?.('isDrop');
} else {
report?.('isCancel');
report?.('isValid');
}

this.hide();
});

public accept = derived(this, (reader) => {
const report = this.reportData.read(reader);
report?.('accept');
report?.('isReceive');

this.multiLineDecorationModel.accept();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export abstract class BaseCodeEditsSource extends Disposable {
this.cancellationTokenSource.cancel();
this.cancellationTokenSource = new CancellationTokenSource();

this.reporterEnd({ isCancel: true });
this.reporterEnd({ isValid: false });
}

constructor(@Optional() protected readonly monacoEditor: ICodeEditor) {
Expand Down
9 changes: 4 additions & 5 deletions packages/core-common/src/types/ai-native/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export interface CommonLogInfo {
copy: boolean;
insert: boolean;
isRetry: boolean;
isDrop: boolean;
language?: string;
// 针对新版数据增加额外参数
// 采纳代码
Expand All @@ -95,10 +94,13 @@ export interface CommonLogInfo {
actionSource?: ActionSourceEnum | string;
// 行动点类型,内置通用,但是很多来自业务
actionType?: ActionTypeEnum | string;
// 是否采纳(采纳必须使用这个字段)
isReceive?: boolean;
// 是否弃用(弃用必须使用这个字段)
isDrop?: boolean;
Comment thread
Ricbet marked this conversation as resolved.
}

export interface CompletionRT extends Partial<CommonLogInfo> {
isReceive?: boolean;
// 是否取消
isStop?: boolean;
// 补全条数
Expand Down Expand Up @@ -177,9 +179,6 @@ export interface InlineChatRT extends Partial<CommonLogInfo> {

export interface CodeEditsRT extends Partial<CommonLogInfo> {
actionSource?: ECodeEditsSourceTyping;
isCancel?: boolean;
accept?: boolean;
discard?: boolean;
}

export type ReportInfo =
Expand Down