Fix: Proxy body serialization and optional chaining syntax
This commit is contained in:
@@ -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
2691
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user