Ridealist commited on
Commit
042c9e0
2 Parent(s): 5603c64 f5c0b6b

Merge branch 'main' into up/main

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -62,6 +62,9 @@ if "case3" not in st.session_state:
62
  if "page2_tab" not in st.session_state:
63
  st.session_state.page2_tab = "tab1"
64
 
 
 
 
65
  if "total_debate_history" not in st.session_state:
66
  st.session_state.total_debate_history = []
67
 
@@ -422,13 +425,14 @@ def page4():
422
  if output:
423
  if not user_input:
424
  error_message.error("Please enter your question")
425
- result = ""
426
  else:
427
  try:
428
  result = gpt_call(user_input)
 
429
  except:
430
  error_message.error("Chat-GPT Error : The engine is currently overloaded, it will be auto-reloaded in a second")
431
- time.sleep(0.5)
432
  st.experimental_rerun()
433
 
434
  # save user_prompt and bot_response to database
@@ -444,7 +448,7 @@ def page4():
444
  )
445
 
446
  else:
447
- result = ""
448
 
449
  st.sidebar.text_area(
450
  label="Answer",
@@ -511,13 +515,14 @@ def page5():
511
  if output:
512
  if not user_input:
513
  error_message.error("Please enter your question")
514
- result = ""
515
  else:
516
  try:
517
  result = gpt_call(user_input)
 
518
  except:
519
  error_message.error("Chat-GPT Error : The engine is currently overloaded, it will be auto-reloaded in a second")
520
- time.sleep(0.5)
521
  st.experimental_rerun()
522
 
523
  put_item(
@@ -531,7 +536,7 @@ def page5():
531
  }
532
  )
533
  else:
534
- result = ""
535
 
536
  st.sidebar.text_area(
537
  label="Answer",
 
62
  if "page2_tab" not in st.session_state:
63
  st.session_state.page2_tab = "tab1"
64
 
65
+ if "ask_gpt_prev_response" not in st.session_state:
66
+ st.session_state.ask_gpt_prev_response = ""
67
+
68
  if "total_debate_history" not in st.session_state:
69
  st.session_state.total_debate_history = []
70
 
 
425
  if output:
426
  if not user_input:
427
  error_message.error("Please enter your question")
428
+ result = st.session_state.ask_gpt_prev_response
429
  else:
430
  try:
431
  result = gpt_call(user_input)
432
+ st.session_state.ask_gpt_prev_response = result
433
  except:
434
  error_message.error("Chat-GPT Error : The engine is currently overloaded, it will be auto-reloaded in a second")
435
+ time.sleep(1.5)
436
  st.experimental_rerun()
437
 
438
  # save user_prompt and bot_response to database
 
448
  )
449
 
450
  else:
451
+ result = st.session_state.ask_gpt_prev_response
452
 
453
  st.sidebar.text_area(
454
  label="Answer",
 
515
  if output:
516
  if not user_input:
517
  error_message.error("Please enter your question")
518
+ result = st.session_state.ask_gpt_prev_response
519
  else:
520
  try:
521
  result = gpt_call(user_input)
522
+ st.session_state.ask_gpt_prev_response = result
523
  except:
524
  error_message.error("Chat-GPT Error : The engine is currently overloaded, it will be auto-reloaded in a second")
525
+ time.sleep(1.5)
526
  st.experimental_rerun()
527
 
528
  put_item(
 
536
  }
537
  )
538
  else:
539
+ result = st.session_state.ask_gpt_prev_response
540
 
541
  st.sidebar.text_area(
542
  label="Answer",