Commit 0f40985
feat(ai): Add automatic Ollama fallback when osvm.ai is unavailable
- Add fallback mechanism to AiService that tries local Ollama when primary
osvm.ai endpoint fails or times out
- Preserve system prompt when falling back (critical for agentic behavior)
- Add user notification in chat UI: "⚡ Using local AI (model) - primary
service unavailable"
- Add `did_use_fallback()` and `get_fallback_model()` public methods for
UI integration
- Use atomic flag for thread-safe fallback state tracking
- Default fallback model: qwen3-coder:30b (configurable via OLLAMA_MODEL env)
- Reduced retry attempts from 4 to 2 for faster fallback response
This fixes the chat hanging forever when osvm.ai is down by automatically
switching to local Ollama while preserving the full system prompt for
proper agentic execution.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent fcf5d71 commit 0f40985
File tree
2 files changed
+28
-1
lines changed- src
- services
- utils/agent_chat_v2/agent
2 files changed
+28
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| |||
257 | 259 | | |
258 | 260 | | |
259 | 261 | | |
| 262 | + | |
260 | 263 | | |
261 | 264 | | |
262 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
263 | 276 | | |
264 | 277 | | |
265 | 278 | | |
| |||
574 | 587 | | |
575 | 588 | | |
576 | 589 | | |
577 | | - | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
578 | 593 | | |
579 | 594 | | |
580 | 595 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
146 | 158 | | |
147 | 159 | | |
148 | 160 | | |
| |||
0 commit comments