| 2288 | |
| 2289 | const extractGeminiOperationError = (data: any): string => { |
| 2290 | const err = data?.error || data?.data?.error; |
| 2291 | if (!err) return ""; |
| 2292 | if (typeof err === "string") return err; |
| 2293 | if (typeof err.message === "string") return err.message; |
| 2294 | if (typeof err.status === "string") return err.status; |
| 2295 | if (Array.isArray(err.details) && err.details.length > 0) { |
| 2296 | const detail = err.details[0]; |
| 2297 | if (typeof detail?.message === "string") return detail.message; |
| 2298 | } |
| 2299 | return "视频生成失败"; |
| 2300 | }; |
| 2301 | |
| 2302 | const extractGeminiVideoResult = ( |
| 2303 | data: any, |
| 2304 | ): { uri?: string; bytes?: string } | null => { |