Skip to content

Commit

Permalink
fix: Correctly reload model after service worker is stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
Neet-Nestor committed May 20, 2024
1 parent 24f8138 commit cb14085
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/client/webllm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

import { ChatOptions, LLMApi, LLMConfig, RequestMessage } from "./api";

const KEEP_ALIVE_INTERVAL = 10_000;
const KEEP_ALIVE_INTERVAL = 5_000;

export class WebLLMApi implements LLMApi {
private llmConfig?: LLMConfig;
Expand Down Expand Up @@ -71,7 +71,9 @@ export class WebLLMApi implements LLMApi {
options.onUpdate,
);
} catch (err: any) {
if (err.toString().includes("Please call `Engine.reload(model)` first")) {
if (
!err.toString().includes("Please call `Engine.reload(model)` first")
) {
console.error("Error in chatCompletion", err);
options.onError?.(err as Error);
return;
Expand Down

0 comments on commit cb14085

Please sign in to comment.