e6687917 by Janis

Merge branch 'fix_master_updated_ui' into '1DEVT'

fix_master_updated_ui

See merge request !5
2 parents 21eeded6 b22f9a7b
# ChatGPT Server
## Installation
npm install on the root directory.
## Create ENV Variables
Create an .env file in the root directory of your application.
Duplicate the env-template and rename to .env
In the .env file, define the environment variables you want to use in your application. ex.
API_KEY="sk-xxxxxxxx"
API_ORG="org-xxxxxxx"
SERVER_URL="http://localhost:3080/"
## Run server
Run server on the root directory
`node index.js`
......@@ -13,6 +13,7 @@
# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
......
# ChatGPT Client
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Installation
npm install on the /client directory.
## Available Scripts
In the project directory, you can run:
In the /client directory, you can run:
### `npm start`
......
......@@ -26,7 +26,7 @@ function App() {
}
function getEngines(){
fetch("http://localhost:3080/models")
fetch(process.env.SERVER_URL + "/models")
.then(res => res.json())
.then(data => {
console.log(data.models.data)
......@@ -48,7 +48,7 @@ function App() {
// fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post
const messages = chatLogNew.map((message) => message.message).join("\n")
const response = await fetch("http://localhost:3080/", {
const response = await fetch(process.env.SERVER_URL, {
method: "POST",
headers: {
"Content-Type": "application/json"
......
OPENAI_API_ORG=
OPENAI_API_KEY=
SERVER_URL=
\ No newline at end of file
......@@ -5,8 +5,8 @@ const cors = require('cors')
// Open AI Configuration
const configuration = new Configuration({
organization: "org-organization",
apiKey: "sk-apiKey",
organization: process.env.OPENAI_API_ORG,
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
......@@ -22,12 +22,12 @@ app.use(require('morgan')('dev'))
// Routing
// Primary Open AI Route
app.post('/', async (req, res) => {
app.post('/api', async (req, res) => {
const { message, currentModel, temperature } = req.body;
const response = await openai.createCompletion({
model: `${currentModel}`,// "text-davinci-003",
prompt: `${message}`,
max_tokens: 100,
max_tokens: 2500,
temperature,
});
res.json({
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!