| 92 | }; |
| 93 | |
| 94 | const buildModelConfig = ( |
| 95 | funcName: string, |
| 96 | serverName: string, |
| 97 | serverTitle: string, |
| 98 | serverVersion: string, |
| 99 | param: any, |
| 100 | ) => { |
| 101 | switch (funcName) { |
| 102 | case "soundTts": |
| 103 | return { |
| 104 | type: "SoundTts", |
| 105 | ttsServerKey: `${serverName}|${serverVersion}`, |
| 106 | ttsParam: param?.param || {}, |
| 107 | text: param?.text || "", |
| 108 | }; |
| 109 | case "soundClone": |
| 110 | return { |
| 111 | type: "SoundClone", |
| 112 | cloneServerKey: `${serverName}|${serverVersion}`, |
| 113 | cloneParam: param?.param || {}, |
| 114 | text: param?.text || "", |
| 115 | promptUrl: param?.promptAudio || "", |
| 116 | promptText: param?.promptText || "", |
| 117 | }; |
| 118 | case "videoGen": |
| 119 | return { |
| 120 | soundType: "soundCustom", |
| 121 | soundCustomFile: param?.audio || "", |
| 122 | videoTemplateUrl: param?.video || "", |
| 123 | }; |
| 124 | case "asr": |
| 125 | return { |
| 126 | audio: param?.audio || "", |
| 127 | }; |
| 128 | case "textToImage": |
| 129 | return { |
| 130 | prompt: param?.prompt || "", |
| 131 | textToImage: { |
| 132 | serverName, |
| 133 | serverTitle, |
| 134 | serverVersion, |
| 135 | type: "TextToImage", |
| 136 | serverKey: `${serverName}|${serverVersion}`, |
| 137 | param: param?.param || {}, |
| 138 | }, |
| 139 | }; |
| 140 | case "imageToImage": |
| 141 | return { |
| 142 | image: param?.image || "", |
| 143 | prompt: param?.prompt || "", |
| 144 | imageToImage: { |
| 145 | serverName, |
| 146 | serverTitle, |
| 147 | serverVersion, |
| 148 | type: "ImageToImage", |
| 149 | serverKey: `${serverName}|${serverVersion}`, |
| 150 | param: param?.param || {}, |
| 151 | }, |