Skip to content

Commit 540e2f4

Browse files
authored
Improve chat session log parsing for active response. (#7739)
1 parent 09e6f9c commit 540e2f4

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

common/sessionParsing.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,34 @@ export function parseToolCallDetails(
237237
} : undefined
238238
};
239239
}
240+
} else if (name === 'str_replace') {
241+
const filePath = args.path;
242+
const fileLabel = filePath && toFileLabel(filePath);
243+
244+
return {
245+
toolName: 'Edit',
246+
invocationMessage: fileLabel ? `Edit [](${fileLabel})` : `Edit ${filePath}`,
247+
pastTenseMessage: fileLabel ? `Edit [](${fileLabel})` : `Edit ${filePath}`,
248+
toolSpecificData: fileLabel ? {
249+
command: 'str_replace',
250+
filePath: filePath,
251+
fileLabel: fileLabel,
252+
} : undefined
253+
}
254+
} else if (name === 'create') {
255+
const filePath = args.path;
256+
const fileLabel = filePath && toFileLabel(filePath);
257+
258+
return {
259+
toolName: 'Create',
260+
invocationMessage: fileLabel ? `Create [](${fileLabel})` : `Create File ${filePath}`,
261+
pastTenseMessage: fileLabel ? `Create [](${fileLabel})` : `Create File ${filePath}`,
262+
toolSpecificData: fileLabel ? {
263+
command: 'create',
264+
filePath: filePath,
265+
fileLabel: fileLabel,
266+
} : undefined
267+
}
240268
} else if (name === 'view') {
241269
const filePath = args.path;
242270
const fileLabel = filePath && toFileLabel(filePath);

src/github/copilotRemoteAgent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,8 +1082,8 @@ export class CopilotRemoteAgentManager extends Disposable {
10821082
const delta = choice.delta;
10831083

10841084
if (delta.role === 'assistant') {
1085-
// Handle special case for run_custom_setup_step
1086-
if (choice.finish_reason === 'tool_calls' && delta.tool_calls?.length && delta.tool_calls[0].function.name === 'run_custom_setup_step') {
1085+
// Handle special case for run_custom_setup_step/run_setup
1086+
if (choice.finish_reason === 'tool_calls' && delta.tool_calls?.length && (delta.tool_calls[0].function.name === 'run_custom_setup_step' || delta.tool_calls[0].function.name === 'run_setup')) {
10871087
const toolCall = delta.tool_calls[0];
10881088
let args: any = {};
10891089
try {

0 commit comments

Comments
 (0)