Nol00 commited on
Commit
1c38f0c
·
verified ·
1 Parent(s): c84464e

Update crs_arena/arena.py

Browse files
Files changed (1) hide show
  1. crs_arena/arena.py +7 -8
crs_arena/arena.py CHANGED
@@ -161,7 +161,7 @@ def end_conversation(crs: CRSFighter, sentiment: str) -> None:
161
  st.rerun()
162
 
163
 
164
- def get_crs_response(crs: CRSFighter, message: str):
165
  """Gets the CRS response for the given message.
166
 
167
  This method sends a POST request to the CRS model including the history of
@@ -171,8 +171,8 @@ def get_crs_response(crs: CRSFighter, message: str):
171
  crs: CRS model.
172
  message: User's message.
173
 
174
- Yields:
175
- Words from the CRS response.
176
  """
177
  history = deepcopy(st.session_state[f"messages_{crs.fighter_id}"])
178
  history = history[:-1] # Remove the last message (user's message)
@@ -183,11 +183,10 @@ def get_crs_response(crs: CRSFighter, message: str):
183
  options_state=st.session_state.get(f"state_{crs.fighter_id}", []),
184
  )
185
  st.session_state[f"state_{crs.fighter_id}"] = state
186
- # response = "CRS response for testing purposes."
187
- for word in response.split():
188
- yield f"{word} "
189
- time.sleep(0.05)
190
-
191
 
192
  @st.dialog("Your vote has been submitted!")
193
  def feedback_dialog(row_id: int) -> None:
 
161
  st.rerun()
162
 
163
 
164
+ def get_crs_response(crs: CRSFighter, message: str) -> str:
165
  """Gets the CRS response for the given message.
166
 
167
  This method sends a POST request to the CRS model including the history of
 
171
  crs: CRS model.
172
  message: User's message.
173
 
174
+ Returns:
175
+ CRS response.
176
  """
177
  history = deepcopy(st.session_state[f"messages_{crs.fighter_id}"])
178
  history = history[:-1] # Remove the last message (user's message)
 
183
  options_state=st.session_state.get(f"state_{crs.fighter_id}", []),
184
  )
185
  st.session_state[f"state_{crs.fighter_id}"] = state
186
+ # for word in response.split():
187
+ # yield f"{word} "
188
+ # time.sleep(0.05)
189
+ return response
 
190
 
191
  @st.dialog("Your vote has been submitted!")
192
  def feedback_dialog(row_id: int) -> None: