Ridealist commited on
Commit
40d72c2
โ€ข
1 Parent(s): 4112c2b

hotfix: rearange response and save data block

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -480,20 +480,20 @@ def generate_response(prompt):
480
  else:
481
  try:
482
  response = gpt_call_context(st.session_state['total_debate_history'])
483
- st.session_state['user_debate_history'].append(prompt)
484
- st.session_state['total_debate_history'].append({"role": "user", "content": prompt})
485
- st.session_state['bot_debate_history'].append(response)
486
- st.session_state['total_debate_history'].append({"role": "assistant", "content": response})
487
- return response
488
  except:
489
  raise RuntimeError("ChatGPT API Error")
490
 
 
 
 
 
 
 
491
  def execute_stt(audio):
492
  # audio ๊ธฐ๋ก ๋ˆ„์ 
493
  #user_audio_path = "audio/" + str(st.session_state.user_id) + "_" + str(st.session_state.session_num) + "_" + str(time.time()) + ".wav"
494
  # audio ๊ธฐ๋ก์„ ๋ˆ„์ ํ•˜๊ณ  ์‹ถ์ง€ ์•Š๋‹ค๋ฉด
495
  user_audio_path = "audio/audio.wav"
496
-
497
  wav_file = open(user_audio_path, "wb")
498
  wav_file.write(audio.tobytes())
499
 
 
480
  else:
481
  try:
482
  response = gpt_call_context(st.session_state['total_debate_history'])
 
 
 
 
 
483
  except:
484
  raise RuntimeError("ChatGPT API Error")
485
 
486
+ st.session_state['user_debate_history'].append(prompt)
487
+ st.session_state['total_debate_history'].append({"role": "user", "content": prompt})
488
+ st.session_state['bot_debate_history'].append(response)
489
+ st.session_state['total_debate_history'].append({"role": "assistant", "content": response})
490
+ return response
491
+
492
  def execute_stt(audio):
493
  # audio ๊ธฐ๋ก ๋ˆ„์ 
494
  #user_audio_path = "audio/" + str(st.session_state.user_id) + "_" + str(st.session_state.session_num) + "_" + str(time.time()) + ".wav"
495
  # audio ๊ธฐ๋ก์„ ๋ˆ„์ ํ•˜๊ณ  ์‹ถ์ง€ ์•Š๋‹ค๋ฉด
496
  user_audio_path = "audio/audio.wav"
 
497
  wav_file = open(user_audio_path, "wb")
498
  wav_file.write(audio.tobytes())
499