umanggarg Claude Sonnet 4.6 commited on
Commit
7b9ed67
·
1 Parent(s): 7a75766

fix: 45s timeout on all LLM clients + slow contextual star beat

Browse files

Timeout: All OpenAI() clients (Gemini, Cerebras, OpenRouter fallbacks)
now have timeout=45s. Previously no timeout was set — OpenRouter free
tier sometimes queues requests indefinitely, causing the tour/diagram
generation to hang at 55% for 10+ minutes. 45s is generous for any
real LLM response but catches provider hangs.

Star: contextual ✦ beat slowed to 8s cycle (was 3.6s), pink-purple
color shift at peak matches the progress bar shimmer palette.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. backend/services/generation.py +5 -0
  2. ui/src/index.css +10 -1
backend/services/generation.py CHANGED
@@ -46,6 +46,7 @@ def _openrouter_client(api_key: str):
46
  return OpenAI(
47
  api_key=api_key,
48
  base_url="https://openrouter.ai/api/v1",
 
49
  default_headers={
50
  "HTTP-Referer": "http://localhost:3000",
51
  "X-Title": "Cartographer",
@@ -274,6 +275,7 @@ class GenerationService:
274
  self._client = OpenAI(
275
  api_key=settings.gemini_api_key,
276
  base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
 
277
  )
278
  self._model = "gemma-4-31b-it"
279
  print("Generation: using Gemma 4 31B (gemma-4-31b-it) via Google Gemini API")
@@ -283,6 +285,7 @@ class GenerationService:
283
  self._client = OpenAI(
284
  api_key=settings.cerebras_api_key,
285
  base_url="https://api.cerebras.ai/v1",
 
286
  )
287
  # llama-3.3-70b produces dramatically better context sentences than
288
  # llama3.1-8b for structured tasks like "describe what this chunk does in
@@ -335,6 +338,7 @@ class GenerationService:
335
  self._client = OpenAI(
336
  api_key=settings.cerebras_api_key,
337
  base_url="https://api.cerebras.ai/v1",
 
338
  )
339
  self._model = "llama3.3-70b"
340
  self.provider = "cerebras"
@@ -437,6 +441,7 @@ class GenerationService:
437
  self._client = OpenAI(
438
  api_key=settings.gemini_api_key,
439
  base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
 
440
  )
441
  self._model = "gemma-4-31b-it"
442
  self.provider = "gemini"
 
46
  return OpenAI(
47
  api_key=api_key,
48
  base_url="https://openrouter.ai/api/v1",
49
+ timeout=45, # OpenRouter free tier sometimes queues indefinitely — cap it
50
  default_headers={
51
  "HTTP-Referer": "http://localhost:3000",
52
  "X-Title": "Cartographer",
 
275
  self._client = OpenAI(
276
  api_key=settings.gemini_api_key,
277
  base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
278
+ timeout=45,
279
  )
280
  self._model = "gemma-4-31b-it"
281
  print("Generation: using Gemma 4 31B (gemma-4-31b-it) via Google Gemini API")
 
285
  self._client = OpenAI(
286
  api_key=settings.cerebras_api_key,
287
  base_url="https://api.cerebras.ai/v1",
288
+ timeout=45,
289
  )
290
  # llama-3.3-70b produces dramatically better context sentences than
291
  # llama3.1-8b for structured tasks like "describe what this chunk does in
 
338
  self._client = OpenAI(
339
  api_key=settings.cerebras_api_key,
340
  base_url="https://api.cerebras.ai/v1",
341
+ timeout=45,
342
  )
343
  self._model = "llama3.3-70b"
344
  self.provider = "cerebras"
 
441
  self._client = OpenAI(
442
  api_key=settings.gemini_api_key,
443
  base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
444
+ timeout=45,
445
  )
446
  self._model = "gemma-4-31b-it"
447
  self.provider = "gemini"
ui/src/index.css CHANGED
@@ -1739,9 +1739,18 @@ textarea:focus-visible {
1739
  .repo-contextual {
1740
  font-size: 9px;
1741
  color: var(--accent-soft);
1742
- opacity: 0.7;
1743
  cursor: default;
1744
  line-height: 1;
 
 
 
 
 
 
 
 
 
 
1745
  }
1746
 
1747
  .quality-tip-key {
 
1739
  .repo-contextual {
1740
  font-size: 9px;
1741
  color: var(--accent-soft);
 
1742
  cursor: default;
1743
  line-height: 1;
1744
+ /* Slow glow-beat: signals "this repo has AI context embedded" without
1745
+ demanding attention. Opacity oscillates between dim and full while
1746
+ text-shadow breathes the accent glow in and out. 3.6s period keeps
1747
+ it calm — closer to a sleeping MacBook indicator than a notification. */
1748
+ animation: contextual-beat 8s ease-in-out infinite;
1749
+ }
1750
+ @keyframes contextual-beat {
1751
+ 0% { opacity: 0.45; color: var(--accent-soft); text-shadow: none; }
1752
+ 50% { opacity: 1; color: rgba(200, 130, 255, 1); text-shadow: 0 0 8px rgba(200, 130, 255, 0.9), 0 0 16px var(--accent); }
1753
+ 100% { opacity: 0.45; color: var(--accent-soft); text-shadow: none; }
1754
  }
1755
 
1756
  .quality-tip-key {