Skip to content

Commit

Permalink
Update collabai_embedded_code.js
Browse files Browse the repository at this point in the history
  • Loading branch information
afshansji authored Jan 6, 2025
1 parent cac6986 commit 4f6965b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions collabai_embedded_code.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
const scriptTag = document.currentScript || document.querySelector('script[data-assistant-name][data-assistant-id]');
const assistantName = scriptTag.getAttribute('data-assistant-name');
const assistantId = scriptTag.getAttribute('data-assistant-id');
const baseUrl = scriptTag.getAttribute('data-base-url');
const container = document.createElement("div");

console.log('Embedded script loaded');
Expand Down Expand Up @@ -64,9 +65,10 @@
`;
document.body.appendChild(container);

if (assistantName && assistantId) {
document.getElementById("chatbot-iframe").src = `https://collaborativeai-dev.managedcoder.com/agents/${assistantId}?embedded=true`;
console.log(`Iframe src set to: https://collaborativeai-dev.managedcoder.com/agents/${assistantId}`);
iif (assistantName && assistantId && baseUrl) {
const iframeSrc = `${baseUrl}/agents/${assistantId}?embedded=true`;
document.getElementById("chatbot-iframe").src = iframeSrc;
console.log(`Iframe src set to: ${iframeSrc}`);
} else {
console.error("Assistant name or ID not provided.");
}
Expand Down

0 comments on commit 4f6965b

Please sign in to comment.