config change
Browse files- app/app.py +17 -5
app/app.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
|
|
| 1 |
from operator import call
|
| 2 |
import time
|
|
|
|
| 3 |
import streamlit as st
|
| 4 |
from core.generation_utils import generate_answer, load_llm
|
| 5 |
from core.types import ThoughtStepsDisplay, BigMessage
|
|
@@ -14,7 +16,10 @@ def star_repo():
|
|
| 14 |
|
| 15 |
def config_sidebar(config:InputConfig) -> InputConfig:
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
st.sidebar.header('Configuration')
|
|
@@ -36,14 +41,21 @@ def config_sidebar(config:InputConfig) -> InputConfig:
|
|
| 36 |
config.sleeptime = sleeptime
|
| 37 |
config.force_max_steps = force_max_steps
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
config.save(env_file=ENV_FILE_PATH, config_file=CONFIG_FILE_PATH)
|
| 42 |
st.sidebar.success('Config saved!')
|
| 43 |
|
| 44 |
-
if
|
| 45 |
-
os.remove(ENV_FILE_PATH)
|
| 46 |
config.model_api_key = ''
|
|
|
|
|
|
|
| 47 |
st.sidebar.success('Key deleted!')
|
| 48 |
|
| 49 |
return config
|
|
|
|
| 1 |
+
from calendar import c
|
| 2 |
from operator import call
|
| 3 |
import time
|
| 4 |
+
from numpy import save
|
| 5 |
import streamlit as st
|
| 6 |
from core.generation_utils import generate_answer, load_llm
|
| 7 |
from core.types import ThoughtStepsDisplay, BigMessage
|
|
|
|
| 16 |
|
| 17 |
def config_sidebar(config:InputConfig) -> InputConfig:
|
| 18 |
|
| 19 |
+
star = st.sidebar.button("Star the Repo!")
|
| 20 |
+
|
| 21 |
+
if star:
|
| 22 |
+
star_repo()
|
| 23 |
|
| 24 |
|
| 25 |
st.sidebar.header('Configuration')
|
|
|
|
| 41 |
config.sleeptime = sleeptime
|
| 42 |
config.force_max_steps = force_max_steps
|
| 43 |
|
| 44 |
+
c1, c2 = st.sidebar.columns(2)
|
| 45 |
+
|
| 46 |
+
with c1:
|
| 47 |
+
save_config = c1.button('Save config')
|
| 48 |
+
with c2:
|
| 49 |
+
delete_key = c2.button('Delete Key')
|
| 50 |
+
|
| 51 |
+
if save_config:
|
| 52 |
config.save(env_file=ENV_FILE_PATH, config_file=CONFIG_FILE_PATH)
|
| 53 |
st.sidebar.success('Config saved!')
|
| 54 |
|
| 55 |
+
if delete_key:
|
|
|
|
| 56 |
config.model_api_key = ''
|
| 57 |
+
config.save(env_file=ENV_FILE_PATH, config_file=CONFIG_FILE_PATH)
|
| 58 |
+
config = InputConfig.load(env_file=ENV_FILE_PATH, config_file=CONFIG_FILE_PATH)
|
| 59 |
st.sidebar.success('Key deleted!')
|
| 60 |
|
| 61 |
return config
|