chore: use thinking mode
This commit is contained in:
+24
-4
@@ -119,7 +119,8 @@ async function runOllamaLoop(ctx: AgentRunContext): Promise<AgentResult> {
|
|||||||
tools,
|
tools,
|
||||||
keep_alive: "10m",
|
keep_alive: "10m",
|
||||||
options: {
|
options: {
|
||||||
think: false,
|
think: true,
|
||||||
|
num_ctx: 32768,
|
||||||
} as Record<string, unknown>,
|
} as Record<string, unknown>,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -206,13 +207,32 @@ async function runOllamaLoop(ctx: AgentRunContext): Promise<AgentResult> {
|
|||||||
// re-calling select_mode instead of executing the workflow.
|
// re-calling select_mode instead of executing the workflow.
|
||||||
if (calledSelectMode && !pendingModeNudge) {
|
if (calledSelectMode && !pendingModeNudge) {
|
||||||
pendingModeNudge = true;
|
pendingModeNudge = true;
|
||||||
|
|
||||||
|
// Parse the selected mode name from the tool result so we can give a
|
||||||
|
// more specific first-step instruction.
|
||||||
|
let selectedMode = "";
|
||||||
|
try {
|
||||||
|
const lastToolMsg = messages[messages.length - 1];
|
||||||
|
const parsed = JSON.parse(
|
||||||
|
typeof lastToolMsg.content === "string" ? lastToolMsg.content : "",
|
||||||
|
);
|
||||||
|
if (typeof parsed?.modeName === "string") selectedMode = parsed.modeName;
|
||||||
|
} catch {
|
||||||
|
// best-effort
|
||||||
|
}
|
||||||
|
|
||||||
|
const firstStep =
|
||||||
|
selectedMode === "Review" || selectedMode === "IncrementalReview"
|
||||||
|
? "Your first tool call must be checkout_pr with the PR number from the event context."
|
||||||
|
: "Call the first tool required by the workflow now.";
|
||||||
|
|
||||||
messages.push({
|
messages.push({
|
||||||
role: "user",
|
role: "user",
|
||||||
content:
|
content:
|
||||||
"Good. You have selected a mode and received the workflow. " +
|
`Good. You have selected ${selectedMode || "a"} mode and received the workflow. ` +
|
||||||
"Do NOT call select_mode again. " +
|
"Do NOT call select_mode again. " +
|
||||||
"Call the next tool to execute the workflow now (e.g. checkout_pr, get_issue, create_pull_request_review). " +
|
`${firstStep} ` +
|
||||||
"Start immediately.",
|
"Execute the complete workflow step by step until you call create_pull_request_review or report_progress.",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user