@phi-code-admin/phi-code 0.57.1 ā 0.57.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/extensions/phi/init.ts +26 -17
- package/package.json +1 -1
package/extensions/phi/init.ts
CHANGED
|
@@ -246,6 +246,7 @@ _Edit this file to customize Phi Code's behavior for your project._
|
|
|
246
246
|
|
|
247
247
|
if (existingResults?.results?.length > 0) {
|
|
248
248
|
const useExisting = await ctx.ui.confirm(
|
|
249
|
+
"Use existing benchmarks?",
|
|
249
250
|
`Found ${existingResults.results.length} existing benchmark results. Use them instead of re-running?`
|
|
250
251
|
);
|
|
251
252
|
if (useExisting) {
|
|
@@ -298,15 +299,18 @@ _Edit this file to customize Phi Code's behavior for your project._
|
|
|
298
299
|
ctx.ui.notify("šļø Manual mode: assign a model to each task category.\n", "info");
|
|
299
300
|
|
|
300
301
|
const modelList = availableModels.map((m, i) => ` ${i + 1}. ${m}`).join("\n");
|
|
302
|
+
ctx.ui.notify(`Available models:\n${modelList}\n`, "info");
|
|
301
303
|
const assignments: Record<string, { preferred: string; fallback: string }> = {};
|
|
302
304
|
|
|
303
305
|
for (const role of TASK_ROLES) {
|
|
306
|
+
ctx.ui.notify(`\n**${role.label}** ā ${role.desc}\nDefault: ${role.defaultModel}`, "info");
|
|
304
307
|
const input = await ctx.ui.input(
|
|
305
|
-
|
|
308
|
+
`${role.label}`,
|
|
309
|
+
`Model name or # (default: ${role.defaultModel})`
|
|
306
310
|
);
|
|
307
311
|
|
|
308
312
|
let chosen = role.defaultModel;
|
|
309
|
-
const trimmed = input.trim();
|
|
313
|
+
const trimmed = (input ?? "").trim();
|
|
310
314
|
|
|
311
315
|
if (trimmed) {
|
|
312
316
|
// Try as number
|
|
@@ -323,16 +327,17 @@ _Edit this file to customize Phi Code's behavior for your project._
|
|
|
323
327
|
// Fallback selection
|
|
324
328
|
const fallbackDefault = availableModels.find(m => m !== chosen) || chosen;
|
|
325
329
|
const fallbackInput = await ctx.ui.input(
|
|
326
|
-
`Fallback
|
|
330
|
+
`Fallback for ${role.label}`,
|
|
331
|
+
`Fallback model (default: ${fallbackDefault})`
|
|
327
332
|
);
|
|
328
333
|
|
|
329
334
|
let fallback = fallbackDefault;
|
|
330
|
-
if (fallbackInput.trim()) {
|
|
331
|
-
const num = parseInt(fallbackInput.trim());
|
|
335
|
+
if ((fallbackInput ?? "").trim()) {
|
|
336
|
+
const num = parseInt((fallbackInput ?? "").trim());
|
|
332
337
|
if (num >= 1 && num <= availableModels.length) {
|
|
333
338
|
fallback = availableModels[num - 1];
|
|
334
339
|
} else {
|
|
335
|
-
const match = availableModels.find(m => m.toLowerCase().includes(fallbackInput.trim().toLowerCase()));
|
|
340
|
+
const match = availableModels.find(m => m.toLowerCase().includes((fallbackInput ?? "").trim().toLowerCase()));
|
|
336
341
|
if (match) fallback = match;
|
|
337
342
|
}
|
|
338
343
|
}
|
|
@@ -343,15 +348,16 @@ _Edit this file to customize Phi Code's behavior for your project._
|
|
|
343
348
|
|
|
344
349
|
// Default model
|
|
345
350
|
const defaultInput = await ctx.ui.input(
|
|
346
|
-
|
|
351
|
+
"Default model",
|
|
352
|
+
`Model for general tasks (default: ${availableModels[0]})`
|
|
347
353
|
);
|
|
348
354
|
let defaultModel = availableModels[0];
|
|
349
|
-
if (defaultInput.trim()) {
|
|
350
|
-
const num = parseInt(defaultInput.trim());
|
|
355
|
+
if ((defaultInput ?? "").trim()) {
|
|
356
|
+
const num = parseInt((defaultInput ?? "").trim());
|
|
351
357
|
if (num >= 1 && num <= availableModels.length) {
|
|
352
358
|
defaultModel = availableModels[num - 1];
|
|
353
359
|
} else {
|
|
354
|
-
const match = availableModels.find(m => m.toLowerCase().includes(defaultInput.trim().toLowerCase()));
|
|
360
|
+
const match = availableModels.find(m => m.toLowerCase().includes((defaultInput ?? "").trim().toLowerCase()));
|
|
355
361
|
if (match) defaultModel = match;
|
|
356
362
|
}
|
|
357
363
|
}
|
|
@@ -391,16 +397,19 @@ _Edit this file to customize Phi Code's behavior for your project._
|
|
|
391
397
|
ctx.ui.notify(` Total: ${allModels.length} models available\n`, "info");
|
|
392
398
|
|
|
393
399
|
// 2. Choose mode
|
|
400
|
+
ctx.ui.notify("Choose setup mode:\n" +
|
|
401
|
+
" 1. auto ā Use optimal defaults (instant)\n" +
|
|
402
|
+
" 2. benchmark ā Test models first, assign by results (10-15 min)\n" +
|
|
403
|
+
" 3. manual ā Choose each model yourself\n", "info");
|
|
404
|
+
|
|
394
405
|
const modeInput = await ctx.ui.input(
|
|
395
|
-
"
|
|
396
|
-
"
|
|
397
|
-
" 2. benchmark ā Test models with coding tasks, assign by results (10-15 min)\n" +
|
|
398
|
-
" 3. manual ā Choose each model assignment yourself\n\n" +
|
|
399
|
-
"Enter 1, 2, or 3:"
|
|
406
|
+
"Setup mode",
|
|
407
|
+
"1=auto, 2=benchmark, 3=manual"
|
|
400
408
|
);
|
|
401
409
|
|
|
402
|
-
const
|
|
403
|
-
|
|
410
|
+
const modeStr = (modeInput ?? "").trim().toLowerCase();
|
|
411
|
+
const mode = modeStr.startsWith("2") || modeStr.startsWith("b") ? "benchmark"
|
|
412
|
+
: modeStr.startsWith("3") || modeStr.startsWith("m") ? "manual"
|
|
404
413
|
: "auto";
|
|
405
414
|
|
|
406
415
|
ctx.ui.notify(`\nš Mode: **${mode}**\n`, "info");
|