| 163 | }; |
| 164 | |
| 165 | const buildTaskTitle = (funcName: string, param: any): string => { |
| 166 | switch (funcName) { |
| 167 | case "soundTts": |
| 168 | return param?.text ? String(param.text).slice(0, 20) : "TTS任务"; |
| 169 | case "soundClone": |
| 170 | return param?.text |
| 171 | ? String(param.text).slice(0, 20) |
| 172 | : "音色克隆任务"; |
| 173 | case "videoGen": |
| 174 | return "AI数字人视频"; |
| 175 | case "asr": |
| 176 | return "ASR识别任务"; |
| 177 | case "textToImage": |
| 178 | return param?.prompt |
| 179 | ? String(param.prompt).slice(0, 20) |
| 180 | : "文生图任务"; |
| 181 | case "imageToImage": |
| 182 | return param?.prompt |
| 183 | ? String(param.prompt).slice(0, 20) |
| 184 | : "图生图任务"; |
| 185 | default: |
| 186 | return "任务"; |
| 187 | } |
| 188 | }; |
| 189 | |
| 190 | const sendJson = (res: Response, statusCode: number, data: any) => { |
| 191 | res.status(statusCode).json(data); |