@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.
Files changed (2) hide show
  1. package/config-setup.ts +12 -5
  2. 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
- if (!pc.elevenlabsApiKey) return false
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 !== pc.elevenlabsApiKey) {
203
- elevenlabs.apiKey = pc.elevenlabsApiKey
209
+ if (elevenlabs.apiKey !== targetApiKey) {
210
+ elevenlabs.apiKey = targetApiKey
204
211
  dirty = true
205
212
  }
206
- if (elevenlabs.baseUrl !== 'https://api.elevenlabs.io') {
207
- elevenlabs.baseUrl = 'https://api.elevenlabs.io'
213
+ if (elevenlabs.baseUrl !== targetBaseUrl) {
214
+ elevenlabs.baseUrl = targetBaseUrl
208
215
  dirty = true
209
216
  }
210
217
  const voiceId = pc.elevenlabsVoiceId ?? ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2en/clawly-plugins",
3
- "version": "1.24.1",
3
+ "version": "1.24.2",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "repository": {