offgrid-ai 0.6.3 → 0.6.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/package.json +1 -1
- package/src/benchmark.mjs +7 -29
package/package.json
CHANGED
package/src/benchmark.mjs
CHANGED
|
@@ -7,7 +7,6 @@ import { execFile } from "node:child_process";
|
|
|
7
7
|
import { promisify } from "node:util";
|
|
8
8
|
import { ensureDirs, loadConfig, saveConfig } from "./config.mjs";
|
|
9
9
|
import { backendFor } from "./backends.mjs";
|
|
10
|
-
import { serverMatchesProfile, serverReady } from "./process.mjs";
|
|
11
10
|
import { pc, createPrompt, renderRows, renderSection } from "./ui.mjs";
|
|
12
11
|
|
|
13
12
|
const execFileAsync = promisify(execFile);
|
|
@@ -151,35 +150,15 @@ function intendedRunnerForProfile(profile) {
|
|
|
151
150
|
return harnessDisplayName(id);
|
|
152
151
|
}
|
|
153
152
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
if (!ready) return { running: false };
|
|
158
|
-
const match = await serverMatchesProfile(profile).catch(() => ({ matches: true, reason: "server responded" }));
|
|
159
|
-
return { running: match.matches, reason: match.reason };
|
|
160
|
-
}
|
|
153
|
+
function printBenchmarkNextSteps({ repoPath, runDirectory, profile, modelId, runnerLabel }) {
|
|
154
|
+
const runCommand = profile ? `offgrid-ai run ${profile.id}` : null;
|
|
155
|
+
const runnerCommand = runCommand ?? `Open ${runnerLabel} for ${modelId}`;
|
|
161
156
|
|
|
162
|
-
function printBenchmarkNextSteps({ repoPath, profile, modelId, runnerLabel, serverStatus }) {
|
|
163
157
|
console.log("");
|
|
164
158
|
console.log(pc.bold("Next steps"));
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const command = `offgrid-ai run ${profile.id}`;
|
|
169
|
-
if (serverStatus?.running) {
|
|
170
|
-
const reason = serverStatus.reason ? pc.dim(` (${serverStatus.reason})`) : "";
|
|
171
|
-
console.log(` ${step++}. Model server is already running at ${pc.cyan(profile.baseUrl)}${reason}`);
|
|
172
|
-
console.log(` ${pc.dim(`If you still need to open ${runnerLabel}, run: ${command}`)}`);
|
|
173
|
-
} else {
|
|
174
|
-
console.log(` ${step++}. If the model server is not already running, run: ${pc.cyan(command)}`);
|
|
175
|
-
}
|
|
176
|
-
} else {
|
|
177
|
-
console.log(` ${step++}. Open ${runnerLabel} for ${pc.bold(modelId)}`);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
console.log(` ${step++}. ${pc.cyan(`cd ${repoPath}`)}`);
|
|
181
|
-
console.log(` ${step++}. ${pc.cyan("npm run dev")}`);
|
|
182
|
-
console.log(` ${step}. In the gallery, find this run, copy the prompt, and paste it into ${runnerLabel}`);
|
|
159
|
+
console.log(` 1. Open the gallery. If it is not running: ${pc.cyan(`cd ${repoPath} && npm run dev`)}`);
|
|
160
|
+
console.log(` 2. ${pc.cyan(`cd ${runDirectory}`)}`);
|
|
161
|
+
console.log(` 3. ${pc.cyan(runnerCommand)}, then copy this run's prompt from the gallery and paste it into ${runnerLabel}`);
|
|
183
162
|
}
|
|
184
163
|
|
|
185
164
|
async function prepareBenchmarkRun({ repoPath, benchmark, kind, modelId, modelSource, backendLabel, profile }) {
|
|
@@ -188,7 +167,6 @@ async function prepareBenchmarkRun({ repoPath, benchmark, kind, modelId, modelSo
|
|
|
188
167
|
const runId = createRunId(now);
|
|
189
168
|
const modelSlug = slugModelId(modelId);
|
|
190
169
|
const runnerLabel = intendedRunnerForProfile(profile);
|
|
191
|
-
const serverStatus = await profileServerStatus(profile);
|
|
192
170
|
const runsDir = join(repoPath, "runs");
|
|
193
171
|
const benchmarkDirectory = join(runsDir, benchmark.id);
|
|
194
172
|
const modelDirectory = join(benchmarkDirectory, modelSlug);
|
|
@@ -237,7 +215,7 @@ async function prepareBenchmarkRun({ repoPath, benchmark, kind, modelId, modelSo
|
|
|
237
215
|
["Source", backendLabel || modelSource],
|
|
238
216
|
])));
|
|
239
217
|
|
|
240
|
-
printBenchmarkNextSteps({ repoPath, profile, modelId, runnerLabel
|
|
218
|
+
printBenchmarkNextSteps({ repoPath, runDirectory, profile, modelId, runnerLabel });
|
|
241
219
|
|
|
242
220
|
return runDirectory;
|
|
243
221
|
}
|