File size: 487 Bytes
3d4392e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { parseClap } from "@/lib/clap/parseClap"
import { ClapProject } from "@/lib/clap/types"

export async function fetchLatentClap(prompt: string): Promise<ClapProject> {

  const requestUri = `/api/resolvers/clap?p=${encodeURIComponent(prompt)}`

  console.log(`fetchLatentClap: calling ${requestUri}`)

  const res = await fetch(requestUri)

  const blob = await res.blob()

  const clap = await parseClap(blob)

  console.log(`fetchLatentClap: received = `, clap)

  return clap
}