File size: 776 Bytes
846ea5b
 
7fd8bde
846ea5b
 
3e3029e
 
93ad82e
846ea5b
 
7fd8bde
63ac902
846ea5b
 
63ac902
 
846ea5b
 
 
58132fb
7fd8bde
 
58132fb
63ac902
 
846ea5b
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"use server"

import { ClapProject, ClapMediaOrientation } from "@aitube/clap"
import { createClap as apiCreateClap } from "@aitube/client"

import { getToken } from "./getToken"
import { RESOLUTION_LONG, RESOLUTION_SHORT } from "./config"

export async function createClap({
  prompt = "",
  orientation = ClapMediaOrientation.PORTRAIT,
  turbo = false,
}: {
  prompt: string
  orientation?: ClapMediaOrientation
  turbo?: boolean
}): Promise<ClapProject> {
  const clap: ClapProject = await apiCreateClap({
    prompt,

    height: orientation === ClapMediaOrientation.PORTRAIT ? RESOLUTION_LONG : RESOLUTION_SHORT,
    width: orientation === ClapMediaOrientation.PORTRAIT ? RESOLUTION_SHORT : RESOLUTION_LONG,

    turbo,

    token: await getToken()
  })

  return clap
}