Skip to content

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.

Refactor ChatBot and API to Enable Meta Messages Feature

Salman-Ahamed36414f935a8b
diff --git a/packages/app/src/backend/routes/api/page/chat.ts b/packages/app/src/backend/routes/api/page/chat.ts
index cb32e7e3..c4b0743a 100644
--- a/packages/app/src/backend/routes/api/page/chat.ts
+++ b/packages/app/src/backend/routes/api/page/chat.ts
@@ -66,7 +66,7 @@ router.post('/stream', async (req, res) => {
const token = req.user.accessToken;
const agentId = req.headers['x-agent-id'];
const conversationId = req.headers['x-conversation-id'];
- const isAgentChat = req.headers['x-ai-agent'] === 'true';
+ const enableMetaMessages = req.headers['x-enable-meta-messages'] === 'true';
try {
const result = await axios.post(
@@ -80,7 +80,7 @@ router.post('/stream', async (req, res) => {
'x-agent-id': agentId,
'x-conversation-id': conversationId,
'x-smyth-team-id': teamId,
- 'x-ai-agent': isAgentChat,
+ 'x-enable-meta-messages': enableMetaMessages,
},
responseType: 'stream',
},
diff --git a/packages/app/src/react/features/agent-settings/dialogs/ChatBot.tsx b/packages/app/src/react/features/agent-settings/dialogs/ChatBot.tsx
index 6939f7f4..eb2914a6 100644
--- a/packages/app/src/react/features/agent-settings/dialogs/ChatBot.tsx
+++ b/packages/app/src/react/features/agent-settings/dialogs/ChatBot.tsx
@@ -112,7 +112,7 @@ const ChatBotDialog = ({
allowedDomains: [],
isFullScreen: false,
allowFileAttachments: false,
- enableDebugLogs: false,
+ enableMetaMessages: false,
};
useEffect(() => {
@@ -675,12 +675,12 @@ const ChatBotDialog = ({
<div className="relative flex items-center">
<Field
type="checkbox"
- id="enableDebugLogs"
- name="enableDebugLogs"
+ id="enableMetaMessages"
+ name="enableMetaMessages"
className="w-4 h-4 bg-gray-100 border-gray-300 rounded peer appearance-none focus:outline-none box-shadow-none"
- checked={props.values?.enableDebugLogs || false}
+ checked={props.values?.enableMetaMessages || false}
onChange={(e) => {
- props.setFieldValue('enableDebugLogs', e.target.checked);
+ props.setFieldValue('enableMetaMessages', e.target.checked);
}}
/>
<svg
@@ -697,10 +697,10 @@ const ChatBotDialog = ({
</svg>
</div>
<label
- htmlFor="enableDebugLogs"
+ htmlFor="enableMetaMessages"
className="ml-2 text-sm font-normal text-[#1E1E1E]"
>
- Enable debug logs
+ Enable Meta Messages
</label>
</div>
</div>
diff --git a/packages/app/src/react/features/agent-settings/modals/chatbotCode.modal.tsx b/packages/app/src/react/features/agent-settings/modals/chatbotCode.modal.tsx
index 13908b58..33ce57fd 100644
--- a/packages/app/src/react/features/agent-settings/modals/chatbotCode.modal.tsx
+++ b/packages/app/src/react/features/agent-settings/modals/chatbotCode.modal.tsx
@@ -15,14 +15,14 @@ type EmbodimentData = {
// Add other properties as needed
isFullScreen?: boolean;
allowFileAttachments?: boolean;
- enableDebugLogs?: boolean;
+ enableMetaMessages?: boolean;
};
};
const ChatbotCodeSnippetModal = (props: Props) => {
const isFullScreen = props.embodimentData?.properties?.isFullScreen;
const allowFileAttachments = props.embodimentData?.properties?.allowFileAttachments;
- const enableDebugLogs = props.embodimentData?.properties?.enableDebugLogs;
+ const enableMetaMessages = props.embodimentData?.properties?.enableMetaMessages;
const isUsingFullScreen = Boolean(isFullScreen);
function getFullDomain(domain) {
// Check if the domain already includes http:// or https://
@@ -46,7 +46,7 @@ const ChatbotCodeSnippetModal = (props: Props) => {
isChatOnly: ${isUsingFullScreen},
${isUsingFullScreen ? 'containerId: "smythos-chatbot-container",' : ''}
allowAttachments: ${allowFileAttachments},
- enableDebugLogs: ${enableDebugLogs},
+ enableMetaMessages: ${enableMetaMessages},
// ... additional settings ...
introMessage: '${
props.embodimentData && props.embodimentData.properties
diff --git a/packages/app/src/react/features/agent-settings/utils/index.ts b/packages/app/src/react/features/agent-settings/utils/index.ts
index 6110ffeb..00f348fa 100644
--- a/packages/app/src/react/features/agent-settings/utils/index.ts
+++ b/packages/app/src/react/features/agent-settings/utils/index.ts
@@ -121,7 +121,7 @@ export const mapBotEmbodimentProperties = (properties: TChatBotProperties, activ
allowedDomains: properties?.allowedDomains || [],
isFullScreen: properties?.isFullScreen || false,
allowFileAttachments: properties?.allowFileAttachments || false,
- enableDebugLogs: properties?.enableDebugLogs || false,
+ enableMetaMessages: properties?.enableMetaMessages || false,
};
};
diff --git a/packages/app/src/react/features/agents/components/modals/deploy-agent-modal.tsx b/packages/app/src/react/features/agents/components/modals/deploy-agent-modal.tsx
index 0abe6c41..b0c70421 100644
--- a/packages/app/src/react/features/agents/components/modals/deploy-agent-modal.tsx
+++ b/packages/app/src/react/features/agents/components/modals/deploy-agent-modal.tsx
@@ -156,7 +156,7 @@ function DeployAgentModal({ userInfo, deploymentSidebarCtx }) {
introMessage: chatbotEmbodiment.properties?.introMessage || '',
isFullScreen: chatbotEmbodiment.properties?.isFullScreen || false,
allowFileAttachments: chatbotEmbodiment.properties?.allowFileAttachments || false,
- enableDebugLogs: chatbotEmbodiment.properties?.enableDebugLogs || false,
+ enableMetaMessages: chatbotEmbodiment.properties?.enableMetaMessages || false,
},
}
: undefined;
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.ts
index 82832a96..dfafce6a 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
@@ -119,7 +119,7 @@ export class ChatAPIClient {
...this.config.defaultHeaders,
'X-AGENT-ID': agentId,
'x-conversation-id': chatId,
- 'x-ai-agent': 'true',
+ 'x-enable-meta-messages': 'true',
...headers,
};
diff --git a/packages/app/src/react/features/ai-chat/utils/index.ts b/packages/app/src/react/features/ai-chat/utils/index.ts
index 96045b5d..ae651993 100644
--- a/packages/app/src/react/features/ai-chat/utils/index.ts
+++ b/packages/app/src/react/features/ai-chat/utils/index.ts
@@ -355,7 +355,7 @@ export const chatUtils = {
'Content-Type': 'application/json',
'X-AGENT-ID': input.agentId,
'x-conversation-id': input.chatId,
- 'x-ai-agent': 'true',
+ 'x-enable-meta-messages': 'true',
},
body: JSON.stringify({
message: input.query,
diff --git a/packages/app/src/react/shared/types/api-results.types.ts b/packages/app/src/react/shared/types/api-results.types.ts
index cf628a76..1db40e7a 100644
--- a/packages/app/src/react/shared/types/api-results.types.ts
+++ b/packages/app/src/react/shared/types/api-results.types.ts
@@ -100,7 +100,7 @@ export interface ChatbotEmbodimentData {
allowedDomains: string[];
isFullScreen?: boolean;
allowFileAttachments?: boolean;
- enableDebugLogs?: boolean;
+ enableMetaMessages?: boolean;
colors: {
botBubbleColors: {
diff --git a/packages/app/src/react/shared/types/embodiment.types.ts b/packages/app/src/react/shared/types/embodiment.types.ts
index 8f5668cd..1bfae874 100644
--- a/packages/app/src/react/shared/types/embodiment.types.ts
+++ b/packages/app/src/react/shared/types/embodiment.types.ts
@@ -33,7 +33,7 @@ export type TChatBotProperties = {
allowedDomains: string[];
isFullScreen?: boolean;
allowFileAttachments?: boolean;
- enableDebugLogs?: boolean;
+ enableMetaMessages?: boolean;
};
export type TFormPreviewProperties = {