refac
This commit is contained in:
@@ -195,77 +195,6 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if floatingButtons && model}
|
|
||||||
<FloatingButtons
|
|
||||||
bind:this={floatingButtonsElement}
|
|
||||||
{id}
|
|
||||||
{messageId}
|
|
||||||
actions={$settings?.floatingActionButtons ?? []}
|
|
||||||
model={(selectedModels ?? []).includes(model?.id)
|
|
||||||
? model?.id
|
|
||||||
: (selectedModels ?? []).length > 0
|
|
||||||
? selectedModels.at(0)
|
|
||||||
: model?.id}
|
|
||||||
messages={createMessagesList(history, messageId)}
|
|
||||||
onAdd={({ modelId, parentId, messages }) => {
|
|
||||||
console.log(modelId, parentId, messages);
|
|
||||||
onAddMessages({ modelId, parentId, messages });
|
|
||||||
closeFloatingButtons();
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const metadata = source.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(source?.source?.name ?? id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ids;
|
|
||||||
});
|
|
||||||
|
|
||||||
acc = [...acc, ...ids];
|
|
||||||
|
|
||||||
// remove duplicates
|
|
||||||
return acc.filter((item, index) => acc.indexOf(item) === index);
|
|
||||||
}, [])}
|
|
||||||
{onSourceClick}
|
|
||||||
{onTaskClick}
|
|
||||||
{onSave}
|
|
||||||
onUpdate={async (token) => {
|
|
||||||
const { lang, text: code } = token;
|
|
||||||
|
|
||||||
if (
|
|
||||||
($settings?.detectArtifacts ?? true) &&
|
|
||||||
(['html', 'svg'].includes(lang) || (lang === 'xml' && code.includes('svg'))) &&
|
|
||||||
!$mobile &&
|
|
||||||
$chatId
|
|
||||||
) {
|
|
||||||
await tick();
|
|
||||||
showArtifacts.set(true);
|
|
||||||
showControls.set(true);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onPreview={async (value) => {
|
|
||||||
console.log('Preview', value);
|
|
||||||
await artifactCode.set(value);
|
|
||||||
await showControls.set(true);
|
|
||||||
await showArtifacts.set(true);
|
|
||||||
await showEmbeds.set(false);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if floatingButtons && model}
|
{#if floatingButtons && model}
|
||||||
<FloatingButtons
|
<FloatingButtons
|
||||||
bind:this={floatingButtonsElement}
|
bind:this={floatingButtonsElement}
|
||||||
|
|||||||
Reference in New Issue
Block a user