Revert "Keep the ai-chat model-map build inside the server lifecycle"

This reverts commit 1b2482dcb8.
This commit is contained in:
jelveh
2026-07-27 07:50:02 -07:00
parent ffe5d21113
commit e1d5ff58c0
2 changed files with 1 additions and 16 deletions
@@ -216,22 +216,10 @@ export class ChatCompletionDriver extends PuterDriver {
#providers: Record<string, IChatProvider> = {};
#modelIdMap: Record<string, IChatModel[]> = {};
#modelMapReady: Promise<void> = Promise.resolve();
override onServerStart() {
this.#registerProviders();
// Not awaited — providers fetch model lists over the network and
// boot must not block on their latency. Shutdown awaits the
// tracked promise so provider I/O (and its error logging) never
// outlives the server; a rejection here must not become an
// unhandled one.
this.#modelMapReady = this.#buildModelMap().catch((e) => {
console.error('Failed to build ai-chat model map:', e);
});
}
override async onServerShutdown() {
await this.#modelMapReady;
this.#buildModelMap();
}
// -- Interface methods -------------------------------------------
-3
View File
@@ -153,9 +153,6 @@ export const setupTestServer = async (
no_devwatch: true,
no_browser_launch: true,
import_ts_extensions: true,
// No local-Ollama auto-discovery: every test server would
// otherwise fire a doomed model-list fetch at localhost.
providers: { ollama: { enabled: false } },
}),
configOverrides ?? {},
) as IConfig;