SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
Refactor chat stream API to simplify request body structure and remove unnecessary headers. The 'x-enable-meta-messages' header is now handled directly in the request body, improving clarity and maintainability.
Salman-Ahamedcbdc9ae19cf3
diff --git a/packages/app/src/backend/routes/api/page/chat.ts b/packages/app/src/backend/routes/api/page/chat.tsindex 168040ef..ceee1129 100644--- a/packages/app/src/backend/routes/api/page/chat.ts+++ b/packages/app/src/backend/routes/api/page/chat.ts@@ -60,19 +60,17 @@ const uploadFileMw = assetStorage.createUploadMw({});router.post('/stream', async (req, res) => {- let { message, attachments = [] } = req.body;const userId = req._user?.id;const teamId = req._team?.id;const token = req.user.accessToken;const agentId = req.headers['x-agent-id'];const conversationId = req.headers['x-conversation-id'];const modelId = req.headers['x-model-id']; // Extract model ID for backend override- const enableMetaMessages = req.headers['x-enable-meta-messages'] === 'true';try {const result = await axios.post(getAgentServerURL(agentId as string, isUsingLocalServer) + '/v1/emb/chat/stream',- { message, attachments: req.body.attachments || [] },+ { ...req.body },{headers: {...includeAxiosAuth(token).headers,@@ -81,7 +79,6 @@ router.post('/stream', async (req, res) => {'x-agent-id': agentId,'x-conversation-id': conversationId,'x-smyth-team-id': teamId,- 'x-enable-meta-messages': enableMetaMessages,...(modelId ? { 'x-model-id': modelId } : {}), // Forward model ID if provided},responseType: 'stream',diff --git a/packages/app/src/react/features/ai-chat/clients/chat-api.client.ts b/packages/app/src/react/features/ai-chat/clients/chat-api.client.tsindex 755aeb49..5f8c7a2e 100644--- a/packages/app/src/react/features/ai-chat/clients/chat-api.client.ts+++ b/packages/app/src/react/features/ai-chat/clients/chat-api.client.ts@@ -104,12 +104,11 @@ export class ChatAPIClient {...this.config.defaultHeaders,'X-AGENT-ID': agentId,'x-conversation-id': chatId,- 'x-enable-meta-messages': 'true',...(modelId ? { 'x-model-id': modelId } : {}), // Include model override if provided...headers,};- const requestBody = { message, attachments };+ const requestBody = { message, attachments, enableMetaMessages: true };// Make streaming requestconst response = await fetch(`${this.config.baseUrl}/stream`, {