File size: 440 Bytes
8919651
 
 
 
a54215e
 
 
 
 
 
 
 
8919651
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { ClapEntityPrompt } from "@aitube/client"
import { decode } from "js-base64"

export function parseClapEntityPrompts(input?: any): ClapEntityPrompt[] {
  const inputStr = `${input || ""}`.trim()

  // an empty string is a valid thing
  if (!inputStr) {
    return []
  }

  let basicResult = JSON.parse(decode(inputStr))
  if (Array.isArray(basicResult)) {
    return basicResult as ClapEntityPrompt[]
  } else {
    return []
  }
}