mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-06 21:42:13 +00:00
fix: Filter out empty plans (#644)
This commit is contained in:
parent
c70da1b1c2
commit
041cb4aca6
1 changed files with 16 additions and 0 deletions
|
|
@ -102,6 +102,22 @@ export async function generatePlan(
|
||||||
...inputMessages,
|
...inputMessages,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Filter out empty plans
|
||||||
|
response.tool_calls = response.tool_calls?.map((tc) => {
|
||||||
|
if (tc.id === sessionPlanTool.name) {
|
||||||
|
return {
|
||||||
|
...tc,
|
||||||
|
args: {
|
||||||
|
...tc.args,
|
||||||
|
plan: (tc.args as z.infer<typeof sessionPlanTool.schema>).plan.filter(
|
||||||
|
(p) => p.length > 0,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return tc;
|
||||||
|
});
|
||||||
|
|
||||||
const toolCall = response.tool_calls?.[0];
|
const toolCall = response.tool_calls?.[0];
|
||||||
if (!toolCall) {
|
if (!toolCall) {
|
||||||
throw new Error("Failed to generate plan");
|
throw new Error("Failed to generate plan");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue