Spaces:
Running
Running
File size: 707 Bytes
f24ad59 3d4392e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import { parseStringArray } from "../../parsers/parseStringArray"
import { LatentScene, LatentScenes } from "./types"
/**
* Process a YAML result from the LLM to make sure it is a LatentScenes
*
* @param something
* @returns
*/
export function unknownObjectToLatentScenes(something: any): LatentScenes {
let scenes: LatentScenes = []
if (Array.isArray(something)) {
scenes = something.map(thing => ({
characters: parseStringArray(thing && (thing?.characters || thing?.character)),
locations: parseStringArray(thing && (thing?.locations || thing?.location)),
actions: parseStringArray(thing && (thing?.actions || thing?.action)),
} as LatentScene))
}
return scenes
} |