Skip to content
ํ”„๋กœ์ ํŠธ

์†Œ๊ฐœ

๐Ÿ’ฌ OpenAI Assistants API chat UI ๐Ÿ› ๏ธ It works easily by setting the ASSISTANT ID ๐Ÿ“ Supports file upload and file download ๐Ÿƒ Supports Streaming API ๐ŸชŸ Support to Azure OpenAI

AI ๋ฐ ๋จธ์‹ ๋Ÿฌ๋‹

์ด ์ˆ˜์น˜๋ฅผ ์ธก์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•

์ธก์ •๋œ ์Šคํƒ€ ์ฆ๊ฐ€

in 24h
0
in 7 days
0
in 15 days
+1
in 1 month
๊ธฐ๋ก ์ˆ˜์ง‘ ์ค‘

์„œ๋กœ ๊ฒน์น˜๋Š” ๊ธฐ๊ฐ„์˜ ์ˆœ์ฆ๊ฐ€๋Ÿ‰์ด๋ฉฐ ์ผ๋ณ„ ํ•ฉ๊ณ„๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค. ์ธก์ •๊ฐ’์ด ์—†์œผ๋ฉด ๋น„์›Œ ๋‘ก๋‹ˆ๋‹ค. ์Šคํƒ€๋Š” ๊ด€์‹ฌ๋„๋ฅผ ๋‚˜ํƒ€๋‚ด๋ฉฐ ํ’ˆ์งˆ์„ ๋ณด์žฅํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

README.md

Original

gpt-assistants-api-ui

  • ๐Ÿ’ฌ OpenAI Assistants API chat UI
  • ๐Ÿ› ๏ธ It works quickly by setting the ASSISTANT IDs
  • ๐Ÿ“ Supports file upload and file download
  • ๐Ÿƒ Supports Streaming API
  • ๐Ÿ‘ฅ Supports multiple Assistant profiles in one place
  • ๐ŸชŸ Support to Azure OpenAI
    • โ€ป Cannot be used until Azure OpenAI Service supports Streaming API
ใ‚นใ‚ฏใƒชใƒผใƒณใ‚ทใƒงใƒƒใƒˆ 2023-11-20 2 23 51

๐ŸŒŸ Quick Start

  1. ๐Ÿ‘ค Create an assistant on the OpenAI site & Get assistant ID (https://platform.openai.com/assistants)

  2. ๐Ÿ”‘ Get the API key from OpenAI (https://platform.openai.com/api-keys)

  3. โฌ‡๏ธ Clone the repository

    $ git clone https://github.com/ryo-ma/gpt-assistants-api-ui.git
    
  4. ๐Ÿ“ฆ Install dependencies

    $ poetry install
    
  5. โš™๏ธ Set environment variables file .env

    # OpenAI settings
    OPENAI_API_KEY="sk-xxx"
    
    # When using only one assistant, set the following, unset the OPENAI_ASSISTANTS variable.
    ASSISTANT_ID="asst_xxx"
    ASSISTANT_TITLE="Assistants API UI" # This is for the single agent title
    
    # When using multiple assistants, set the following.
    OPENAI_ASSISTANTS='[{"id": "asst_xxx", "title": "Assistants XXX UI"}, {"id": "asst_yyy", "title": "Assistants YYY UI"}]'
    
    # App settings
    ENABLED_FILE_UPLOAD_MESSAGE="Upload a file" # Leave empty to disable
    AUTHENTICATION_REQUIRED="False" # Must change to True if you require authentication
    

    If you use azure instead, set AZURE_OPENAI_ENDPOINT and AZURE_OPENAI_KEY

  6. ๐Ÿ”‘ Set Authentication configuration (optional)

    To set up authentication, create a secrets file .streamlit/secrets.toml as below:

    [credentials]
    usernames = { jsmith = {failed_login_attempts = 0,  logged_in = false, name = "John Smith", password = "abc"}, rbriggs = {failed_login_attempts = 0,  logged_in = false, name = "R Briggs", password = "abc"}}
    
    [cookie]
    expiry_days = 30
    key = "some_signature_key"  # Must be string
    name = "some_cookie_name"
    

    Reference: Deploying Streamlit-Authenticator via Streamlit Community Cloud

๐Ÿƒโ€๏ธ Run the app using Streamlit

$ poetry shell
$ streamlit run app.py

๐Ÿณ Run the app using Docker

  1. ๐Ÿ’ฝ Build image

    $ docker compose build
    
  2. ๐Ÿƒโ€๏ธ Run the app

    $ docker compose up
    

Access to http://localhost:8501.

๐ŸŒ Deploy to Streamlit Cloud

You can fork this repository and deploy the app to https://share.streamlit.io/. No need to run the app on your local machine.

Don't forget to choose 3.10 as the Python version and set environment variables in the "Advanced settings" during deployment.

To use authentication with Streamlit Cloud, please use this TOML format:

# Environment variables
# OpenAI settings
OPENAI_API_KEY="sk-xxx"

# When using only one assistant, set the following, unset the OPENAI_ASSISTANTS variable.
ASSISTANT_ID="asst_xxx"
ASSISTANT_TITLE="Assistants API UI" # This is for the single agent title

# When using multiple assistants, set the following.
OPENAI_ASSISTANTS='[{"id": "asst_xxx", "title": "Assistants XXX UI"}, {"id": "asst_yyy", "title": "Assistants YYY UI"}]'

# App settings
ENABLED_FILE_UPLOAD_MESSAGE="Upload a file" # Leave empty to disable
AUTHENTICATION_REQUIRED="False" # Must change to True if you require authentication

# Authentication secrets
[credentials]
usernames = { jsmith = {failed_login_attempts = 0,  logged_in = false, name = "John Smith", password = "abc"}, rbriggs = {failed_login_attempts = 0,  logged_in = false, name = "R Briggs", password = "abc"}}

[cookie]
expiry_days = 30
key = "some_signature_key"  # Must be string
name = "some_cookie_name"

๊ด€๋ จ ํ”„๋กœ์ ํŠธ ์‚ดํŽด๋ณด๊ธฐ

๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘โ€ฆ