nyoo827 commited on
Commit
adbb75a
ยท
1 Parent(s): 253507a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -100,22 +100,19 @@ def handle_userinput(user_question):
100
 
101
  # ๋Œ€ํ™” ์ฒด์ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž ์งˆ๋ฌธ์— ๋Œ€ํ•œ ์‘๋‹ต์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
102
  st.session_state.conversation = {'question': user_question}
103
-
104
  response = st.session_state.conversation
105
 
106
  if 'chat_history' in response:
107
  st.session_state.chat_history = response['chat_history']
108
  for i, message in enumerate(st.session_state.chat_history):
109
  if i % 2 == 0:
110
- st.write(user_template.replace(
111
- "{{MSG}}", message.content), unsafe_allow_html=True)
112
  else:
113
- st.write(bot_template.replace(
114
- "{{MSG}}", message.content), unsafe_allow_html=True)
115
- else:
116
  # chat_history๊ฐ€ ์—†์„ ๊ฒฝ์šฐ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๋˜๋Š” ๊ธฐ๋ณธ๊ฐ’ ์„ค์ •
117
- st.session_state.chat_history = [] # ์˜ˆ์‹œ๋กœ ๋นˆ ๋ฆฌ์ŠคํŠธ๋ฅผ ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ์„ค์ •
118
- st.warning("Chat history not found or empty.")
119
 
120
  def main():
121
  load_dotenv()
 
100
 
101
  # ๋Œ€ํ™” ์ฒด์ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž ์งˆ๋ฌธ์— ๋Œ€ํ•œ ์‘๋‹ต์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
102
  st.session_state.conversation = {'question': user_question}
 
103
  response = st.session_state.conversation
104
 
105
  if 'chat_history' in response:
106
  st.session_state.chat_history = response['chat_history']
107
  for i, message in enumerate(st.session_state.chat_history):
108
  if i % 2 == 0:
109
+ st.write(user_template.replace("{{MSG}}", message.content), unsafe_allow_html=True)
 
110
  else:
111
+ st.write(bot_template.replace("{{MSG}}", message.content), unsafe_allow_html=True)
112
+ else:
 
113
  # chat_history๊ฐ€ ์—†์„ ๊ฒฝ์šฐ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๋˜๋Š” ๊ธฐ๋ณธ๊ฐ’ ์„ค์ •
114
+ st.session_state.chat_history = [] # ์˜ˆ์‹œ๋กœ ๋นˆ ๋ฆฌ์ŠคํŠธ๋ฅผ ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ์„ค์ •
115
+ st.warning("Chat history not found or empty.")
116
 
117
  def main():
118
  load_dotenv()