AOSSIE-Org / AOSSIE-Org/BabyNest
FEATURE REQUEST: Improve frontend behavior when backend agent is disabled (SKIP_AGENT_INIT)
- 主要言語
- JavaScript
- スター
- 56
- フォーク
- 123
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
### Is your feature request related to a problem?
- [x] Yes, it is related to a problem
### Describe the feature you'd like
Hi,
Right now, the React Native frontend assumes the agent/backend context is usually available:
- `AgentContext` and `ChatScreen` try to:
- Fetch `/agent/context`
- Call `/agent` or other agent-related endpoints
- If the backend is running in **Fast Dev Mode** (e.g. `SKIP_AGENT_INIT=1`, `agent_initialized=false`), or if the agent routes return an error, the user may:
- See generic errors in Chat
- Not understand why AI features depending on backend context are failing
- Not realize that the **local GGUF model is still available** for pure chat
This is confusing for new contributors and for any user/dev who intentionally runs the backend without the agent.
## Proposal
Update the frontend to handle “agent disabled” cleanly and clearly:
### 1. Detect agent availability
In `AgentContext.jsx` and/or `ChatScreen.jsx`:
- Use `/health` (or the error responses from `/agent/context`) to detect **agent status**:
- If `agent_initialized === false`:
- Treat the agent as unavailable for this session.
- If `/agent/context` or `/agent` returns a specific “agent not initialized” / 503-style error:
- Handle that case explicitly instead of treating it as a generic failure.
### 2. Show a clear UI message
When the agent is not available:
- Show a **non-intrusive banner or message** in `ChatScreen`, e.g.:
> “Backend agent is disabled (fast dev mode). Using local model only – some context-aware features may be unavailable.”
- Optionally, show a small indicator (e.g. “Mode: Local Model Only”) so the user knows why RAG-style commands might not work.
### 3. Auto-switch Chat behavior
When agent is unavailable:
- Default Chat to **model-only mode**:
- Bypass RAG/agent flows in `ragService` (no `/agent` or `/agent/context` calls).
- Directly use `generateResponse()` with the local GGUF model.
- When agent becomes available again (e.g. backend restarted without `SKIP_AGENT_INIT`):
- Allow switching back to the normal behavior (RAG + agent context).
### 4. Documentation
Update `Frontend/README.md` (or relevant doc) briefly to explain:
- What happens when:
- Backend is up but `agent_initialized=false`
- Backend is down completely
- How Chat behaves in each case (fallback to local-only mode).
## Request
If this direction sounds good, I’d like to:
1. Implement the agent-availability detection and UI banner in `ChatScreen` / `AgentContext`.
2. Make Chat automatically fall back to model-only mode when the agent is disabled.
3. Add a short note to the frontend docs about this behavior.
Happy to adjust the exact UX (banner text, placement, etc.) based on your preferences.
Thanks!
please assign me @bhavik-mangla @Vivekgupta008
### Record
- [x] I agree to follow this project's Code of Conduct
- [x] I want to work on implementing this feature
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。