| 1 | import type { |
| 2 | DashscopeVideoAiLogRequest, |
| 3 | GrokVideoAiLogRequest, |
| 4 | OpenAIRemixVideoAiLogRequest, |
| 5 | OpenAIVideoAiLogRequest, |
| 6 | RelayVideoAiLogRequest, |
| 7 | TypedAiLog, |
| 8 | UserVideoGenerationAiLogRequest, |
| 9 | VolcengineVideoAiLogRequest, |
| 10 | } from '@yikart/mongodb' |
| 11 | import type { RelayVideoCallbackDto } from '../libs/relay/relay.interface' |
| 12 | import type { DashscopeVideoCallbackDto } from './dashscope' |
| 13 | import type { GrokVideoCallbackDto } from './grok/grok.service' |
| 14 | import type { OpenAIVideoCallbackDto } from './openai/openai.dto' |
| 15 | import type { VolcengineCallbackDto } from './volcengine/volcengine.dto' |
| 16 | import { AiLogChannel, AiLogType } from '@yikart/mongodb' |
| 17 | |
| 18 | interface SavedVideoMediaInfo { |
| 19 | mediaId?: string |
| 20 | coverUrl?: string |
| 21 | groupId?: string |
| 22 | } |
| 23 | |
| 24 | type VideoAiLogBase = Omit<TypedAiLog<AiLogType.Video>, 'channel' | 'request' | 'response'> |
| 25 | |
| 26 | export type VolcengineVideoAiLog = VideoAiLogBase & { |
| 27 | channel: AiLogChannel.Volcengine |
| 28 | request: VolcengineVideoAiLogRequest |
| 29 | response?: VolcengineCallbackDto & SavedVideoMediaInfo |
| 30 | } |
| 31 | |
| 32 | export type OpenAIVideoAiLog = VideoAiLogBase & { |
| 33 | channel: AiLogChannel.OpenAI |
| 34 | request: OpenAIVideoAiLogRequest | OpenAIRemixVideoAiLogRequest |
| 35 | response?: OpenAIVideoCallbackDto & SavedVideoMediaInfo |
| 36 | } |
| 37 | |
| 38 | export type GrokVideoAiLog = VideoAiLogBase & { |
| 39 | channel: AiLogChannel.Grok |
| 40 | request: GrokVideoAiLogRequest |
| 41 | response?: GrokVideoCallbackDto & SavedVideoMediaInfo |
| 42 | } |
| 43 | |
| 44 | export type DashscopeVideoAiLog = VideoAiLogBase & { |
| 45 | channel: AiLogChannel.Dashscope |
| 46 | request: DashscopeVideoAiLogRequest |
| 47 | response?: DashscopeVideoCallbackDto & SavedVideoMediaInfo |
| 48 | } |
| 49 | export type RelayVideoAiLog = VideoAiLogBase & { |
| 50 | channel: AiLogChannel.Relay |
| 51 | request: RelayVideoAiLogRequest |
| 52 | response?: RelayVideoCallbackDto & SavedVideoMediaInfo |
| 53 | } |
| 54 | |
| 55 | export type UserRequestedVideoAiLog = VideoAiLogBase & { |
| 56 | request: UserVideoGenerationAiLogRequest |
| 57 | } |
| 58 | |
| 59 | export interface VideoAiLogByChannelMap { |
| 60 | [AiLogChannel.Volcengine]: VolcengineVideoAiLog |
| 61 | [AiLogChannel.OpenAI]: OpenAIVideoAiLog |
| 62 | [AiLogChannel.Grok]: GrokVideoAiLog |
| 63 | [AiLogChannel.Dashscope]: DashscopeVideoAiLog |
| 64 | [AiLogChannel.Relay]: RelayVideoAiLog |
| 65 | } |
| 66 | |
| 67 | export type VideoAiLogByChannel<C extends keyof VideoAiLogByChannelMap> = VideoAiLogByChannelMap[C] |
| 68 | |
| 69 | export type VideoAiLog |
| 70 | = | VolcengineVideoAiLog |
| 71 | | OpenAIVideoAiLog |
| 72 | | GrokVideoAiLog |
| 73 | | DashscopeVideoAiLog |
| 74 | | RelayVideoAiLog |
| 75 |