Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: unhandled rejection error #529

Conversation

hacking-racoon
Copy link

@hacking-racoon hacking-racoon commented Dec 24, 2024

Background

Cause

  • Model-related information is stored in local storage (e.g., chatModel, chatModelProvider, embeddingModel, embeddingModelProvider, etc.).
    image

  • An error occurred (unhandled rejection) because the local storage information was used as-is, even though the inference server had changed. (There is a case where available chat models cannot be checked)
    image

Solution

  • Logical changes (Included in the PR)
    Replaced local storage with session storage.
    Ensures storage is refreshed each time a new tab is opened.

  • Guidance change proposal (just proposal)
    Adding a help message advising users to clear the storage in case of an "unhandled rejection" error. (readme.md)

@ItzCrazyKns . I hope this helps with your amazing project!

@ItzCrazyKns
Copy link
Owner

ItzCrazyKns commented Dec 24, 2024

There's this piece of code present in the chat window file which checks if the model exists in the list of the available chat models if not it will select another one.

if (
  Object.keys(chatModelProviders).length > 0 &&
  !chatModelProviders[chatModelProvider]
) {
  chatModelProvider = Object.keys(chatModelProviders)[0];
  localStorage.setItem("chatModelProvider", chatModelProvider);
}

@hacking-racoon
Copy link
Author

hacking-racoon commented Dec 24, 2024

@ItzCrazyKns
During the system setup process, while testing by modifying the config.toml file, if the chatModelProvider stored in localStorage is set to custom_openai for any reason (There are cases where it is unintentionally configured depending on the test scenario)

the block containing localStorage.setItem('chatModel', chatModel); (line 130, ChatWindow.tsx) does not function as expected.

Therefore, I believe we should use sessionStorage.

Please use Chrome developer tools to modify it directly and check the behavior. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants