github-actions[bot] commited on
Commit
55a3068
ยท
1 Parent(s): d98556a

Sync with https://github.com/mozilla-ai/surf-spot-finder

Browse files
Files changed (1) hide show
  1. utils.py +16 -10
utils.py CHANGED
@@ -84,17 +84,23 @@ async def run_agent(user_inputs: dict[str, Any]):
84
  if span.attributes:
85
  # st.json(span.attributes, expanded=False)
86
  if "input.value" in span.attributes:
87
- input_value = json.loads(span.attributes["input.value"])
88
- if isinstance(input_value, list) and len(input_value) > 0:
89
- st.write(f"Input: {input_value[-1]}")
90
- else:
91
- st.write(f"Input: {input_value}")
 
 
 
92
  if "output.value" in span.attributes:
93
- output_value = json.loads(span.attributes["output.value"])
94
- if isinstance(output_value, list) and len(output_value) > 0:
95
- st.write(f"Output: {output_value[-1]}")
96
- else:
97
- st.write(f"Output: {output_value}")
 
 
 
98
  with col2:
99
  status_color = (
100
  "green" if span.status.status_code == StatusCode.OK else "red"
 
84
  if span.attributes:
85
  # st.json(span.attributes, expanded=False)
86
  if "input.value" in span.attributes:
87
+ try:
88
+ input_value = json.loads(span.attributes["input.value"])
89
+ if isinstance(input_value, list) and len(input_value) > 0:
90
+ st.write(f"Input: {input_value[-1]}")
91
+ else:
92
+ st.write(f"Input: {input_value}")
93
+ except: # noqa: E722
94
+ st.write(f"Input: {span.attributes['input.value']}")
95
  if "output.value" in span.attributes:
96
+ try:
97
+ output_value = json.loads(span.attributes["output.value"])
98
+ if isinstance(output_value, list) and len(output_value) > 0:
99
+ st.write(f"Output: {output_value[-1]}")
100
+ else:
101
+ st.write(f"Output: {output_value}")
102
+ except: # noqa: E722
103
+ st.write(f"Output: {span.attributes['output.value']}")
104
  with col2:
105
  status_color = (
106
  "green" if span.status.status_code == StatusCode.OK else "red"