diff --git a/neode-ui/docker/nginx-demo.conf b/neode-ui/docker/nginx-demo.conf index 4381040d..2c918631 100644 --- a/neode-ui/docker/nginx-demo.conf +++ b/neode-ui/docker/nginx-demo.conf @@ -78,6 +78,14 @@ http { } } + # Proxy AIUI API requests (web-search, claude) to backend + location /aiui/api/web-search { + proxy_pass http://neode-backend:5959; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + # Proxy Claude API requests to backend (which handles API key + streaming) location /aiui/api/claude/ { proxy_pass http://neode-backend:5959; diff --git a/neode-ui/mock-backend.js b/neode-ui/mock-backend.js index 4340e12d..8e560485 100755 --- a/neode-ui/mock-backend.js +++ b/neode-ui/mock-backend.js @@ -1017,6 +1017,12 @@ app.get('/app/filebrowser/api/raw/*', (req, res) => { }) // ============================================================================= +// AIUI Web Search stub (demo mode — no real search backend) +// ============================================================================= +app.get('/aiui/api/web-search', (req, res) => { + res.json({ results: [] }) +}) + // Claude API Proxy (reads ANTHROPIC_API_KEY from environment) // ============================================================================= import https from 'https' @@ -1031,7 +1037,14 @@ app.post('/aiui/api/claude/*', (req, res) => { } const apiPath = '/' + req.params[0] - const bodyStr = JSON.stringify(req.body) + + // Ensure max_tokens is set — Claude API requires it but AIUI may omit it + const body = req.body + if (body && !body.max_tokens) { + body.max_tokens = 4096 + } + + const bodyStr = JSON.stringify(body) const options = { hostname: 'api.anthropic.com', @@ -1098,7 +1111,7 @@ wss.on('connection', (ws, req) => { const heartbeatInterval = setInterval(() => { if (ws.readyState === 1) { try { - ws.send(JSON.stringify({ rev: Date.now(), patch: [] })) + ws.send(JSON.stringify({ type: 'heartbeat', rev: Date.now() })) } catch { /* ignore */ } } }, 45000) // Every 45s (client expects data within 60s)