Skip to content

Commit

Permalink
Add a copy question button, click to copy a specific question, and sw…
Browse files Browse the repository at this point in the history
…itch the button's background color based on the color theme to adapt.
  • Loading branch information
qcgm1978 authored and sunner committed Jul 6, 2023
1 parent 464a120 commit 65b3fc6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/Messages/ChatPrompt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
class="message prompt"
:class="props.isThread ? 'thread-prompt' : ''"
>
<pre>{{ props.message.content }}</pre>
<span>{{ props.message.content }} </span>
<v-btn flat size="x-small" icon @click="copyToClipboard" class="copy_btn_bg">
<v-icon>mdi-content-copy</v-icon>
</v-btn>
</v-card>
</template>

Expand Down Expand Up @@ -37,6 +40,10 @@ watch(
onMounted(() => {
root.value.$el.style.setProperty("--columns", props.columns);
});
function copyToClipboard() {
let content = props.message.content
navigator.clipboard.writeText(content);
}
</script>

<style scoped>
Expand All @@ -63,4 +70,7 @@ onMounted(() => {
margin-top: 1rem;
margin-bottom: 1rem;
}
.copy_btn_bg {
background-color: inherit;
}
</style>

1 comment on commit 65b3fc6

@vercel
Copy link

@vercel vercel bot commented on 65b3fc6 Jul 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

chatall – ./

chatall-llm.vercel.app
chatall-git-main-sunner.vercel.app
chatall-sunner.vercel.app

Please sign in to comment.