File size: 738 Bytes
846ea5b
 
 
 
 
93ad82e
846ea5b
3e3029e
 
93ad82e
846ea5b
 
93ad82e
846ea5b
 
93ad82e
846ea5b
 
 
58132fb
93ad82e
 
58132fb
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
"use server"

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

import { VideoOrientation } from "../../types"

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

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

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

    token: await getToken()
  })

  return clap
}