chore: fix the eslint issues

This commit is contained in:
Björn Otgaar
2026-01-08 11:33:10 +01:00
parent a4428c0d67
commit e6f29a0f6b
4 changed files with 41 additions and 29 deletions

View File

@@ -1,4 +1,4 @@
import { GoalReduce, type GoalNode } from "../nodes/GoalNode"
import { GoalReduce } from "../nodes/GoalNode"
import { type Node } from "@xyflow/react"
export type Plan = {
@@ -35,6 +35,8 @@ export function PlanReduce(_nodes: Node[], plan?: Plan, ) {
// Extract the wanted information from a plan element.
function StepReduce(planElement: PlanElement, _nodes: Node[]) : Record<string, unknown> {
// We have different types of plan elements, requiring differnt types of output
const nodes = _nodes
const thisNode = _nodes.find((x) => x.id === planElement.id)
switch (planElement.type) {
case ("speech"):
return {
@@ -55,8 +57,6 @@ function StepReduce(planElement: PlanElement, _nodes: Node[]) : Record<string, u
goal: planElement.goal,
}
case ("goal"):
const nodes = _nodes
const thisNode = _nodes.find((x) => x.id === planElement.id)
return thisNode ? GoalReduce(thisNode, nodes) : {}
}
}
@@ -94,28 +94,4 @@ export function GetActionValue(action: Action) {
return returnAction.goal;
default:
}
}
/**
* Inserts a goal into a plan
* @param plan: plan to insert goal into
* @param goalNode: the goal node to insert into the plan.
* @returns: a new plan with the goal inside.
*/
export function insertGoalInPlan(plan: Plan, goalNode: GoalNode): Plan {
const planElement : Goal = {
id: goalNode.id,
type: "goal",
}
return {
...plan,
steps: [...plan.steps, planElement],
}
}
export function deleteGoalInPlanByID(plan: Plan, goalID: string): Plan {
return {...plan,
steps: plan.steps.filter((x) => x.id !== goalID)
}
}