import sys import argparse import os import subprocess import re import hashlib import random import requests import json import asyncio import threading import time import string import shutil import datetime from lib.helpers import * from lib.extension import * import streamlit as st ss = st.session_state def more_settings_account_tab(): cols = st.columns([1, 1]) with cols[0]: st.caption("Account") with st.container(border=True): ss.SETTINGS.widget(st, st.text_input, "Name", "account_name") ss.SETTINGS.widget(st, st.text_input, "E-mail", "account_email") st.write("") def more_settings_general_tab(): cols = st.columns([1, 1]) with cols[0]: st.caption("Behavior") with st.container(border=True): ss.SETTINGS.widget(st, st.toggle, "Fetch reply", "fetch_reply") ss.SETTINGS.widget(st, st.toggle, "Auto name", "auto_name") st.write("") st.caption("Interface") with st.container(border=True): ss.SETTINGS.widget(st, st.toggle, "Show clear", "show_clear") ss.SETTINGS.widget(st, st.toggle, "Show undo", "show_undo") ss.SETTINGS.widget(st, st.toggle, "Show redo", "show_redo") ss.SETTINGS.widget(st, st.toggle, "Show more", "show_more") ss.SETTINGS.widget(st, st.toggle, "Show fetch button", "show_fetch_button") ss.SETTINGS.widget(st, st.toggle, "Show fetch toggle", "show_fetch_toggle") st.write("") def more_settings_advanced_tab(): cols = st.columns([1, 1]) with cols[0]: st.caption("Advanced") with st.container(border=True): ss.APP_SETTINGS.widget(st, st.text_input, "Inference Server URL", "inference_server_url", help="The URL to POST to for text-based inference") st.write("") def more_settings(): if ss.TOKEN is None: st.write("Settings are available only for authenticated users.") return tab_labels = ["Account", "General"] if ss.IS_ADMIN: tab_labels = tab_labels + ["Advanced"] tabs = st.tabs(tab_labels) if (t := "Account") in tab_labels: with tabs[tab_labels.index(t)]: more_settings_account_tab() if (t := "General") in tab_labels: with tabs[tab_labels.index(t)]: more_settings_general_tab() if (t := "Advanced") in tab_labels: with tabs[tab_labels.index(t)]: more_settings_advanced_tab()