Skip to content

try/catch block outside async function in useLLM hook #399

@jakmro

Description

@jakmro

try/catch Block Should Be Moved Inside Async Function in useEffect Hook

 useEffect(() => {
    setDownloadProgress(0);
    setError(null);

    if (!preventLoad) {
      try {
        (async () => {
          await model.load({
            modelSource,
            tokenizerSource,
            tokenizerConfigSource,
          });
        })();
      } catch (e) {
        setError(e);
      }
    }

    return () => {
      model.delete();
    };
  }, [modelSource, tokenizerSource, tokenizerConfigSource, preventLoad, model]);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions