2929
2930
addRequest(
2932
>
variableData: IChatRequestVariableData,
2933
>
attempt: number,
2934
>
modeInfo?: IChatRequestModeInfo,
2935
>
chatAgent?: IChatAgentData,
2936
>
slashCommand?: IChatAgentCommand,
2937
>
confirmation?: string,
2938
>
locationData?: IChatLocationData,
2939
>
attachments?: IChatRequestVariableEntry[],
2940
>
isCompleteAddedRequest?: boolean,
2941
>
modelId?: string,
2942
>
userSelectedTools?: UserSelectedTools,
2943
>
id?: string,
2944
>
isSystemInitiated?: boolean,
2945
>
systemInitiatedLabel?: string,
2946
>
terminalExecutionId?: string,
2947
>
isTerminalCommand?: boolean,
2948
>
timestamp?: number | null,
2949
>
): ChatRequestModel {
2950
>
const editedFileEvents = [...this.currentEditedFileEvents.values()];
2951
>
this.currentEditedFileEvents.clear();
2952
>
const requestTimestamp = timestamp === undefined
2953
? Date.now()
2954
: typeof timestamp === 'number' && Number.isFinite(timestamp) && timestamp > 0
2955
? timestamp
2956
: undefined;
2958
>
restoredId: id,
2959
>
session: this,
2960
>
message,
2961
>
variableData,
2962
>
timestamp: requestTimestamp,
2963
>
fallbackTimestamp: this._timestamp,
2964
>
attempt,
2965
>
modeInfo,
2966
>
confirmation,
2967
>
locationData,
2968
>
attachedContext: attachments,
2969
>
isCompleteAddedRequest,
2970
>
modelId,
2971
>
editedFileEvents: editedFileEvents.length ? editedFileEvents : undefined,
2972
>
userSelectedTools,
2973
>
isSystemInitiated,
2974
>
systemInitiatedLabel,
2975
>
terminalExecutionId,
2976
>
isTerminalCommand,
2977
>
});
2978
>
request.response = new ChatResponseModel({
2979
>
responseContent: [],
2980
>
session: this,
2981
>
agent: chatAgent,
2982
>
slashCommand,
2983
>
requestId: request.id,
2984
>
isCompleteAddedRequest,
2985
>
codeBlockInfos: undefined,
2986
>
});
2987
>
2988
>
this._requests.push(request);
2989
>
markChat(this.sessionResource, ChatPerfMark.RequestUiUpdated);
2990
>
this._onDidChange.fire({ kind: 'addRequest', request });
2991
>
return request;
2992
>
}
2993
2994
public setCustomTitle(title: string): void {