Skip to content

Commit f9d2b4d

Browse files
authored
Make the question follow-up suggestions optional (#1857)
Make the question follow-up optional
1 parent 4580ad3 commit f9d2b4d

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

.changeset/chilled-jobs-taste.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"roo-cline": patch
3+
---
4+
5+
Make the question follow-up optional

src/core/Cline.ts

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2883,46 +2883,40 @@ export class Cline extends EventEmitter<ClineEvents> {
28832883
break
28842884
}
28852885

2886-
if (!follow_up) {
2887-
this.consecutiveMistakeCount++
2888-
pushToolResult(
2889-
await this.sayAndCreateMissingParamError("ask_followup_question", "follow_up"),
2890-
)
2891-
break
2892-
}
2893-
2894-
let normalizedSuggest = null
2895-
28962886
type Suggest = {
28972887
answer: string
28982888
}
28992889

2900-
let parsedSuggest: {
2901-
suggest: Suggest[] | Suggest
2890+
let follow_up_json = {
2891+
question,
2892+
suggest: [] as Suggest[],
29022893
}
29032894

2904-
try {
2905-
parsedSuggest = parseXml(follow_up, ["suggest"]) as {
2895+
if (follow_up) {
2896+
let parsedSuggest: {
29062897
suggest: Suggest[] | Suggest
29072898
}
2908-
} catch (error) {
2909-
this.consecutiveMistakeCount++
2910-
await this.say("error", `Failed to parse operations: ${error.message}`)
2911-
pushToolResult(formatResponse.toolError("Invalid operations xml format"))
2912-
break
2913-
}
29142899

2915-
this.consecutiveMistakeCount = 0
2900+
try {
2901+
parsedSuggest = parseXml(follow_up, ["suggest"]) as {
2902+
suggest: Suggest[] | Suggest
2903+
}
2904+
} catch (error) {
2905+
this.consecutiveMistakeCount++
2906+
await this.say("error", `Failed to parse operations: ${error.message}`)
2907+
pushToolResult(formatResponse.toolError("Invalid operations xml format"))
2908+
break
2909+
}
29162910

2917-
normalizedSuggest = Array.isArray(parsedSuggest?.suggest)
2918-
? parsedSuggest.suggest
2919-
: [parsedSuggest?.suggest].filter((sug): sug is Suggest => sug !== undefined)
2911+
const normalizedSuggest = Array.isArray(parsedSuggest?.suggest)
2912+
? parsedSuggest.suggest
2913+
: [parsedSuggest?.suggest].filter((sug): sug is Suggest => sug !== undefined)
29202914

2921-
const follow_up_json = {
2922-
question,
2923-
suggest: normalizedSuggest,
2915+
follow_up_json.suggest = normalizedSuggest
29242916
}
29252917

2918+
this.consecutiveMistakeCount = 0
2919+
29262920
const { text, images } = await this.ask(
29272921
"followup",
29282922
JSON.stringify(follow_up_json),

0 commit comments

Comments
 (0)