Commit Graph

16 Commits

Author SHA1 Message Date
Enrico Ros 064de8dc1e Export chats. Closes #25
Chats are exported to paste.gg, are unlisted by default, and expire
in 30 days by default. The user is also provided with the deletion
key which will be only shown at the time of creation, and it's needed
to take down the paste.

Rendering looks quite great, including code and turns.
2023-04-01 04:38:53 -07:00
Enrico Ros 7154db7f72 Configurable API Host
Closes #32. Enable Users / Deployments to change the host where
OpenAI API calls are directed to. This enables project like
[Helicone](https://www.helicone.ai/) (Observability of LLM ops)
for tracking prompt/responses quality in real-time.

Configuration:
- User: App > Settings > Advanced > API host (e.g. "oai.hconeai.com")
- Deployment: set the 'API_API_HOST=...' environment variable

User takes precedence over deployment over api.openai.com. Realtime
switching in chat apps works well.

Note: the Helicone team is fixing dashboard reporting for 'streaming'
over the /v1/chat/completions endpoint.
2023-03-30 20:00:40 -07:00
Enrico Ros 3e0cd173af Fix 2023-03-29 15:32:12 -07:00
Enrico Ros 5008f111a7 Merged #22. Stop button in the UI
The UI side works well, including aborting the network
request to the api, and showing status and issues.
The API function (api/chat.ts) doesn't seem to work yet,
as the try/catch blocks are not triggered (both on the
'handler', and in the 'OpenAIStream').
In the meantime, having the Stop button on the UI is still
a net gain, despite tokens still running/being used from
the API call.
2023-03-26 04:25:23 -07:00
Enrico Ros 1b340deb31 Cleanup types 2023-03-26 02:22:03 -07:00
Enrico Ros f16e744ef9 Smaller moves 2023-03-24 19:06:36 -07:00
Enrico Ros 4ef48f0923 Lints 2023-03-24 18:22:13 -07:00
Enrico Ros a63c9123dd Improve the Api (/api/chat) payload 2023-03-24 01:39:51 -07:00
Fred Liu 0ca13e67e6 Stop Generation button initial implementation. 2023-03-23 00:44:17 -07:00
Enrico Ros 3e6bbd8fe8 Persisted State Store - enables better UX
Basic implementation using Zustand to store values. For now just the
ChatModel and the SystemPurpose that are currently active. This enables
app-wide synchronization and automated persistence. Meaning we can now
have settings (and in future conversations) which are persisted and
synchronized.

API keys have not been migrated yet, because we need to import them from
the existing localStorage key, for a smooth transition.
2023-03-22 00:29:51 -07:00
Enrico Ros 2d0136c78f Display the API model (as tooltip)
Behind the scenes, we detect the model name from the OpenAI
streaming API (it's in all the chunks), and stream it back
to the UI as a serialized JSON object. This is more of a
workaround, required by virtue of the streaming API, and can
be cleaned up later.

Model names available when hovering 'gpt-4' / '3.5-turbo'.
2023-03-19 23:08:38 -07:00
Enrico Ros 1677db1df8 Error Handling
Show the user if Errors are raised from the OpenAI API, or by
our backend. Good messaging, red coloring.
2023-03-19 05:11:17 -07:00
Enrico Ros 3c60361635 User Provided API Keys
The keys are stored within the localStorage of the browser.
The string is passed to the backend as a parameter in the REST
API call (to '/api/chat'), where it has priority over other
keys set in the OPENAI_API_KEY of the backend.
2023-03-19 04:28:20 -07:00
Enrico Ros d2a7082564 Add Application
NextJS, React, JoyUI (like MUI), application for self-hosted
Chat-like GPT use cases. Includes streaming of responses from
the Vercel edge runtimes.
2023-03-19 00:42:23 -07:00
Enrico Ros f646fca299 Remove template stuff 2023-03-19 00:24:09 -07:00
Enrico Ros 0b4646cd0a Create Next App 2023-03-18 23:54:30 -07:00