@@ -8,7 +8,6 @@ export async function GET({ params }) {
8
8
const chatContainerEl = iframe.contentWindow.document.getElementById('chat-container');
9
9
if(chatContainerEl){
10
10
const contentHeight = chatContainerEl.scrollHeight;
11
- console.log('Resizing iframe. Content height:', contentHeight);
12
11
iframe.style.height = Math.max(400, Math.min(contentHeight, maxHeight)) + "px";
13
12
}
14
13
}
@@ -44,7 +43,6 @@ export async function GET({ params }) {
44
43
iframe.src = \`http://localhost:5173/chat/?embeddedAssistantId=${ id } \`;
45
44
46
45
iframe.onload = function() {
47
- console.log('Iframe loaded');
48
46
const iframeWindow = this.contentWindow;
49
47
const iframeDocument = iframeWindow.document;
50
48
@@ -55,7 +53,6 @@ export async function GET({ params }) {
55
53
if (chatContainer) {
56
54
const newHeight = chatContainer.scrollHeight;
57
55
if (newHeight !== lastHeight) {
58
- console.log('Height changed from', lastHeight, 'to', newHeight);
59
56
resizeIframeToContentSize(iframe);
60
57
lastHeight = newHeight;
61
58
}
@@ -68,17 +65,16 @@ export async function GET({ params }) {
68
65
69
66
// Set up MutationObserver as a backup
70
67
const observer = new MutationObserver(() => {
71
- console.log('Mutation detected');
72
68
resizeIframeToContentSize(iframe);
73
69
});
74
70
75
71
function initMutationObserver() {
76
72
const chatContainer = iframeDocument.getElementById('chat-container');
77
73
if (chatContainer) {
78
- console.log ('Chat container found, setting up MutationObserver');
74
+ console.error ('Chat container found, setting up MutationObserver');
79
75
observer.observe(chatContainer, { childList: true, subtree: true, attributes: true, characterData: true });
80
76
} else {
81
- console.log ('Chat container not found, retrying...');
77
+ console.error ('Chat container not found, retrying...');
82
78
setTimeout(initMutationObserver, 500); // Retry after 500ms
83
79
}
84
80
}
0 commit comments