"...utils/git@developer.sourcefind.cn:modelzoo/stgcn.git" did not exist on "aa58d024619ca88cfc11f5501069354f19a8eb38"
Commit f33ca4c9 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

refac

parent bc73cb13
...@@ -127,6 +127,41 @@ ...@@ -127,6 +127,41 @@
} }
onMount(async () => { onMount(async () => {
window.addEventListener('message', async (event) => {
if (event.origin === window.origin) {
// Replace with your iframe's origin
console.log('Message received from iframe:', event.data);
if (event.data.type === 'input:prompt') {
console.log(event.data.text);
const inputElement = document.getElementById('chat-textarea');
if (inputElement) {
prompt = event.data.text;
inputElement.focus();
}
}
if (event.data.type === 'action:submit') {
console.log(event.data.text);
if (prompt !== '') {
await tick();
submitPrompt(prompt);
}
}
if (event.data.type === 'input:prompt:submit') {
console.log(event.data.text);
if (prompt !== '') {
await tick();
submitPrompt(event.data.text);
}
}
}
});
if (!$chatId) { if (!$chatId) {
chatId.subscribe(async (value) => { chatId.subscribe(async (value) => {
if (!value) { if (!value) {
......
...@@ -50,33 +50,6 @@ ...@@ -50,33 +50,6 @@
} }
}; };
window.addEventListener('message', (event) => {
if (event.origin === window.origin) {
// Replace with your iframe's origin
console.log('Message received from iframe:', event.data);
if (event.data.type === 'input:prompt') {
console.log(event.data.text);
const inputElement = document.getElementById('chat-textarea');
if (inputElement) {
inputElement.value = event.data.text;
inputElement.focus();
}
}
if (event.data.type === 'action:submit-prompt') {
console.log(event.data.text);
const submitButtonElement = document.getElementById('send-message-button');
if (submitButtonElement) {
submitButtonElement.click();
}
}
}
});
window.addEventListener('resize', onResize); window.addEventListener('resize', onResize);
const setWakeLock = async () => { const setWakeLock = async () => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment