openads-ai 0.2.5 → 0.2.6
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/dist/cli.js +36 -1
- package/dist/schedule.js +4 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -325,7 +325,9 @@ async function main() {
|
|
|
325
325
|
// ─── Build Pi Arguments ─────────────────────────────────────────
|
|
326
326
|
const piArgsRaw = [];
|
|
327
327
|
// Model flag
|
|
328
|
-
|
|
328
|
+
const isLocal = !!config.localBaseUrl;
|
|
329
|
+
const modelIdForPi = isLocal && cleanProvider.includes('/') ? cleanProvider.split('/')[1] : cleanProvider;
|
|
330
|
+
piArgsRaw.push('--model', modelIdForPi);
|
|
329
331
|
// Skills directories
|
|
330
332
|
const skillsDir = path.join(pkgDir, 'skills');
|
|
331
333
|
const templatesDir = path.join(pkgDir, 'templates');
|
|
@@ -393,6 +395,39 @@ async function main() {
|
|
|
393
395
|
};
|
|
394
396
|
}
|
|
395
397
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
398
|
+
// ─── Write models.json for Local AI ─────────────────────────────
|
|
399
|
+
const modelsPath = path.join(agentDir, 'models.json');
|
|
400
|
+
if (isLocal) {
|
|
401
|
+
const modelsConfig = {
|
|
402
|
+
providers: {
|
|
403
|
+
"local-ai": {
|
|
404
|
+
baseUrl: config.localBaseUrl,
|
|
405
|
+
api: "openai-completions",
|
|
406
|
+
apiKey: "local-key-placeholder",
|
|
407
|
+
compat: {
|
|
408
|
+
supportsDeveloperRole: false,
|
|
409
|
+
supportsReasoningEffort: false
|
|
410
|
+
},
|
|
411
|
+
models: [
|
|
412
|
+
{
|
|
413
|
+
id: modelIdForPi,
|
|
414
|
+
name: `${modelIdForPi} (Local)`
|
|
415
|
+
}
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
fs.writeFileSync(modelsPath, JSON.stringify(modelsConfig, null, 2));
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
// If not local, remove custom models.json to avoid conflicts
|
|
424
|
+
if (fs.existsSync(modelsPath)) {
|
|
425
|
+
try {
|
|
426
|
+
fs.unlinkSync(modelsPath);
|
|
427
|
+
}
|
|
428
|
+
catch (e) { }
|
|
429
|
+
}
|
|
430
|
+
}
|
|
396
431
|
// ─── Launch Agent ───────────────────────────────────────────────
|
|
397
432
|
const piCliPath = path.resolve(pkgDir, 'node_modules', '@earendil-works', 'pi-coding-agent', 'dist', 'cli.js');
|
|
398
433
|
spinner.succeed(chalk.green('Agent ready'));
|
package/dist/schedule.js
CHANGED
|
@@ -249,9 +249,12 @@ export async function runScheduledTask(name) {
|
|
|
249
249
|
}
|
|
250
250
|
const skillsDir = path.resolve(pkgDir, 'skills');
|
|
251
251
|
const contextDir = path.join(CONFIG_DIR, 'context');
|
|
252
|
+
const cleanModel = config.provider;
|
|
253
|
+
const isLocal = !!config.localBaseUrl;
|
|
254
|
+
const modelIdForPi = isLocal && cleanModel.includes('/') ? cleanModel.split('/')[1] : cleanModel;
|
|
252
255
|
const args = [
|
|
253
256
|
piCliPath,
|
|
254
|
-
'--model',
|
|
257
|
+
'--model', modelIdForPi,
|
|
255
258
|
'--skill', skillsDir,
|
|
256
259
|
...(fs.existsSync(contextDir) ? ['--skill', contextDir] : []),
|
|
257
260
|
'--print',
|
package/package.json
CHANGED