Skip to content

An example of a a chatbot written in FastHTML using SSE (server-sent events)

Notifications You must be signed in to change notification settings

fabge/fasthtml-sse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

fasthtml-sse

This example implements a chatbot. Most parts are copied from the fasthtml chatbot example.

However instead of using websockets, this example uses server-sent events (SSE) to send messages from the server to the client.

On message submission, the server responds with 2 message Divs - the user message and an empty assistant message.
This assistant message element initializes the SSE connection and receives the streaming messages from the server. After the final message is sent, a close event from the server closes the connection.

This process repeats on every message submission. As the connection to the server is terminated after every message, the server only needs to be running a couple of (milli-)seconds, enabling deployments using serverless functions like AWS Lambda or Azure Functions.

About

An example of a a chatbot written in FastHTML using SSE (server-sent events)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages