ShipBit / slickgpt

SlickGPT is a light-weight "use-your-own-API-key" web client for the OpenAI API written in Svelte. It offers GPT-4 integration, a userless share feature and other superpowers.
https://slickgpt.vercel.app
MIT License
467 stars 95 forks source link

Fix keylistener handling, resolve race condition, and correct delete chat functionality #116

Closed Anajrim01 closed 2 months ago

Anajrim01 commented 2 months ago

Summary

This PR addresses the following issues:

  1. Keylistener Issue: Prevents the default action that blocks the arrow keys' movement within the textarea.
  2. Race Condition: Fixes a race condition introduced in #111 that could disrupt normal operations.
  3. Delete Chat Bug: Corrects the delete chat functionality, resolving a bug introduced in #112.

Background

  1. Keylistener Issue: The svelte-command-palette library stops the propagation of arrow keys by calling preventDefault. This workaround adjusts the keylistener logic to allow arrow key navigation within the textarea. More details can be found in the issue posted here: https://github.com/rohitpotato/svelte-command-palette/issues/16.
  2. Race Condition: The race condition was inadvertently introduced in #111 by not properly handling asynchronous operations. This has been resolved by ensuring proper sequencing and handling of async tasks.
  3. Delete Chat Bug: The bug in the delete chat functionality was introduced in #112. It was caused by a function getProviderForModel returning undefined before checking if the model is undefined. The function now ensures proper checks to avoid this issue.

Changes

Related PRs

Issue References

Testing

vercel[bot] commented 2 months ago

@Anajrim01 is attempting to deploy a commit to the ShipBit Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
slickgpt ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 14, 2024 3:13pm