(inputs: Array<Record<string, unknown>>)
| 13 | } |
| 14 | |
| 15 | function parseUserInputs(inputs: Array<Record<string, unknown>>) { |
| 16 | const textParts: string[] = []; |
| 17 | const images: string[] = []; |
| 18 | inputs.forEach((input) => { |
| 19 | const type = asString(input.type); |
| 20 | if (type === "text") { |
| 21 | const text = asString(input.text); |
| 22 | if (text) { |
| 23 | textParts.push(text); |
| 24 | } |
| 25 | return; |
| 26 | } |
| 27 | if (type === "skill") { |
| 28 | const name = asString(input.name); |
| 29 | if (name) { |
| 30 | textParts.push(`$${name}`); |
| 31 | } |
| 32 | return; |
| 33 | } |
| 34 | if (type === "image" || type === "localImage") { |
| 35 | const value = extractImageInputValue(input); |
| 36 | if (value) { |
| 37 | images.push(value); |
| 38 | } |
| 39 | } |
| 40 | }); |
| 41 | return { text: textParts.join(" ").trim(), images }; |
| 42 | } |
| 43 | |
| 44 | export function buildConversationItem( |
| 45 | item: Record<string, unknown>, |
no test coverage detected