feat: add support for other base urls, gpt 16k #84
+93
−151
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This allows people to use OpenAI-compatible models like LocalAI, and closes #82. Or it allows people to use their own openai proxy for api key safety or observability, or LLMOps products like Helicone or Portkey (although these services need you to pass additional headers; maybe that's the next thing to add).
Solution
Adds an API Base URL field to the settings page. I removed the API key modal because it seemed like duplicating functionality that's already in the settings modal. I do get the argument for simplicity, so maybe we could rework the settings modal UI e.g. hide extra options under a dropdown. I also put both the API key and base URL state in the same settings localStorage JSON object. I updated
openai-streams
package to fix typescript errors on theapiBase
property. Also added a few missing dependencies that causedpnpm
to fail.Checklist