pass last message of a subtask to parent task

This commit is contained in:
ShayBC 2025-02-23 05:15:23 +02:00
parent c3c3874593
commit 87f6ac4d06
2 changed files with 15 additions and 19 deletions

View file

@ -490,26 +490,22 @@ export class Cline {
])
}
async resumePausedTask() {
async resumePausedTask(lastMessage?: string) {
// release this Cline instance from paused state
this.isPaused = false
// Clear any existing ask state and simulate a completed ask response
// this.askResponse = "messageResponse";
// this.askResponseText = "Sub Task finished Successfully!\nthere is no need to perform this task again, please continue to the next task.";
// this.askResponseImages = undefined;
// this.lastMessageTs = Date.now();
// This adds the completion message to conversation history
await this.say(
"text",
"Sub Task finished Successfully!\nthere is no need to perform this task again, please continue to the next task.",
)
await this.say("text", `new_task finished successfully! ${lastMessage ?? "Please continue to the next task."}`)
// this.userMessageContent.push({
// type: "text",
// text: `${"Result:\\n\\nSub Task finished Successfully!\nthere is no need to perform this task again, please continue to the next task."}`,
// })
await this.addToApiConversationHistory({
role: "assistant",
content: [
{
type: "text",
text: `new_task finished successfully! ${lastMessage ?? "Please continue to the next task."}`,
},
],
})
try {
// Resume parent task
@ -2699,7 +2695,7 @@ export class Cline {
await this.say("completion_result", result, undefined, false)
if (this.isSubTask) {
// tell the provider to remove the current subtask and resume the previous task in the stack
this.providerRef.deref()?.finishSubTask()
this.providerRef.deref()?.finishSubTask(lastMessage?.text)
}
}
@ -2720,7 +2716,7 @@ export class Cline {
await this.say("completion_result", result, undefined, false)
if (this.isSubTask) {
// tell the provider to remove the current subtask and resume the previous task in the stack
this.providerRef.deref()?.finishSubTask()
this.providerRef.deref()?.finishSubTask(lastMessage?.text)
}
}

View file

@ -218,11 +218,11 @@ export class ClineProvider implements vscode.WebviewViewProvider {
// remove the current task/cline instance (at the top of the stack), ao this task is finished
// and resume the previous task/cline instance (if it exists)
// this is used when a sub task is finished and the parent task needs to be resumed
async finishSubTask() {
async finishSubTask(lastMessage?: string) {
// remove the last cline instance from the stack (this is the finished sub task)
await this.removeClineFromStack()
// resume the last cline instance in the stack (if it exists - this is the 'parnt' calling task)
this.getCurrentCline()?.resumePausedTask()
this.getCurrentCline()?.resumePausedTask(lastMessage)
}
/*