Commit Graph

13 Commits

Author SHA1 Message Date
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