mouadenna commited on
Commit
55784ce
1 Parent(s): cef7549

Update pages/2_phonics.py

Browse files
Files changed (1) hide show
  1. pages/2_phonics.py +13 -5
pages/2_phonics.py CHANGED
@@ -146,8 +146,12 @@ def generate_response(message: str, history: list) -> tuple:
146
  return response.text, chat.history
147
 
148
 
149
- def process_response(user_input: str, conversation_history: list,L) -> tuple:
150
- if L[0]==L[1]-1:
 
 
 
 
151
  model_response, conversation_history = generate_response(initial_prompt, conversation_history)
152
  else:
153
  model_response, conversation_history = generate_response(user_input, conversation_history)
@@ -343,7 +347,8 @@ def main():
343
  row3 = st.container()
344
  #row4 = st.container()
345
  with row1:
346
- user_message = st.text_input("Type 'next' to proceed through the lesson",st.session_state['initial_input'])
 
347
  with row2:
348
  colsend, colnext, = st.columns(2,gap="medium")
349
  with colsend:
@@ -362,11 +367,14 @@ def main():
362
 
363
  st.session_state['msg_index'] += 1
364
  else:
 
 
365
  st.session_state['lessonList'], st.session_state['conversation_history'] = process_response(
366
  user_message, st.session_state['conversation_history'],
367
- [st.session_state['msg_index'],len(st.session_state['lessonList'])]
368
  )
369
- st.session_state['msg_index'] = 0
 
370
 
371
 
372
  with colnext:
 
146
  return response.text, chat.history
147
 
148
 
149
+ if 'First' not in st.session_state:
150
+ st.session_state['First']=False
151
+
152
+
153
+ def process_response(user_input: str, conversation_history: list,F) -> tuple:
154
+ if F:
155
  model_response, conversation_history = generate_response(initial_prompt, conversation_history)
156
  else:
157
  model_response, conversation_history = generate_response(user_input, conversation_history)
 
347
  row3 = st.container()
348
  #row4 = st.container()
349
  with row1:
350
+ user_message = #st.text_input("Type 'next' to proceed through the lesson",st.session_state['initial_input'])
351
+ user_message = "next"
352
  with row2:
353
  colsend, colnext, = st.columns(2,gap="medium")
354
  with colsend:
 
367
 
368
  st.session_state['msg_index'] += 1
369
  else:
370
+
371
+ st.session_state['msg_index'] = 0
372
  st.session_state['lessonList'], st.session_state['conversation_history'] = process_response(
373
  user_message, st.session_state['conversation_history'],
374
+ st.session_state['First'],
375
  )
376
+ st.session_state['First']=True
377
+
378
 
379
 
380
  with colnext: