Spaces:
Sleeping
Sleeping
david-oplatka
commited on
Commit
•
52430c9
1
Parent(s):
b1222b7
Limit Log Message Length
Browse files
st_app.py
CHANGED
@@ -22,6 +22,10 @@ def show_example_questions():
|
|
22 |
return True
|
23 |
return False
|
24 |
|
|
|
|
|
|
|
|
|
25 |
def agent_progress_callback(status_type: AgentStatusType, msg: str):
|
26 |
output = f'<span style="color:blue;">{status_type.value}</span>: {msg}'
|
27 |
st.session_state.log_messages.append(output)
|
@@ -40,12 +44,12 @@ def agent_progress_callback(status_type: AgentStatusType, msg: str):
|
|
40 |
max_log_msg_size = 200
|
41 |
with st.session_state.status:
|
42 |
for log_msg in st.session_state.log_messages:
|
43 |
-
st.markdown(log_msg
|
44 |
|
45 |
@st.dialog(title="Agent logs", width='large')
|
46 |
def show_modal():
|
47 |
for log_msg in st.session_state.log_messages:
|
48 |
-
st.
|
49 |
|
50 |
async def launch_bot():
|
51 |
def reset():
|
|
|
22 |
return True
|
23 |
return False
|
24 |
|
25 |
+
def format_log_msg(log_msg: str):
|
26 |
+
max_log_msg_size = 500
|
27 |
+
return log_msg if len(log_msg) <= max_log_msg_size else log_msg[:max_log_msg_size]+'...'
|
28 |
+
|
29 |
def agent_progress_callback(status_type: AgentStatusType, msg: str):
|
30 |
output = f'<span style="color:blue;">{status_type.value}</span>: {msg}'
|
31 |
st.session_state.log_messages.append(output)
|
|
|
44 |
max_log_msg_size = 200
|
45 |
with st.session_state.status:
|
46 |
for log_msg in st.session_state.log_messages:
|
47 |
+
st.markdown(format_log_msg(log_msg), unsafe_allow_html=True)
|
48 |
|
49 |
@st.dialog(title="Agent logs", width='large')
|
50 |
def show_modal():
|
51 |
for log_msg in st.session_state.log_messages:
|
52 |
+
st.markdown(format_log_msg(log_msg), unsafe_allow_html=True)
|
53 |
|
54 |
async def launch_bot():
|
55 |
def reset():
|