Update crs_arena/arena.py
Browse files- 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 |
-
|
175 |
-
|
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 |
-
#
|
187 |
-
|
188 |
-
|
189 |
-
|
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:
|