mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-24 15:07:17 +00:00
Revert "Keep the ai-chat model-map build inside the server lifecycle"
This reverts commit 1b2482dcb8.
This commit is contained in:
@@ -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 -------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user