Skip to content

Instantly share code, notes, and snippets.

@adrianhajdin
Created December 23, 2022 09:14
Show Gist options
  • Select an option

  • Save adrianhajdin/2059ca74452a18d1560aac9499f58900 to your computer and use it in GitHub Desktop.

Select an option

Save adrianhajdin/2059ca74452a18d1560aac9499f58900 to your computer and use it in GitHub Desktop.
Build and Deploy Your Own ChatGPT AI Application That Will Help You Code
@import url("https://fonts.googleapis.com/css2?family=Alegreya+Sans:wght@100;300;400;500;700;800;900&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Alegreya Sans", sans-serif;
}
body {
background: #343541;
}
#app {
width: 100vw;
height: 100vh;
background: #343541;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
}
#chat_container {
flex: 1;
width: 100%;
height: 100%;
overflow-y: scroll;
display: flex;
flex-direction: column;
gap: 10px;
-ms-overflow-style: none;
scrollbar-width: none;
padding-bottom: 20px;
scroll-behavior: smooth;
}
/* hides scrollbar */
#chat_container::-webkit-scrollbar {
display: none;
}
.wrapper {
width: 100%;
padding: 15px;
}
.ai {
background: #40414F;
}
.chat {
width: 100%;
max-width: 1280px;
margin: 0 auto;
display: flex;
flex-direction: row;
align-items: flex-start;
gap: 10px;
}
.profile {
width: 36px;
height: 36px;
border-radius: 5px;
background: #5436DA;
display: flex;
justify-content: center;
align-items: center;
}
.ai .profile {
background: #10a37f;
}
.profile img {
width: 60%;
height: 60%;
object-fit: contain;
}
.message {
flex: 1;
color: #dcdcdc;
font-size: 20px;
max-width: 100%;
overflow-x: scroll;
/*
* white space refers to any spaces, tabs, or newline characters that are used to format the CSS code
* specifies how white space within an element should be handled. It is similar to the "pre" value, which tells the browser to treat all white space as significant and to preserve it exactly as it appears in the source code.
* The pre-wrap value allows the browser to wrap long lines of text onto multiple lines if necessary.
* The default value for the white-space property in CSS is "normal". This tells the browser to collapse multiple white space characters into a single space, and to wrap text onto multiple lines as needed to fit within its container.
*/
white-space: pre-wrap;
-ms-overflow-style: none;
scrollbar-width: none;
}
/* hides scrollbar */
.message::-webkit-scrollbar {
display: none;
}
form {
width: 100%;
max-width: 1280px;
margin: 0 auto;
padding: 10px;
background: #40414F;
display: flex;
flex-direction: row;
gap: 10px;
}
textarea {
width: 100%;
color: #fff;
font-size: 18px;
padding: 10px;
background: transparent;
border-radius: 5px;
border: none;
outline: none;
}
button {
outline: 0;
border: 0;
cursor: pointer;
background: transparent;
}
form img {
width: 30px;
height: 30px;
}
@yevginx

yevginx commented Jan 9, 2023

Copy link
Copy Markdown

Getting white page: http://localhost:5173/, how to fix it?

@EswarChandran0110

EswarChandran0110 commented Jan 10, 2023

Copy link
Copy Markdown

I've tried generating new api key from openai , the error is still the same.
even when I subscribed with a payment option still it was throwing error.

@forbiddenvelocity

Copy link
Copy Markdown
image

I had the same error, it means that you probably maxed out your request for the day... all you need to do is create a new account and get a new api key... atleast thats how i fixed it

I've got the same error , but getting a new api key have not resolved the error, it is still throwing the same error. is there anyother way to resolve it?

I also tried getting a new API but it still doesn't work for me. Did you find a solution to it??

@forbiddenvelocity

Copy link
Copy Markdown

For those getting 401 error , add basepath property in configuration object in server.js

could you elaborate please??

@Owenzo7

Owenzo7 commented Jan 11, 2023

Copy link
Copy Markdown

Screenshot 2023-01-11 at 15 05 07

Guys what does this mean. I'm currently stuck at timestamp 25:19. Whereby I submit the text on the textarea. Any ideas or suggestions??

@bekacodex

Copy link
Copy Markdown

Super

@HEYGUYS123C

Copy link
Copy Markdown

how do you make a new account

@Mudirta

Mudirta commented Jan 18, 2023

Copy link
Copy Markdown

