Using and Edge function for accessing the Google API and
return the search results (.items[]) to the client (browser).
Added all type definitions (browser<>edge, and edge<>google),
and honor environment variables. When both the new environment
variables are set at build time, the user won't be asked for
keys.
Basically this implements #98, via ReAct.
Note: Steps is limited upstream to 50, so we set that as maximum. When the
seed is random, it's not returned by the API, so a good generated image won't
be reproducible, unless the seed was set to something random beforehand.
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.
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.
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.
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.