Using Server-Sent Events with PHP to Stream Responses from OpenAI ChatGPT API

preview_player
Показать описание
In today's video I upgrade my ChatGPT clone so that it prints out the response token-by-token while still highlighting code in the response. This makes the chatbot feel much faster as it starts to generate the response instantly.

00:00 Intro
02:05 PHP Server-Sent Events Demo
11:57 Upgrading the Chatbot: PHP code
18:39 Upgrading the JavaScript code
23:52 Debugging
28:57 Fixing the code highlighting
37:43 It works!
Рекомендации по теме
Комментарии
Автор

My coding skill just increased. Thank you bro!

giangimgs
Автор

Hi,
This really Gold Nuggets!!! Thank you, Thank you very much!!! ❤

shawnmckenzie_offcial
Автор

Hi! I grasp the importance of testing the application locally. However, once the local testing phase is complete, I'm unsure of the steps to deploy it on an internet host. I've been unable to locate any instructional videos outlining this process.
Thanks!🤔

wellingtonziotto
Автор

made this on Laravel, worked pretty well, now m concerned for performance, or shall we do websocket instead ?
the usage is for chat openai

jervi_sir
Автор

I'm trying to get the servers external IP (ie, my laptop), so I currently curl a page on another server and I get my IP number in like 0.05 seconds, which is really slow vs loading the same page in an iframe or geetting it with a xmlhttp request in javascript. Is this faster? I get that it's purpose is for multiple requests, but if we just look at the connection speed for a single request, is it faster than curl?

danielbengtsson
Автор

Hey, hope you fine

I am facing issue during markdown to html converting

when i did without using streaming method, it was showing perfectly after converting to html, but now it making issue

let's say when, it making table markdown
it's not converting to html table

How chatgpt handle this?

azazahmedlipu
Автор

Really nice video. Can you make video for server sent event when api callback?

devseer
Автор

Hi, I recieved "414 Request-URI Too Long"...
upon check the GET Message..
it includes all previous message

how can we clear this GET Message, so that it always refresh and only send Message based on latest request

shawnmckenzie_offcial
Автор

I was trying to learn PHP streams, now I have gold mines when found your video. Please make a video on server sent event.

ashikmehermobin
Автор

Sensei, I want you ask you...where I occasional I received the text "Sorry, but I don't know how to answer that" in between text... it still can generate response but it include the ""Sorry, but I don't know how to answer that" in that reponse. Below is the sample of the anwers:- is it because of special characters it generate?

"Cobra is a venomous snake, known for its distinct hood, which itSorry, but I don't know how to answer that. flare out when threatened. There are more than 20 species of cobras found in different parts of the world, "

shawnmckenzie_offcial
Автор

Hi, I downloaded the chat-wtf GitHub repo and ran it on my localhost, but it doesn't seem to stream? Is the code the the latest version? Thanks!

worldofplayingcards
Автор

please make with anthropic API stream

techlovers
Автор

you are aware that your mic is terrible?

michabbb
welcome to shbcf.ru