-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow users to copy assistant responses
- Loading branch information
1 parent
8d5245d
commit 2f74fec
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<template> | ||
<Button :icon="`pi ${copied ? 'pi-check' : 'pi-copy'}`" text class="bg-inherit text-gray-300" title="Copy" | ||
size="large" @click="onClick" /> | ||
</template> | ||
|
||
<script> | ||
import Button from "primevue/button"; | ||
export default { | ||
name: 'CopyButton', | ||
components: { Button }, | ||
props: { content: String }, | ||
data() { | ||
return { | ||
copied: false, | ||
} | ||
}, | ||
methods: { | ||
onClick() { | ||
navigator.clipboard.writeText(this.content.replace('<sources>', '')) | ||
this.copied = true | ||
setTimeout(() => this.copied = false, 2000) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style></style> |