@2en/clawly-plugins 1.24.1 → 1.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config-setup.ts +12 -5
- package/package.json +1 -1
package/config-setup.ts
CHANGED
|
@@ -191,7 +191,14 @@ export function patchSessionMainKey(
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
export function patchTts(config: Record<string, unknown>, pc: ConfigPluginConfig): boolean {
|
|
194
|
-
|
|
194
|
+
const useProxy = !!(pc.modelGatewayBaseUrl && pc.modelGatewayToken)
|
|
195
|
+
const hasDirectKey = !!pc.elevenlabsApiKey
|
|
196
|
+
if (!useProxy && !hasDirectKey) return false
|
|
197
|
+
|
|
198
|
+
const targetApiKey = useProxy ? pc.modelGatewayToken! : pc.elevenlabsApiKey!
|
|
199
|
+
const targetBaseUrl = useProxy
|
|
200
|
+
? `${pc.modelGatewayBaseUrl}/elevenlabs`
|
|
201
|
+
: 'https://api.elevenlabs.io'
|
|
195
202
|
|
|
196
203
|
let dirty = false
|
|
197
204
|
const messages = (config.messages ?? {}) as Record<string, unknown>
|
|
@@ -199,12 +206,12 @@ export function patchTts(config: Record<string, unknown>, pc: ConfigPluginConfig
|
|
|
199
206
|
const elevenlabs = (tts.elevenlabs ?? {}) as Record<string, unknown>
|
|
200
207
|
|
|
201
208
|
// Credentials: enforce
|
|
202
|
-
if (elevenlabs.apiKey !==
|
|
203
|
-
elevenlabs.apiKey =
|
|
209
|
+
if (elevenlabs.apiKey !== targetApiKey) {
|
|
210
|
+
elevenlabs.apiKey = targetApiKey
|
|
204
211
|
dirty = true
|
|
205
212
|
}
|
|
206
|
-
if (elevenlabs.baseUrl !==
|
|
207
|
-
elevenlabs.baseUrl =
|
|
213
|
+
if (elevenlabs.baseUrl !== targetBaseUrl) {
|
|
214
|
+
elevenlabs.baseUrl = targetBaseUrl
|
|
208
215
|
dirty = true
|
|
209
216
|
}
|
|
210
217
|
const voiceId = pc.elevenlabsVoiceId ?? ''
|