breakroom 2.1.2 → 2.1.3
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 +49 -6
- package/package.json +1 -1
package/bin/setup.js
CHANGED
|
@@ -217,12 +217,51 @@ 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
|
+
'OPENAI_LIKE_API_BASE',
|
|
241
|
+
'LLM_BASE_URL', 'LLM_API_BASE', 'OPENAI_API_BASE',
|
|
242
|
+
];
|
|
243
|
+
|
|
244
|
+
const ALL_BASE_URL_KEYS = [
|
|
245
|
+
'OPENAI_BASE_URL', 'ANTHROPIC_BASE_URL',
|
|
246
|
+
'GOOGLE_API_BASE', 'GEMINI_API_BASE',
|
|
247
|
+
'AZURE_OPENAI_ENDPOINT',
|
|
248
|
+
'OPENROUTER_BASE_URL',
|
|
249
|
+
'TOGETHER_API_BASE',
|
|
250
|
+
'GROQ_BASE_URL',
|
|
251
|
+
'DEEPSEEK_BASE_URL',
|
|
252
|
+
'MISTRAL_API_URL',
|
|
253
|
+
'PERPLEXITY_API_BASE',
|
|
254
|
+
'FIREWORKS_API_BASE',
|
|
255
|
+
'COHERE_API_URL',
|
|
256
|
+
'AI21_BASE_URL',
|
|
257
|
+
'XAI_BASE_URL',
|
|
258
|
+
'REPLICATE_API_BASE',
|
|
259
|
+
'OPENAI_LIKE_API_BASE',
|
|
260
|
+
'LLM_BASE_URL', 'OPENAI_API_BASE',
|
|
261
|
+
'openAiBaseUrl', 'anthropicBaseUrl',
|
|
262
|
+
'openAiBaseURL', 'anthropicBaseURL',
|
|
263
|
+
];
|
|
264
|
+
|
|
226
265
|
function buildPatch(filePath, proxyUrl) {
|
|
227
266
|
const ext = path.extname(filePath).toLowerCase();
|
|
228
267
|
const basename = path.basename(filePath).toLowerCase();
|
|
@@ -230,9 +269,13 @@ function buildPatch(filePath, proxyUrl) {
|
|
|
230
269
|
const original = exists ? fs.readFileSync(filePath, 'utf8') : '';
|
|
231
270
|
|
|
232
271
|
if (basename.startsWith('.env')) {
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
272
|
+
let current = original;
|
|
273
|
+
const summaries = [];
|
|
274
|
+
for (const v of ALL_BASE_URL_VARS) {
|
|
275
|
+
const p = linePatch(current, v, proxyUrl);
|
|
276
|
+
if (p.changed) { current = p.text; summaries.push(p.summary); }
|
|
277
|
+
}
|
|
278
|
+
return { filePath, exists, original, updated: current, summaries };
|
|
236
279
|
}
|
|
237
280
|
|
|
238
281
|
if (ext === '.json') {
|