mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 11:33:14 +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,
|
||||
]);
|
||||
|
||||
// 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];
|
||||
if (!toolCall) {
|
||||
throw new Error("Failed to generate plan");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue