Fix: Proxy body serialization and optional chaining syntax

This commit is contained in:
2026-02-25 03:17:28 +00:00
parent 5aa5ab73f3
commit 56933f59d1
3 changed files with 2700 additions and 1 deletions

View File

@@ -645,7 +645,8 @@ async function handleSendMessage() {
const title = content.substring(0, 50) + (content.length > 50 ? '...' : '');
await api.updateConversation(state.currentConversation.id, { title });
state.currentConversation.title = title;
document.querySelector('.conv-title[data-id="' + state.currentConversation.id + '"]')?.textContent = title;
const titleEl = document.querySelector(`.conv-title[data-id="${state.currentConversation.id}"]`);
if (titleEl) titleEl.textContent = title;
}
},
(err) => {

2691
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -320,6 +320,13 @@ app.use('/v1', requireAuth, createProxyMiddleware({
// Add auth token for OpenClaw gateway
proxyReq.setHeader('Authorization', `Bearer ${CONFIG.gatewayToken}`);
proxyReq.setHeader('x-openclaw-agent-id', req.headers['x-openclaw-agent-id'] || 'main');
// Re-serialize body if it was already parsed by express.json()
if (req.body && Object.keys(req.body).length > 0) {
const bodyData = JSON.stringify(req.body);
proxyReq.setHeader('Content-Length', Buffer.byteLength(bodyData));
proxyReq.write(bodyData);
}
},
onProxyRes: (proxyRes, req, res) => {
// Handle SSE streaming