Fix output order and add Reddit error handling
- SKILL.md: Move "What I learned" BEFORE "Research Complete" stats - Add error tracking to Report schema (reddit_error, x_error fields) - Wrap OpenAI API calls in try/catch with clear error messages - Show explicit error or "no results" messages in compact output - Fix false positive error detection for null error fields Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -101,6 +101,13 @@ def parse_reddit_response(response: Dict[str, Any]) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
items = []
|
||||
|
||||
# Check for API errors first
|
||||
if "error" in response and response["error"]:
|
||||
error = response["error"]
|
||||
err_msg = error.get("message", str(error)) if isinstance(error, dict) else str(error)
|
||||
print(f"[REDDIT ERROR] OpenAI API error: {err_msg}", flush=True)
|
||||
return items
|
||||
|
||||
# Try to find the output text
|
||||
output_text = ""
|
||||
if "output" in response:
|
||||
@@ -131,6 +138,7 @@ def parse_reddit_response(response: Dict[str, Any]) -> List[Dict[str, Any]]:
|
||||
break
|
||||
|
||||
if not output_text:
|
||||
print(f"[REDDIT WARNING] No output text found in OpenAI response. Keys present: {list(response.keys())}", flush=True)
|
||||
return items
|
||||
|
||||
# Extract JSON from the response
|
||||
|
||||
Reference in New Issue
Block a user