fix: operations does not update after language switch

pull/10/head
sean1832 1 year ago
parent 757ca9ec56
commit 34804410bc

@ -128,12 +128,12 @@ with header:
# main
with body:
question = st.text_area(_('Ask Brain: '))
col1, col2, col3, col4 = st.columns(4)
col1, col2 = st.columns([1, 3])
with col1:
send = st.button(_('📩Send'))
with col2:
if os.path.exists(CURRENT_LOG_FILE):
st_tool.download_as()
st_tool.download_as(_("📥download log"))
# execute brain calculation
if not question == '' and send:
st_tool.execute_brain(question, param, op, models, prompt_dictionary, SESSION_LANG)
st_tool.execute_brain(question, param, op, models, prompt_dictionary, _('question'), SESSION_LANG)

@ -38,12 +38,12 @@ def clear_log():
os.remove(os.path.join(root, file))
def download_as():
def download_as(label):
# download log file
with open(CURRENT_LOG_FILE, 'rb') as f:
content = f.read()
st.download_button(
label=_("📥download log"),
label=label,
data=content,
file_name=f'log_{SESSION_TIME}.txt',
mime='text/plain'
@ -232,7 +232,9 @@ def execute_brain(q, params: GPT.model.param,
op: GPT.model.Operation,
model: GPT.model.Model,
prompt_dictionary: dict,
session_language):
question_prompt: str,
session_language,
):
# log question
log(f'\n\n\n\n[{str(time.ctime())}] - QUESTION: {q}')
@ -253,7 +255,7 @@ def execute_brain(q, params: GPT.model.param,
params.frequency_penalty,
params.present_penalty,
chunk_count=params.chunk_count)
if util.contains(op.operations, _('question')):
if util.contains(op.operations, question_prompt):
# displaying results
st.header(_('💬Answer'))
st.info(f'{answer}')

Loading…
Cancel
Save