Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -24,9 +24,6 @@ async def update_validation_space_on_answer(response, type, timestamp):
|
|
24 |
# Store the event for display in the UI
|
25 |
incoming_events.put({"event": type, "timestamp": str(timestamp)})
|
26 |
|
27 |
-
# Print the response object structure to understand its properties
|
28 |
-
print(f"Response object: {dir(response)}")
|
29 |
-
|
30 |
# Get the record from the response
|
31 |
record = response.record
|
32 |
|
@@ -54,7 +51,8 @@ async def update_validation_space_on_answer(response, type, timestamp):
|
|
54 |
print(response)
|
55 |
|
56 |
response_dict = response.to_dict()
|
57 |
-
|
|
|
58 |
# if hasattr(response, 'values') and 'text' in response.values:
|
59 |
# if isinstance(response.values['text'], dict) and 'value' in response.values['text']:
|
60 |
# response_value = response.values['text']['value']
|
@@ -66,7 +64,7 @@ async def update_validation_space_on_answer(response, type, timestamp):
|
|
66 |
# Based on the error, let's try to get the value differently
|
67 |
validation_record = {
|
68 |
"question": record.fields["question"],
|
69 |
-
"answer":
|
70 |
}
|
71 |
|
72 |
# Add the record to the validation space
|
|
|
24 |
# Store the event for display in the UI
|
25 |
incoming_events.put({"event": type, "timestamp": str(timestamp)})
|
26 |
|
|
|
|
|
|
|
27 |
# Get the record from the response
|
28 |
record = response.record
|
29 |
|
|
|
51 |
print(response)
|
52 |
|
53 |
response_dict = response.to_dict()
|
54 |
+
print("response dict", response_dict)
|
55 |
+
answer = response_dict["values"]['text']['value']
|
56 |
# if hasattr(response, 'values') and 'text' in response.values:
|
57 |
# if isinstance(response.values['text'], dict) and 'value' in response.values['text']:
|
58 |
# response_value = response.values['text']['value']
|
|
|
64 |
# Based on the error, let's try to get the value differently
|
65 |
validation_record = {
|
66 |
"question": record.fields["question"],
|
67 |
+
"answer": answer,
|
68 |
}
|
69 |
|
70 |
# Add the record to the validation space
|