thank you adrian, before it was not run but when i change -prompt in thi code;
openai.createCompletion({
model: "text-davinci-003",
prompt: req.body.prompt,
temperature: 0,
max_tokens: 3000,
top_p: 1,
frequency_penalty: 0.5,
presence_penalty: 0,

suddenly it is work, i don't know......... Thank you so much

@Pablo-98

Copy link
Copy Markdown

you're the bomb.com Adrian

@Rajshekar723

Copy link
Copy Markdown
image

I had the same error, it means that you probably maxed out your request for the day... all you need to do is create a new account and get a new api key... atleast thats how i fixed it

I've got the same error , but getting a new api key have not resolved the error, it is still throwing the same error. is there anyother way to resolve it?

I also tried getting a new API but it still doesn't work for me. Did you find a solution to it??

i am facing the same issue, i have tried all the methods listed above , some one please help

@ivesh

ivesh commented Jan 22, 2023

Copy link
Copy Markdown

Hi All!

I am getting the same error as most of you have got. For all, whose app is working could you kindly help in solving these error?
image

@TornIke88

Copy link
Copy Markdown

Chat GPT
Can anyone help?

@Devanjana360

Copy link
Copy Markdown

Dont worry errors in local host, deploy it online as mention in the vedio after it works perfectly,
Thank you adrian, Thank you so much

@mohitkrsuman

Copy link
Copy Markdown

After hosting, I am getting 404 error. How can I resolve that?

@AymanTTV

Copy link
Copy Markdown

For those getting 401 error , add basepath property in configuration object in server.js

could you elaborate please??

were?

@EdwinBayingana

Copy link
Copy Markdown

For anyone getting the 401 error before/after deploying on Render, you can update your OPENAI_API_KEY from OpenAI by generating a new one. It worked for me.

Remember to replace the new API key into your .env file as well as the environment variables on Render, test everything locally, then push the changes to your deployed branch on github.

Thanks :)

@AnkLowbrowJamison

Copy link
Copy Markdown

Hello,
I am very new to coding, and this tutorial has taught me SO MUCH! So, thank you Adrian.
I am wondering if anyone can help me with an issue I am having. Everything works perfectly, unless I try and update the ChatGPT model. The tutorial uses text-davinci-003, but I would prefer to you gpt-3.5-turbo. As soon as I update the model to "gpt-3.5-turbo"m I get a 404 error.
Any thoughts or suggestions would be awesome.
Thanks.
Screenshot 2023-05-05 at 11 15 48 AM

@PARKER-X

PARKER-X commented May 6, 2023

Copy link
Copy Markdown
image

I had the same error, it means that you probably maxed out your request for the day... all you need to do is create a new account and get a new api key... atleast thats how i fixed it

I've got the same error , but getting a new api key have not resolved the error, it is still throwing the same error. is there anyother way to resolve it?

I also tried getting a new API but it still doesn't work for me. Did you find a solution to it??

Hi is ur error resolved!

@AnkLowbrowJamison

Copy link
Copy Markdown

Hello, I am very new to coding, and this tutorial has taught me SO MUCH! So, thank you Adrian. I am wondering if anyone can help me with an issue I am having. Everything works perfectly, unless I try and update the ChatGPT model. The tutorial uses text-davinci-003, but I would prefer to you gpt-3.5-turbo. As soon as I update the model to "gpt-3.5-turbo"m I get a 404 error. Any thoughts or suggestions would be awesome. Thanks. Screenshot 2023-05-05 at 11 15 48 AM

For anyone in the future who has this same problem, the solution is to use axiom. Node.js doesn't support the chat/completions endpoint, which is required for gpt-3.5-tubro.

@JJR8

JJR8 commented May 7, 2023

Copy link
Copy Markdown

I deployed the website, but before and after deploying, I also got a 401 error. I have changed the API key multiple times but nothing seems to be working. Does anyone know how to resolve this so it can work properly?

@Tolgahan0

Copy link
Copy Markdown

how fixed ?

@furqansup

Copy link
Copy Markdown

Getting the 429 error after multiple changing of the api key.

@DeathBed20

Copy link
Copy Markdown

Screenshot 2023-06-29 120023

i am facing this css error can anyone solve this?? :))

@MainakRepositor

Copy link
Copy Markdown

Dont worry errors in local host, deploy it online as mention in the vedio after it works perfectly, Thank you adrian, Thank you so much

No it doesn't work even after deployment

@Kanij-kannu

Copy link
Copy Markdown

Hey i am getting [nodemon] app crashed - waiting for file changes before starting... error can anyone help me??

@eshan-one

Copy link
Copy Markdown

Hey @Kanij-kannu you are getting a syntax error in your server.js file so what I would suggest is that you use this code: const apiKey = process.env.OPENAI_API_KEY; Since in the latest API Model you dont have to create a new Instance

@rawrdata

Copy link
Copy Markdown

Thank you, eshan-one. Took me a minute, but that worked

@Preetham71

Copy link
Copy Markdown

For anyone getting the 401 error before/after deploying on Render, you can update your OPENAI_API_KEY from OpenAI by generating a new one. It worked for me.

Remember to replace the new API key into your .env file as well as the environment variables on Render, test everything locally, then push the changes to your deployed branch on github.

Thanks :)

can you explain it once again in detail, please? the error of 401 isn't resolved yet

@Ashishdev12

Copy link
Copy Markdown

Hey @Kanij-kannu you are getting a syntax error in your server.js file so what I would suggest is that you use this code: const apiKey = process.env.OPENAI_API_KEY; Since in the latest API Model you dont have to create a new Instance

Thanks It works for me

@Ashishdev12

Copy link
Copy Markdown
image Help me with error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment