Spaces:
Sleeping
Sleeping
fix: Vercel structure and agent startup check bypass
Browse files- .vibecheck/last-score.json +1 -1
- agent.py +12 -8
- api/index.py +9 -0
- vercel.json +2 -2
.vibecheck/last-score.json
CHANGED
|
@@ -6,5 +6,5 @@
|
|
| 6 |
"runtimeProof": 0,
|
| 7 |
"contracts": 0,
|
| 8 |
"mockData": 0,
|
| 9 |
-
"lastUpdated": "2026-04-07T22:
|
| 10 |
}
|
|
|
|
| 6 |
"runtimeProof": 0,
|
| 7 |
"contracts": 0,
|
| 8 |
"mockData": 0,
|
| 9 |
+
"lastUpdated": "2026-04-07T22:24:01.971Z"
|
| 10 |
}
|
agent.py
CHANGED
|
@@ -42,6 +42,12 @@ def _check_api_keys() -> None:
|
|
| 42 |
API key is present, rather than letting the server start and then die
|
| 43 |
mid-request with a cryptic SDK error.
|
| 44 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
has_anthropic = bool(os.environ.get("ANTHROPIC_API_KEY", "").strip())
|
| 46 |
has_openai = bool(os.environ.get("OPENAI_API_KEY", "").strip())
|
| 47 |
|
|
@@ -49,20 +55,18 @@ def _check_api_keys() -> None:
|
|
| 49 |
print(
|
| 50 |
"\n"
|
| 51 |
"ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n"
|
| 52 |
-
"β
|
| 53 |
"β β\n"
|
| 54 |
"β Set at least one of: β\n"
|
| 55 |
-
"β ANTHROPIC_API_KEY (preferred β uses Claude Haiku)
|
| 56 |
-
"β OPENAI_API_KEY (fallback β uses GPT-4o-mini)
|
| 57 |
-
"β β\n"
|
| 58 |
-
"β Example (PowerShell): β\n"
|
| 59 |
-
"β $env:ANTHROPIC_API_KEY = 'sk-ant-...' β\n"
|
| 60 |
"β β\n"
|
| 61 |
-
"β The server will
|
|
|
|
| 62 |
"ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n",
|
| 63 |
file=sys.stderr,
|
| 64 |
)
|
| 65 |
-
|
| 66 |
|
| 67 |
if has_anthropic:
|
| 68 |
logger.info("API key found: Anthropic (primary)")
|
|
|
|
| 42 |
API key is present, rather than letting the server start and then die
|
| 43 |
mid-request with a cryptic SDK error.
|
| 44 |
"""
|
| 45 |
+
try:
|
| 46 |
+
from dotenv import load_dotenv
|
| 47 |
+
load_dotenv()
|
| 48 |
+
except ImportError:
|
| 49 |
+
pass
|
| 50 |
+
|
| 51 |
has_anthropic = bool(os.environ.get("ANTHROPIC_API_KEY", "").strip())
|
| 52 |
has_openai = bool(os.environ.get("OPENAI_API_KEY", "").strip())
|
| 53 |
|
|
|
|
| 55 |
print(
|
| 56 |
"\n"
|
| 57 |
"ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n"
|
| 58 |
+
"β WARNING: No LLM API key found. β\n"
|
| 59 |
"β β\n"
|
| 60 |
"β Set at least one of: β\n"
|
| 61 |
+
"β ANTHROPIC_API_KEY (preferred β uses Claude Haiku) β\n"
|
| 62 |
+
"β OPENAI_API_KEY (fallback β uses GPT-4o-mini) β\n"
|
|
|
|
|
|
|
|
|
|
| 63 |
"β β\n"
|
| 64 |
+
"β The server will start, but ALL reviews will fall back β\n"
|
| 65 |
+
"β to the local mock reviewer. β\n"
|
| 66 |
"ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n",
|
| 67 |
file=sys.stderr,
|
| 68 |
)
|
| 69 |
+
return
|
| 70 |
|
| 71 |
if has_anthropic:
|
| 72 |
logger.info("API key found: Anthropic (primary)")
|
api/index.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
# Add root directory to path so imports work identically to running locally
|
| 5 |
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 6 |
+
|
| 7 |
+
from app import app
|
| 8 |
+
|
| 9 |
+
# Vercel needs the flask app to be exposed exactly like this in api/index.py
|
vercel.json
CHANGED
|
@@ -2,14 +2,14 @@
|
|
| 2 |
"version": 2,
|
| 3 |
"builds": [
|
| 4 |
{
|
| 5 |
-
"src": "
|
| 6 |
"use": "@vercel/python"
|
| 7 |
}
|
| 8 |
],
|
| 9 |
"routes": [
|
| 10 |
{
|
| 11 |
"src": "/(.*)",
|
| 12 |
-
"dest": "
|
| 13 |
}
|
| 14 |
]
|
| 15 |
}
|
|
|
|
| 2 |
"version": 2,
|
| 3 |
"builds": [
|
| 4 |
{
|
| 5 |
+
"src": "api/index.py",
|
| 6 |
"use": "@vercel/python"
|
| 7 |
}
|
| 8 |
],
|
| 9 |
"routes": [
|
| 10 |
{
|
| 11 |
"src": "/(.*)",
|
| 12 |
+
"dest": "api/index.py"
|
| 13 |
}
|
| 14 |
]
|
| 15 |
}
|