Commit 96c0b8a6 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

feat: clone support

parent 0715cd28
...@@ -29,6 +29,11 @@ ...@@ -29,6 +29,11 @@
let id = ''; let id = '';
let name = ''; let name = '';
let params = {};
let capabilities = {
vision: true
};
let info = { let info = {
id: '', id: '',
base_model_id: null, base_model_id: null,
...@@ -47,12 +52,6 @@ ...@@ -47,12 +52,6 @@
} }
}; };
let params = {};
let capabilities = {
vision: false
};
$: if (name) { $: if (name) {
id = name.replace(/\s+/g, '-').toLowerCase(); id = name.replace(/\s+/g, '-').toLowerCase();
} }
...@@ -96,6 +95,19 @@ ...@@ -96,6 +95,19 @@
success = false; success = false;
}; };
const initModel = (model) => {
id = model.id;
name = model.name;
params = { ...params, ...model?.info?.params };
capabilities = { ...capabilities, ...(model?.info?.meta?.capabilities ?? {}) };
info = {
...info,
...model.info
};
};
onMount(async () => { onMount(async () => {
window.addEventListener('message', async (event) => { window.addEventListener('message', async (event) => {
if ( if (
...@@ -108,8 +120,11 @@ ...@@ -108,8 +120,11 @@
].includes(event.origin) ].includes(event.origin)
) )
return; return;
const model = JSON.parse(event.data); const model = JSON.parse(event.data);
console.log(model); console.log(model);
initModel(model);
}); });
if (window.opener ?? false) { if (window.opener ?? false) {
...@@ -118,8 +133,10 @@ ...@@ -118,8 +133,10 @@
if (sessionStorage.model) { if (sessionStorage.model) {
const model = JSON.parse(sessionStorage.model); const model = JSON.parse(sessionStorage.model);
console.log(model);
sessionStorage.removeItem('model'); sessionStorage.removeItem('model');
console.log(model);
initModel(model);
} }
}); });
</script> </script>
......
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