Spaces:
No application file
No application file
Update app.py
Browse files
app.py
CHANGED
|
@@ -68,9 +68,11 @@ def api_submit_answers(processed_answers: List[Dict[str, str]]) -> Dict[str, Any
|
|
| 68 |
submission_data = {
|
| 69 |
"username": USERNAME,
|
| 70 |
"agent_code": AGENT_CODE_IDENTIFIER,
|
| 71 |
-
"answers": processed_answers
|
| 72 |
}
|
| 73 |
|
|
|
|
|
|
|
| 74 |
response = requests.post(
|
| 75 |
f"{API_BASE_URL}/submit",
|
| 76 |
headers=HEADERS,
|
|
@@ -84,6 +86,8 @@ def api_submit_answers(processed_answers: List[Dict[str, str]]) -> Dict[str, Any
|
|
| 84 |
|
| 85 |
except requests.exceptions.RequestException as e:
|
| 86 |
print(f"Error submitting answers to API: {e}")
|
|
|
|
|
|
|
| 87 |
return {}
|
| 88 |
|
| 89 |
# --- OpenAI Client Configuration ---
|
|
@@ -355,7 +359,7 @@ async def process_questions():
|
|
| 355 |
clean_answer = agent_result.get("model_answer", "ERROR: No answer from agent")
|
| 356 |
all_submission_answers.append({
|
| 357 |
"task_id": task_id,
|
| 358 |
-
"
|
| 359 |
})
|
| 360 |
|
| 361 |
if all_submission_answers:
|
|
|
|
| 68 |
submission_data = {
|
| 69 |
"username": USERNAME,
|
| 70 |
"agent_code": AGENT_CODE_IDENTIFIER,
|
| 71 |
+
"answers": processed_answers # Each answer now has task_id and submitted_answer fields
|
| 72 |
}
|
| 73 |
|
| 74 |
+
print(f"Submitting answers: {json.dumps(submission_data, indent=2)}") # Added logging
|
| 75 |
+
|
| 76 |
response = requests.post(
|
| 77 |
f"{API_BASE_URL}/submit",
|
| 78 |
headers=HEADERS,
|
|
|
|
| 86 |
|
| 87 |
except requests.exceptions.RequestException as e:
|
| 88 |
print(f"Error submitting answers to API: {e}")
|
| 89 |
+
if hasattr(e.response, 'text'):
|
| 90 |
+
print(f"API Error Response: {e.response.text}")
|
| 91 |
return {}
|
| 92 |
|
| 93 |
# --- OpenAI Client Configuration ---
|
|
|
|
| 359 |
clean_answer = agent_result.get("model_answer", "ERROR: No answer from agent")
|
| 360 |
all_submission_answers.append({
|
| 361 |
"task_id": task_id,
|
| 362 |
+
"submitted_answer": clean_answer # Changed from "answer" to "submitted_answer"
|
| 363 |
})
|
| 364 |
|
| 365 |
if all_submission_answers:
|