Gå til innhold

Troubleshooting

Chatbot Not Appearing on Page

Check: 1. Is IsActive = 1 in AI_Chatbot_Settings for the club? 2. Is ai_chatbot_loader.asp included in the page template? 3. Open browser console – are there JavaScript errors? 4. Is chatbot.js loading? (/assets/js/chatbot.js)

/health Not Responding

Invoke-RestMethod http://127.0.0.1:8000/health

Possible causes: - uvicorn process is not running → run START_CHATBOT_v2.ps1 - Wrong port → verify --port 8000 is used - Windows firewall blocking local port

POST /api/chat Returns 403

The request contains a tenant_id that does not match ALLOWED_TENANT_ID = "SKI" in app.py.

Fix (current): Verify that the TENANT_ID constant in chatbot.js/ASP loader is "SKI".

POST /api/chat Returns 404

No cache file found for tenant.

Check:

Test-Path C:\ftp\sites\clubsite-4\API\chatbot\cache\SKI_context.json

If the file is missing: run the sync worker manually.

Sync Worker Fails

Run manually and view error:

cd C:\ftp\sites\clubsite-4\API\python
.\venv\Scripts\python.exe ..\chatbot\sync_worker.py

Common causes:

Error Cause Fix
pyodbc.Error: IM002 ODBC driver not installed Install "ODBC Driver 17 for SQL Server"
Login failed for user Wrong DB username/password in .env Check .env values
Can't open lib Wrong ODBC_DRIVER in .env Check installed driver version: Get-OdbcDriver
FileNotFoundError Wrong CACHE_DIR in .env Create directory or fix path

Gemini Error (500 Internal Server Error)

Check API key:

$env:GEMINI_API_KEY  # should not be empty

Verify the key is valid in Google AI Studio.

Common Gemini errors:

Error code Description
400 Invalid request (context too long?)
403 Invalid API key
429 Rate limit – too many requests
503 Gemini service temporarily unavailable

IIS Not Forwarding to uvicorn

Check URL Rewrite module: - Open IIS Manager → Site → URL Rewrite - Verify rule for /api/chat points to http://127.0.0.1:8000/api/chat

Check ARR (Application Request Routing): - ARR must be enabled for reverse proxy to work - IIS Manager → Server → Application Request Routing Cache → Enable proxy

.env Missing or Empty

Get-Content C:\ftp\sites\clubsite-4\API\chatbot\.env

If empty: copy from template and fill in:

Copy-Item .env.example .env
notepad .env

Check uvicorn Process

Get-Process python | Select-Object Id, CPU, WorkingSet, StartTime

View listening ports:

netstat -ano | findstr :8000