vinith17 commited on
Commit
6ed38e9
Β·
1 Parent(s): d1f939e

fix: Vercel structure and agent startup check bypass

Browse files
Files changed (4) hide show
  1. .vibecheck/last-score.json +1 -1
  2. agent.py +12 -8
  3. api/index.py +9 -0
  4. 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:05:27.724Z"
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
- "β•‘ ERROR: No LLM API key found. β•‘\n"
53
  "β•‘ β•‘\n"
54
  "β•‘ Set at least one of: β•‘\n"
55
- "β•‘ ANTHROPIC_API_KEY (preferred β€” uses Claude Haiku) β•‘\n"
56
- "β•‘ OPENAI_API_KEY (fallback β€” uses GPT-4o-mini) β•‘\n"
57
- "β•‘ β•‘\n"
58
- "β•‘ Example (PowerShell): β•‘\n"
59
- "β•‘ $env:ANTHROPIC_API_KEY = 'sk-ant-...' β•‘\n"
60
  "β•‘ β•‘\n"
61
- "β•‘ The server will NOT start without a key. β•‘\n"
 
62
  "β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•\n",
63
  file=sys.stderr,
64
  )
65
- sys.exit(1)
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": "app.py",
6
  "use": "@vercel/python"
7
  }
8
  ],
9
  "routes": [
10
  {
11
  "src": "/(.*)",
12
- "dest": "app.py"
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
  }