{
let ids = [];
s.document.forEach((document, index) => {
const metadata = s.metadata?.[index];
const id = metadata?.source ?? 'N/A';
if (metadata?.name) {
ids.push(metadata.name);
return ids;
}
if (id.startsWith('http://') || id.startsWith('https://')) {
ids.push(id);
} else {
ids.push(s?.source?.name ?? id);
}
return ids;
});
acc = [...acc, ...ids];
// remove duplicates
return acc.filter((item, index) => acc.indexOf(item) === index);
}, [])}
{onSourceClick}
on:update={(e) => {
dispatch('update', e.detail);
}}
on:code={(e) => {
const { lang, code } = e.detail;
if (
(['html', 'svg'].includes(lang) || (lang === 'xml' && code.includes('svg'))) &&
!$mobile &&
$chatId
) {
showArtifacts.set(true);
showControls.set(true);
}
}}
/>
{#if floatingButtons && model}
{
console.log(modelId, parentId, messages);
onAddMessages({ modelId, parentId, messages });
closeFloatingButtons();
}}
/>
{/if}