env
Showing
4 changed files
with
10 additions
and
2 deletions
| ... | @@ -26,7 +26,7 @@ function App() { | ... | @@ -26,7 +26,7 @@ function App() { |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | function getEngines(){ | 28 | function getEngines(){ |
| 29 | fetch(process.env.SERVER_URL + "/models") | 29 | fetch(process.env.SERVER_URL + "models") |
| 30 | .then(res => res.json()) | 30 | .then(res => res.json()) |
| 31 | .then(data => { | 31 | .then(data => { |
| 32 | console.log(data.models.data) | 32 | console.log(data.models.data) |
| ... | @@ -48,7 +48,7 @@ function App() { | ... | @@ -48,7 +48,7 @@ function App() { |
| 48 | // fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post | 48 | // fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post |
| 49 | const messages = chatLogNew.map((message) => message.message).join("\n") | 49 | const messages = chatLogNew.map((message) => message.message).join("\n") |
| 50 | 50 | ||
| 51 | const response = await fetch(process.env.SERVER_URL, { | 51 | const response = await fetch(process.env.SERVER_URL + "api", { |
| 52 | method: "POST", | 52 | method: "POST", |
| 53 | headers: { | 53 | headers: { |
| 54 | "Content-Type": "application/json" | 54 | "Content-Type": "application/json" | ... | ... |
| ... | @@ -2,8 +2,10 @@ const { Configuration, OpenAIApi } = require("openai"); | ... | @@ -2,8 +2,10 @@ const { Configuration, OpenAIApi } = require("openai"); |
| 2 | const express = require('express') | 2 | const express = require('express') |
| 3 | const bodyParser = require('body-parser') | 3 | const bodyParser = require('body-parser') |
| 4 | const cors = require('cors') | 4 | const cors = require('cors') |
| 5 | require('dotenv').config() | ||
| 5 | 6 | ||
| 6 | // Open AI Configuration | 7 | // Open AI Configuration |
| 8 | console.log(process.env.OPENAI_API_ORG) | ||
| 7 | const configuration = new Configuration({ | 9 | const configuration = new Configuration({ |
| 8 | organization: process.env.OPENAI_API_ORG, | 10 | organization: process.env.OPENAI_API_ORG, |
| 9 | apiKey: process.env.OPENAI_API_KEY, | 11 | apiKey: process.env.OPENAI_API_KEY, | ... | ... |
| ... | @@ -142,6 +142,11 @@ | ... | @@ -142,6 +142,11 @@ |
| 142 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", | 142 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", |
| 143 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" | 143 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" |
| 144 | }, | 144 | }, |
| 145 | "dotenv": { | ||
| 146 | "version": "16.0.3", | ||
| 147 | "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", | ||
| 148 | "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==" | ||
| 149 | }, | ||
| 145 | "ee-first": { | 150 | "ee-first": { |
| 146 | "version": "1.1.1", | 151 | "version": "1.1.1", |
| 147 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", | 152 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", | ... | ... |
| ... | @@ -11,6 +11,7 @@ | ... | @@ -11,6 +11,7 @@ |
| 11 | "dependencies": { | 11 | "dependencies": { |
| 12 | "body-parser": "^1.20.1", | 12 | "body-parser": "^1.20.1", |
| 13 | "cors": "^2.8.5", | 13 | "cors": "^2.8.5", |
| 14 | "dotenv": "^16.0.3", | ||
| 14 | "express": "^4.18.2", | 15 | "express": "^4.18.2", |
| 15 | "morgan": "^1.10.0", | 16 | "morgan": "^1.10.0", |
| 16 | "openai": "^3.1.0" | 17 | "openai": "^3.1.0" | ... | ... |
-
Please register or sign in to post a comment