-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xef-dashboard basic API #372
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been trying the code locally and I have a problem
When I create the website using npm run dev
the page works as expected, but if I create the website using ./gradlew web
when I send a message I always receive this message Chat completions request couldn't be completed, is the API key set?
. I'm saving the API key in the settings
On the other hand, if I reload the page in the browser I have to save the API Key again. I understand what the problem is, but should we store the key somewhere?
Everything works as expected on my end. Is the server working OK if you request through Regarding the API key: of course, ideally, the API key, along the rest of settings, could be saved in the There's probably room to improve in all components, but the PR scope should be set somewhere, otherwise the code might get cut without being finished. For example, in this one, initially the API key was set per request, but I thought this could be a good opportunity to see the difference between local state (questions and its responses) and context (settings data) in proper code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 LGTM!
I was opening the web from http://0.0.0.0:8080 and this is not working because is blocked by CORS policy. Finally using http://localhost:8080 is working as expected
Description
This PR adds the needed code to be able to connect with
xef-server
API and communicate with it though a generic form. Currently, it uses thechat/completions
endpoint. In order to use this in the best way, the request body and response have been types following the OpenAI documentation:https://github.com/openai/openai-node/
To be able to properly exchange data with the API, the changes also add a Settings page, where the user can save its
xef-server
/OpenAI API key to communicate with the server.It also modifies Ktor config to allow CORS auth, as it previously wouldn't work through the combination of CORS and the
Authorization
header.Preview