@@ -8,7 +8,6 @@ export async function GET({ params }) {
88 const chatContainerEl = iframe.contentWindow.document.getElementById('chat-container');
99 if(chatContainerEl){
1010 const contentHeight = chatContainerEl.scrollHeight;
11- console.log('Resizing iframe. Content height:', contentHeight);
1211 iframe.style.height = Math.max(400, Math.min(contentHeight, maxHeight)) + "px";
1312 }
1413 }
@@ -44,7 +43,6 @@ export async function GET({ params }) {
4443 iframe.src = \`http://localhost:5173/chat/?embeddedAssistantId=${ id } \`;
4544
4645 iframe.onload = function() {
47- console.log('Iframe loaded');
4846 const iframeWindow = this.contentWindow;
4947 const iframeDocument = iframeWindow.document;
5048
@@ -55,7 +53,6 @@ export async function GET({ params }) {
5553 if (chatContainer) {
5654 const newHeight = chatContainer.scrollHeight;
5755 if (newHeight !== lastHeight) {
58- console.log('Height changed from', lastHeight, 'to', newHeight);
5956 resizeIframeToContentSize(iframe);
6057 lastHeight = newHeight;
6158 }
@@ -68,17 +65,16 @@ export async function GET({ params }) {
6865
6966 // Set up MutationObserver as a backup
7067 const observer = new MutationObserver(() => {
71- console.log('Mutation detected');
7268 resizeIframeToContentSize(iframe);
7369 });
7470
7571 function initMutationObserver() {
7672 const chatContainer = iframeDocument.getElementById('chat-container');
7773 if (chatContainer) {
78- console.log ('Chat container found, setting up MutationObserver');
74+ console.error ('Chat container found, setting up MutationObserver');
7975 observer.observe(chatContainer, { childList: true, subtree: true, attributes: true, characterData: true });
8076 } else {
81- console.log ('Chat container not found, retrying...');
77+ console.error ('Chat container not found, retrying...');
8278 setTimeout(initMutationObserver, 500); // Retry after 500ms
8379 }
8480 }
0 commit comments