File size: 851 Bytes
9164321 859368a 9164321 5443f48 9164321 5443f48 9164321 |
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 32 33 34 35 36 37 38 |
"use server"
import { ClapProject, ClapCompletionMode } from "@aitube/clap"
import { editClapStory as apiEditClapStory } from "@aitube/client"
import { getToken } from "./getToken"
import { Workaround } from "./types"
import { MAX_PROMPT_LENGTH_IN_CHARS } from "../config"
export async function editClapStory({
clap,
prompt,
startTimeInMs,
endTimeInMs,
turbo = false,
}: {
clap: ClapProject
prompt?: string
startTimeInMs?: number
endTimeInMs?: number
turbo?: boolean
}): Workaround<ClapProject> {
async function promise() {
return await apiEditClapStory({
clap,
prompt: `${prompt || ""}`.slice(0, MAX_PROMPT_LENGTH_IN_CHARS),
startTimeInMs,
endTimeInMs,
completionMode: ClapCompletionMode.MERGE,
turbo,
token: await getToken()
})
}
return {
promise: promise()
}
} |