Siyuan0730 commited on
Commit
3f23000
·
1 Parent(s): e621154
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -305,6 +305,11 @@ def app():
305
  st.session_state.course_outline_list = 1
306
  if "course_content_list" not in st.session_state:
307
  st.session_state.course_content_list = 1
 
 
 
 
 
308
 
309
  if btn:
310
  st.session_state.embeddings_df,
@@ -317,6 +322,9 @@ def app():
317
 
318
  # 这里还可以设置col1 和 col2 不同时出现 - 需要拆分initialize_app()函数
319
  if st.session_state.course_content_list != 1:
 
 
 
320
  with col1:
321
  #把课程大纲打印出来
322
  regenerate_outline(st.session_state.course_outline_list)
@@ -330,18 +338,10 @@ def app():
330
  with st.chat_message("assistant"):
331
  st.write("Hello👋, how can I help you today? 😄")
332
 
333
- if "openai_model" not in st.session_state:
334
- st.session_state["openai_model"] = "gpt-3.5-turbo"
335
- # Initialize chat history
336
- if "messages" not in st.session_state:
337
- st.session_state.messages = []
338
-
339
  # Display chat messages from history on app rerun - 这部分不用session,利用好rerun
340
  for message in st.session_state.messages:
341
  with st.chat_message(message["role"]):
342
  st.markdown(message["content"][0])
343
-
344
- user_question = st.chat_input("Enter your questions when learning...")
345
 
346
  #这里的session.state就是保存了这个对话会话的一些基本信息和设置
347
  if user_question:
 
305
  st.session_state.course_outline_list = 1
306
  if "course_content_list" not in st.session_state:
307
  st.session_state.course_content_list = 1
308
+ if "openai_model" not in st.session_state:
309
+ st.session_state["openai_model"] = "gpt-3.5-turbo"
310
+ # Initialize chat history
311
+ if "messages" not in st.session_state:
312
+ st.session_state.messages = []
313
 
314
  if btn:
315
  st.session_state.embeddings_df,
 
322
 
323
  # 这里还可以设置col1 和 col2 不同时出现 - 需要拆分initialize_app()函数
324
  if st.session_state.course_content_list != 1:
325
+
326
+ user_question = st.chat_input("Enter your questions when learning...")
327
+
328
  with col1:
329
  #把课程大纲打印出来
330
  regenerate_outline(st.session_state.course_outline_list)
 
338
  with st.chat_message("assistant"):
339
  st.write("Hello👋, how can I help you today? 😄")
340
 
 
 
 
 
 
 
341
  # Display chat messages from history on app rerun - 这部分不用session,利用好rerun
342
  for message in st.session_state.messages:
343
  with st.chat_message(message["role"]):
344
  st.markdown(message["content"][0])
 
 
345
 
346
  #这里的session.state就是保存了这个对话会话的一些基本信息和设置
347
  if user_question: