Gate startup logs behind PI_DEBUG + skip GGUF-shard phantom entries
- All [ai-server] / [markdown-body-color] / [mechanicus-thinking-label] console.log calls now fire only when PI_DEBUG is set. Default boot is clean. - ai-server's discoverModels now filters out ids matching /-\d+-of-\d+$/ — llama.cpp's --models-autoload registers every GGUF shard as its own id, duplicating the preset's consolidated model. These shard-named phantoms are no longer surfaced to pi. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+12
-1
@@ -106,9 +106,20 @@ function isRunnable(m: RouterModel): boolean {
|
||||
return (m.status?.args ?? []).includes("--model");
|
||||
}
|
||||
|
||||
// llama.cpp's --models-autoload scans the --models-dir and registers every
|
||||
// .gguf (and GGUF-split shard) it finds. Multi-shard models surface as
|
||||
// one id per shard with names like "<name>-00001-of-00003". These are
|
||||
// duplicates of whatever preset section points at the first shard. Skip them.
|
||||
function isShardArtefact(id: string): boolean {
|
||||
return /-\d+-of-\d+$/.test(id);
|
||||
}
|
||||
|
||||
export async function discoverModels(): Promise<ServerModel[]> {
|
||||
const models = await listModels();
|
||||
return models.filter(isRunnable).map((m) => {
|
||||
return models
|
||||
.filter(isRunnable)
|
||||
.filter((m) => !isShardArtefact(m.id))
|
||||
.map((m) => {
|
||||
const ctx = extractCtxSize(m) ?? 32768;
|
||||
return {
|
||||
id: m.id,
|
||||
|
||||
@@ -241,9 +241,11 @@ export default async function (pi: ExtensionAPI) {
|
||||
},
|
||||
});
|
||||
|
||||
if (process.env.PI_DEBUG) {
|
||||
console.log(
|
||||
`[ai-server] Registered ${models.length} model(s) via ${source} on ${AI_SERVER_URL} (mTLS): ${models
|
||||
.map((m) => m.id)
|
||||
.join(", ")}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,9 @@ export default function (_pi: ExtensionAPI) {
|
||||
return lines.map(wrap);
|
||||
};
|
||||
|
||||
if (process.env.PI_DEBUG) {
|
||||
console.log(
|
||||
`[markdown-body-color] Body color = ${FALLBACK_HEX} (Markdown + Editor)`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,5 +32,7 @@ export default function (_pi: ExtensionAPI) {
|
||||
return origUpdate.call(this, message);
|
||||
};
|
||||
|
||||
if (process.env.PI_DEBUG) {
|
||||
console.log(`[mechanicus-thinking-label] "${DEFAULT_LABEL}" -> "${LABEL}"`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user