Files
sciagent/be0/TROUBLESHOOTING_CHAT.md
T
Thinh Lam 688fac73e9
CI/CD / backend (push) Failing after 2m8s
CI/CD / frontend (push) Failing after 1m40s
CI/CD / deploy (push) Has been skipped
sciagent code + Gitea Actions CI/CD
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 09:38:30 +07:00

151 lines
3.0 KiB
Markdown

# Chat Assistant Troubleshooting Guide
## Common Errors and Solutions
### Error: 500 Internal Server Error
This usually indicates one of the following issues:
#### 1. Ollama Not Running
**Symptoms:**
- 500 error on `/api/v1/chat`
- Error message mentions "connection" or "refused"
**Solution:**
```bash
# Check if Ollama is running in the container
docker exec be0 ps aux | grep ollama
# If not running, restart the container
docker-compose restart be0
# Or start Ollama manually
docker exec be0 ollama serve &
```
#### 2. Model Not Available
**Symptoms:**
- Error mentions "model not found"
- Model name mismatch
**Solution:**
```bash
# Check available models
docker exec be0 ollama list
# Pull the required model
docker exec be0 ollama pull gemma3:270M
# Verify model is available
docker exec be0 ollama list | grep gemma3
```
#### 3. Model Name Mismatch
**Issue:** Code uses `gemma3:27b` but entrypoint pulls `gemma3:270M`
**Solution:**
The code has been updated to use `gemma3:270M` to match the entrypoint script.
#### 4. Network Connectivity
**Symptoms:**
- Connection refused errors
- Timeout errors
**Solution:**
```bash
# Check if Ollama is accessible from within the container
docker exec be0 curl http://localhost:11434/api/tags
# Check Ollama service status
docker exec be0 ollama list
```
## Diagnostic Endpoints
### Health Check
```bash
curl http://localhost:4402/health
```
This will show:
- Overall service status
- Ollama connection status
- Available models
### Test Ollama Directly
```bash
# From inside the container
docker exec be0 ollama run gemma3:270M "Hello"
```
## Debugging Steps
1. **Check Backend Logs:**
```bash
docker-compose logs be0 | tail -50
```
2. **Check Chat Assistant Logs:**
```bash
tail -f be0/logs/ChatAssistant.log
```
3. **Test API Endpoint:**
```bash
curl -X POST http://localhost:4402/api/v1/chat \
-H "Content-Type: application/json" \
-d '{"message": "Hello"}'
```
4. **Verify Ollama Service:**
```bash
docker exec be0 ollama list
docker exec be0 curl http://localhost:11434/api/tags
```
## Common Fixes
### Fix 1: Restart Ollama Service
```bash
docker exec be0 pkill ollama
docker exec be0 ollama serve &
sleep 2
docker exec be0 ollama list
```
### Fix 2: Pull Missing Model
```bash
docker exec be0 ollama pull gemma3:270M
```
### Fix 3: Restart Container
```bash
docker-compose restart be0
```
### Fix 4: Rebuild Container
```bash
docker-compose down
docker-compose build be0
docker-compose up be0
```
## Expected Behavior
When working correctly:
1. Health endpoint shows Ollama as "connected"
2. Available models list includes `gemma3:270M`
3. Chat endpoint returns 200 with a response
4. Logs show successful message processing
## Still Having Issues?
1. Check the full error in logs: `docker-compose logs be0`
2. Verify Ollama is running: `docker exec be0 ps aux | grep ollama`
3. Test Ollama directly: `docker exec be0 ollama run gemma3:270M "test"`
4. Check model availability: `docker exec be0 ollama list`