feat: ask floating button

This commit is contained in:
Timothy J. Baek
2024-10-06 16:14:12 -07:00
parent 50b1a3471c
commit 53954e4c05
2 changed files with 130 additions and 28 deletions
@@ -490,15 +490,21 @@
dispatch('update');
}}
on:explain={(e) => {
dispatch('submit', {
parentId: message.id,
prompt:
`Explain this section to me in more detail\n\n` +
'```\n' +
e.detail +
'\n```'
});
on:select={(e) => {
const { type, content } = e.detail;
if (type === 'explain') {
dispatch('submit', {
parentId: message.id,
prompt: `Explain this section to me in more detail\n\n\`\`\`\n${content}\n\`\`\``
});
} else if (type === 'ask') {
const input = e.detail?.input ?? '';
dispatch('submit', {
parentId: message.id,
prompt: `\`\`\`\n${content}\n\`\`\`\n${input}`
});
}
}}
/>
{/if}