Distinguish 'no token' from 'rate limited' in LLM status indicator
Browse filesHFInferenceClient returns 'nokey' status when HF_TOKEN is absent.
UI shows orange dot with tooltip 'no API token β set HF_TOKEN env var'
instead of red 'rate limit hit', making the cause immediately clear.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- src/soci/engine/llm.py +1 -1
- web/index.html +6 -3
src/soci/engine/llm.py
CHANGED
|
@@ -860,7 +860,7 @@ class HFInferenceClient:
|
|
| 860 |
@property
|
| 861 |
def llm_status(self) -> str:
|
| 862 |
if not self.api_key:
|
| 863 |
-
return "
|
| 864 |
return "limited" if self._is_quota_exhausted() else "active"
|
| 865 |
|
| 866 |
async def complete(
|
|
|
|
| 860 |
@property
|
| 861 |
def llm_status(self) -> str:
|
| 862 |
if not self.api_key:
|
| 863 |
+
return "nokey"
|
| 864 |
return "limited" if self._is_quota_exhausted() else "active"
|
| 865 |
|
| 866 |
async def complete(
|
web/index.html
CHANGED
|
@@ -2895,12 +2895,15 @@ function processStateData(data) {
|
|
| 2895 |
const providerIcon = { gemini: 'β¦', groq: 'β‘', claude: 'β', ollama: 'π¦', hf: 'π€' };
|
| 2896 |
const icon = providerIcon[data.llm_provider] || 'β‘';
|
| 2897 |
|
| 2898 |
-
// Status: limited > skipped > idle > active
|
| 2899 |
-
const
|
|
|
|
|
|
|
| 2900 |
const isSkipped = data.llm_skipped === true;
|
| 2901 |
const hasCalls = (data.llm_calls_last_tick || 0) > 0;
|
| 2902 |
let dotColor, statusTip;
|
| 2903 |
-
if (
|
|
|
|
| 2904 |
else if (isSkipped) { dotColor = '#666'; statusTip = 'LLM skipped (fast mode)'; }
|
| 2905 |
else if (hasCalls) { dotColor = '#4ecca3'; statusTip = `${data.llm_calls_last_tick} calls this tick`; }
|
| 2906 |
else { dotColor = '#f0c040'; statusTip = 'idle β no calls needed'; }
|
|
|
|
| 2895 |
const providerIcon = { gemini: 'β¦', groq: 'β‘', claude: 'β', ollama: 'π¦', hf: 'π€' };
|
| 2896 |
const icon = providerIcon[data.llm_provider] || 'β‘';
|
| 2897 |
|
| 2898 |
+
// Status: nokey > limited > skipped > idle > active
|
| 2899 |
+
const status = data.llm_status;
|
| 2900 |
+
const isNoKey = status === 'nokey';
|
| 2901 |
+
const isLimited = status === 'limited';
|
| 2902 |
const isSkipped = data.llm_skipped === true;
|
| 2903 |
const hasCalls = (data.llm_calls_last_tick || 0) > 0;
|
| 2904 |
let dotColor, statusTip;
|
| 2905 |
+
if (isNoKey) { dotColor = '#f0a040'; statusTip = 'no API token β set HF_TOKEN env var'; }
|
| 2906 |
+
else if (isLimited) { dotColor = '#e94560'; statusTip = 'quota / rate limit hit'; }
|
| 2907 |
else if (isSkipped) { dotColor = '#666'; statusTip = 'LLM skipped (fast mode)'; }
|
| 2908 |
else if (hasCalls) { dotColor = '#4ecca3'; statusTip = `${data.llm_calls_last_tick} calls this tick`; }
|
| 2909 |
else { dotColor = '#f0c040'; statusTip = 'idle β no calls needed'; }
|