Skip to content

ChatGPT-like Streamlit chatbot & Simple image generator (DALLE3)

License

Notifications You must be signed in to change notification settings

yjg30737/streamlit-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

streamlit-chatbot

ChatGPT-like Streamlit chatbot & Simple image generator (DALLE3) OpenAI Using supabase as database.

Requirements

  • streamlit
  • openai
  • st-supabase-connection

How to Install

Type below:

>>> git clone [THE_REPO_URL]
>>> pip install -r requirements.txt
>>> streamlit hello

Then, make .streamlit directory and put secrets.toml into it and copy below:

# .streamlit/secrets.toml
OPENAI_API_KEY=

[connections.supabase]
SUPABASE_URL = 
SUPABASE_KEY = 

Also, run this query in supabase:

create table
  public.chat (
    id bigint generated by default as identity not null,
    created_at timestamp with time zone not null default now(),
    content text null,
    role text null,
    constraint chat_pkey primary key (id)
  ) tablespace pg_default;

If the error "new row violates row-level security policy for table" in Supabase occurs, this is because the Row-Level Security (RLS) policy is not set for the table.

Workaround:

  1. Enable RLS policy for the table in the Supabase dashboard and set the appropriate policy.
  2. Add a policy that grants access to the required CRUD operations (e.g. SELECT, INSERT, UPDATE, DELETE).

This will allow authenticated users to access the table.

Finally

Type streamlit run main.py to show the result. Browser will pop up and you can play it.

Preview

https://youtu.be/8pHC8mKl3VI

Documentation

It is good practice to read following docs and articles to know the basic of using and making streamlit app.

These help me a lot to develop streamlit application.

For this application

For making Streamlit application

For making your chatbot and your image generator

Troubleshooting

If this error shows:

httpcore.ConnectError: [Errno 11001] getaddrinfo failed

That means you need to restore your database. Go to the supabase dashboard to restore it, then it will work like a charm as usual!

If you don't use Supabase a couple of days, you can't connect with it because it suspends the project. Of course, if you are using the Supabase in free, as i am.

Releases

No releases published

Packages

No packages published

Languages