breakroom 2.1.2 → 2.1.4
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/bin/setup.js +52 -6
- package/package.json +1 -1
package/bin/setup.js
CHANGED
|
@@ -217,12 +217,54 @@ function jsonPatch(text, proxyUrl) {
|
|
|
217
217
|
return null;
|
|
218
218
|
}
|
|
219
219
|
const before = JSON.stringify(parsed, null, 2);
|
|
220
|
-
parsed
|
|
221
|
-
parsed.ANTHROPIC_BASE_URL = proxyUrl;
|
|
220
|
+
for (const k of ALL_BASE_URL_KEYS) { parsed[k] = proxyUrl; }
|
|
222
221
|
const after = `${JSON.stringify(parsed, null, 2)}\n`;
|
|
223
|
-
return { text: after, changed: after.trim() !== before.trim(), summary:
|
|
222
|
+
return { text: after, changed: after.trim() !== before.trim(), summary: `set ${ALL_BASE_URL_KEYS.length} base URL keys` };
|
|
224
223
|
}
|
|
225
224
|
|
|
225
|
+
const ALL_BASE_URL_VARS = [
|
|
226
|
+
'OPENAI_BASE_URL', 'ANTHROPIC_BASE_URL',
|
|
227
|
+
'GOOGLE_API_BASE', 'GEMINI_API_BASE', 'VERTEX_API_BASE',
|
|
228
|
+
'AZURE_OPENAI_ENDPOINT', 'AZURE_OPENAI_BASE_URL',
|
|
229
|
+
'OPENROUTER_BASE_URL',
|
|
230
|
+
'TOGETHER_API_BASE',
|
|
231
|
+
'GROQ_BASE_URL', 'GROQ_API_BASE',
|
|
232
|
+
'DEEPSEEK_BASE_URL', 'DEEPSEEK_API_BASE',
|
|
233
|
+
'MISTRAL_API_URL', 'MISTRAL_BASE_URL',
|
|
234
|
+
'PERPLEXITY_API_BASE', 'PERPLEXITY_BASE_URL',
|
|
235
|
+
'FIREWORKS_API_BASE', 'FIREWORKS_BASE_URL',
|
|
236
|
+
'COHERE_API_URL',
|
|
237
|
+
'AI21_BASE_URL',
|
|
238
|
+
'XAI_BASE_URL', 'XAI_API_BASE',
|
|
239
|
+
'REPLICATE_API_BASE',
|
|
240
|
+
'HERMES_API_BASE', 'HERMES_BASE_URL',
|
|
241
|
+
'OPENAI_LIKE_API_BASE',
|
|
242
|
+
'LLM_BASE_URL', 'LLM_API_BASE', 'OPENAI_API_BASE',
|
|
243
|
+
];
|
|
244
|
+
|
|
245
|
+
const ALL_BASE_URL_KEYS = [
|
|
246
|
+
'OPENAI_BASE_URL', 'ANTHROPIC_BASE_URL',
|
|
247
|
+
'GOOGLE_API_BASE', 'GEMINI_API_BASE',
|
|
248
|
+
'AZURE_OPENAI_ENDPOINT',
|
|
249
|
+
'OPENROUTER_BASE_URL',
|
|
250
|
+
'TOGETHER_API_BASE',
|
|
251
|
+
'GROQ_BASE_URL',
|
|
252
|
+
'DEEPSEEK_BASE_URL',
|
|
253
|
+
'MISTRAL_API_URL',
|
|
254
|
+
'PERPLEXITY_API_BASE',
|
|
255
|
+
'FIREWORKS_API_BASE',
|
|
256
|
+
'COHERE_API_URL',
|
|
257
|
+
'AI21_BASE_URL',
|
|
258
|
+
'XAI_BASE_URL',
|
|
259
|
+
'REPLICATE_API_BASE',
|
|
260
|
+
'HERMES_API_BASE', 'HERMES_BASE_URL',
|
|
261
|
+
'OPENAI_LIKE_API_BASE',
|
|
262
|
+
'LLM_BASE_URL', 'OPENAI_API_BASE',
|
|
263
|
+
'openAiBaseUrl', 'anthropicBaseUrl',
|
|
264
|
+
'openAiBaseURL', 'anthropicBaseURL',
|
|
265
|
+
'hermesApiBase', 'hermesBaseUrl',
|
|
266
|
+
];
|
|
267
|
+
|
|
226
268
|
function buildPatch(filePath, proxyUrl) {
|
|
227
269
|
const ext = path.extname(filePath).toLowerCase();
|
|
228
270
|
const basename = path.basename(filePath).toLowerCase();
|
|
@@ -230,9 +272,13 @@ function buildPatch(filePath, proxyUrl) {
|
|
|
230
272
|
const original = exists ? fs.readFileSync(filePath, 'utf8') : '';
|
|
231
273
|
|
|
232
274
|
if (basename.startsWith('.env')) {
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
275
|
+
let current = original;
|
|
276
|
+
const summaries = [];
|
|
277
|
+
for (const v of ALL_BASE_URL_VARS) {
|
|
278
|
+
const p = linePatch(current, v, proxyUrl);
|
|
279
|
+
if (p.changed) { current = p.text; summaries.push(p.summary); }
|
|
280
|
+
}
|
|
281
|
+
return { filePath, exists, original, updated: current, summaries };
|
|
236
282
|
}
|
|
237
283
|
|
|
238
284
|
if (ext === '.json') {
|