mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-17 12:43:05 +00:00
Seleção do C166 ganha "Cortar vídeo": título/descrição por IA (editáveis, com fallback determinístico), job assíncrono com ffmpeg por re-encode exato e polling dos quatro passos, e página pública unlisted /corte/<id> (noindex, OG, crédito CC BY) servindo o mesmo MP4. Collection speechCut com access canReadSpeechCut (advisor/leader negados) e kill switch por status; ffmpeg entra só no runner da imagem com FFMPEG_PATH para teste.
53 lines
2.2 KiB
TypeScript
53 lines
2.2 KiB
TypeScript
import { z } from 'zod'
|
||
|
||
import { positiveRelationshipId } from '@/lib/schemas/primitives'
|
||
import { SPEECH_VOD_FORBIDDEN_MESSAGE } from '@/lib/schemas/speechVod'
|
||
import { SPEECH_CUT_DESCRIPTION_MAX_LENGTH, SPEECH_CUT_TITLE_MAX_LENGTH } from '@/lib/speechCut'
|
||
|
||
/** The acervo gate refused the actor — one literal shared with C162/C166. */
|
||
export const SPEECH_CUT_FORBIDDEN_MESSAGE = SPEECH_VOD_FORBIDDEN_MESSAGE
|
||
|
||
/** The speech does not exist (or the actor cannot read it). */
|
||
export const SPEECH_CUT_SPEECH_NOT_FOUND_MESSAGE = 'Fala não encontrada.'
|
||
|
||
/** The cut does not exist (or the actor cannot read it). */
|
||
export const SPEECH_CUT_NOT_FOUND_MESSAGE = 'Corte não encontrado.'
|
||
|
||
/** Selection outside the C166 bounds (5–180 s) or outside the speech duration. */
|
||
export const SPEECH_CUT_INVALID_RANGE_MESSAGE = 'Selecione um trecho de 5 a 180 segundos.'
|
||
|
||
/** Retry only applies to a failed cut — a published one is not re-cut. */
|
||
export const SPEECH_CUT_RETRY_NOT_FAILED_MESSAGE =
|
||
'Só é possível tentar novamente um corte que falhou.'
|
||
|
||
/** Transport/ffmpeg/storage failure (or anything unmapped). */
|
||
export const SPEECH_CUT_GENERIC_ERROR_MESSAGE =
|
||
'Não foi possível preparar o corte. Verifique seu acesso e tente novamente.'
|
||
|
||
const excerptBoundarySeconds = z.number().int().min(0).max(86_400)
|
||
|
||
/** Create one cut from a C166 selection, or retry the failed row (`retryOf`). */
|
||
export const speechCutRequestSchema = z.union([
|
||
z.object({ retryOf: positiveRelationshipId }),
|
||
z.object({
|
||
speechId: positiveRelationshipId,
|
||
startSeconds: excerptBoundarySeconds,
|
||
endSeconds: excerptBoundarySeconds,
|
||
title: z.string().trim().min(1).max(SPEECH_CUT_TITLE_MAX_LENGTH),
|
||
description: z.string().trim().min(1).max(SPEECH_CUT_DESCRIPTION_MAX_LENGTH),
|
||
}),
|
||
])
|
||
|
||
export type SpeechCutRequest = z.infer<typeof speechCutRequestSchema>
|
||
|
||
/** Poll one running cut. */
|
||
export const speechCutStatusRequestSchema = z.object({
|
||
cutId: positiveRelationshipId,
|
||
})
|
||
|
||
/** AI title/description suggestion for the picked window. */
|
||
export const speechCutSuggestionRequestSchema = z.object({
|
||
speechId: positiveRelationshipId,
|
||
startSeconds: excerptBoundarySeconds,
|
||
endSeconds: excerptBoundarySeconds,
|
||
})
|