@2en/clawly-plugins 1.24.0 → 1.24.1

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 CHANGED
@@ -32,7 +32,8 @@ export interface ConfigPluginConfig {
32
32
  sessionMainKey?: string
33
33
  elevenlabsApiKey?: string
34
34
  elevenlabsVoiceId?: string
35
- braveSearchApiKey?: string
35
+ modelGatewayBaseUrl?: string
36
+ modelGatewayToken?: string
36
37
  }
37
38
 
38
39
  function toPC(api: PluginApi): ConfigPluginConfig {
@@ -284,20 +285,33 @@ export function patchTts(config: Record<string, unknown>, pc: ConfigPluginConfig
284
285
  }
285
286
 
286
287
  export function patchWebSearch(config: Record<string, unknown>, pc: ConfigPluginConfig): boolean {
287
- if (!pc.braveSearchApiKey) return false
288
+ if (!pc.modelGatewayBaseUrl || !pc.modelGatewayToken) return false
288
289
 
289
290
  let dirty = false
290
291
  const tools = (config.tools ?? {}) as Record<string, unknown>
291
292
  const web = (tools.web ?? {}) as Record<string, unknown>
292
293
  const search = (web.search ?? {}) as Record<string, unknown>
294
+ const perplexity = (search.perplexity ?? {}) as Record<string, unknown>
293
295
 
294
- // Credentials: enforce
295
- if (search.provider !== 'brave') {
296
- search.provider = 'brave'
296
+ // Provider: enforce
297
+ if (search.provider !== 'perplexity') {
298
+ search.provider = 'perplexity'
299
+ dirty = true
300
+ }
301
+
302
+ // Perplexity credentials: enforce (nested under search.perplexity)
303
+ if (perplexity.apiKey !== pc.modelGatewayToken) {
304
+ perplexity.apiKey = pc.modelGatewayToken
297
305
  dirty = true
298
306
  }
299
- if (search.apiKey !== pc.braveSearchApiKey) {
300
- search.apiKey = pc.braveSearchApiKey
307
+ if (perplexity.baseUrl !== pc.modelGatewayBaseUrl) {
308
+ perplexity.baseUrl = pc.modelGatewayBaseUrl
309
+ dirty = true
310
+ }
311
+
312
+ // Perplexity model: set-if-missing
313
+ if (perplexity.model === undefined) {
314
+ perplexity.model = 'perplexity/sonar-pro'
301
315
  dirty = true
302
316
  }
303
317
 
@@ -312,6 +326,7 @@ export function patchWebSearch(config: Record<string, unknown>, pc: ConfigPlugin
312
326
  }
313
327
 
314
328
  if (dirty) {
329
+ search.perplexity = perplexity
315
330
  web.search = search
316
331
  tools.web = web
317
332
  config.tools = tools
@@ -57,8 +57,7 @@
57
57
  "defaultImageModel": { "type": "string" },
58
58
  "sessionMainKey": { "type": "string" },
59
59
  "elevenlabsApiKey": { "type": "string" },
60
- "elevenlabsVoiceId": { "type": "string" },
61
- "braveSearchApiKey": { "type": "string" }
60
+ "elevenlabsVoiceId": { "type": "string" }
62
61
  },
63
62
  "required": []
64
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2en/clawly-plugins",
3
- "version": "1.24.0",
3
+ "version": "1.24.1",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "repository": {