chore: change goal text, correct output for gestures, allow step specific reducing, fix tests/ add tests for new things
This commit is contained in:
@@ -17,7 +17,7 @@ export type Goal = {
|
||||
// Actions
|
||||
export type Action = SpeechAction | GestureAction | LLMAction
|
||||
export type SpeechAction = { id: string, text: string, type:"speech" }
|
||||
export type GestureAction = { id: string, gesture: string, type:"gesture" }
|
||||
export type GestureAction = { id: string, gesture: string, isTag: boolean, type:"gesture" }
|
||||
export type LLMAction = { id: string, goal: string, type:"llm" }
|
||||
|
||||
export type ActionTypes = "speech" | "gesture" | "llm";
|
||||
@@ -29,7 +29,40 @@ export function PlanReduce(plan?: Plan) {
|
||||
return {
|
||||
name: plan.name,
|
||||
id: plan.id,
|
||||
steps: plan.steps,
|
||||
steps: plan.steps.map((x) => StepReduce(x))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Extract the wanted information from a plan element.
|
||||
function StepReduce(planElement: PlanElement) {
|
||||
// We have different types of plan elements, requiring differnt types of output
|
||||
switch (planElement.type) {
|
||||
case ("speech"):
|
||||
return {
|
||||
id: planElement.id,
|
||||
text: planElement.text,
|
||||
}
|
||||
case ("gesture"):
|
||||
return {
|
||||
id: planElement.id,
|
||||
gesture: {
|
||||
type: planElement.isTag ? "tag" : "single",
|
||||
name: planElement.gesture
|
||||
},
|
||||
}
|
||||
case ("llm"):
|
||||
return {
|
||||
id: planElement.id,
|
||||
goal: planElement.goal,
|
||||
}
|
||||
case ("goal"):
|
||||
return {
|
||||
id: planElement.id,
|
||||
plan: planElement.plan,
|
||||
can_fail: planElement.can_fail,
|
||||
};
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user