Skip to content

Commit f3ea650

Browse files
Add a copy button to copy sent prompts to clipboard
Implements the copy to clipboard functionality for sent prompt messages Close #769
1 parent 0a9a37d commit f3ea650

File tree

8 files changed

+33
-7
lines changed

8 files changed

+33
-7
lines changed

src/components/Messages/ChatPrompt.vue

+19
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
class="message prompt"
55
:class="isThread ? 'thread-prompt' : ''"
66
>
7+
<v-card-title class="title">
8+
{{ $t("chat.promptTitle") }}
9+
<v-spacer></v-spacer>
10+
<v-btn flat size="x-small" icon @click="copyToClipboard">
11+
<v-icon>mdi-content-copy</v-icon>
12+
</v-btn>
13+
</v-card-title>
714
<pre>{{ message ? message.content : "" }}</pre>
815
</v-card>
916
</template>
@@ -37,6 +44,10 @@ watch(
3744
onMounted(() => {
3845
root.value.$el.style.setProperty("--columns", props.columns);
3946
});
47+
48+
function copyToClipboard() {
49+
navigator.clipboard.writeText(props.message.content);
50+
}
4051
</script>
4152

4253
<style scoped>
@@ -63,4 +74,12 @@ onMounted(() => {
6374
margin-top: 1rem;
6475
margin-bottom: 1rem;
6576
}
77+
78+
.title {
79+
display: flex;
80+
align-items: center;
81+
font-size: 1rem;
82+
padding: 0;
83+
margin-bottom: 8px;
84+
}
6685
</style>

src/i18n/locales/en.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@
8787
"botResponseDesc": "the selected response",
8888
"loading": "Loading...",
8989
"updateDebounceInterval": "Message Updating Interval (milliseconds)",
90-
"updateDebounceIntervalDesc": "The value controls the message update speed when the AI bot responds. A higher value delays the message processing and updates them all at once, which is more efficient. A lower value updates the messages faster, but may cause performance issues."
90+
"updateDebounceIntervalDesc": "The value controls the message update speed when the AI bot responds. A higher value delays the message processing and updates them all at once, which is more efficient. A lower value updates the messages faster, but may cause performance issues.",
91+
"promptTitle": "Prompt"
9192
},
9293
"bot": {
9394
"creatingConversation": "Creating conversation...",

src/i18n/locales/es.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
"newChat": "Nuevo chat",
5353
"deleteAllChatHistory": "Eliminar todo el historial de chat",
5454
"downloadAllChatHistory": "Guardar todo el historial de chat",
55-
"confirmDeleteAllChatHistory": "¿Está seguro de que desea eliminar todo el historial de chat? Esta acción no se puede deshacer."
55+
"confirmDeleteAllChatHistory": "¿Está seguro de que desea eliminar todo el historial de chat? Esta acción no se puede deshacer.",
56+
"promptTitle": "Entrada"
5657
},
5758
"bot": {
5859
"creatingConversation": "Creando conversación...",

src/i18n/locales/it.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
"done": "Fatto"
3434
},
3535
"chat": {
36-
"newChat": "Nuova Chat"
36+
"newChat": "Nuova Chat",
37+
"promptTitle": "Prompt"
3738
},
3839
"bot": {
3940
"creatingConversation": "Creazione della conversazione in corso...",

src/i18n/locales/ja.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"name": "チャット",
4444
"newChat": "新しいチャット",
4545
"deleteAllChatHistory": "全てのチャット履歴を削除",
46-
"confirmDeleteAllChatHistory": "全てのチャット履歴を削除しますか?この操作は取り消せません。"
46+
"confirmDeleteAllChatHistory": "全てのチャット履歴を削除しますか?この操作は取り消せません。",
47+
"promptTitle": "プロンプト"
4748
},
4849
"bot": {
4950
"creatingConversation": "会話を作成中...",

src/i18n/locales/ko.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@
8484
"botResponseDesc": "선택된 응답",
8585
"loading": "로드 중...",
8686
"updateDebounceInterval": "메시지 업데이트 간격 (밀리초)",
87-
"updateDebounceIntervalDesc": "이 값은 AI봇이 응답할 때 메시지 업데이트 속도를 조절합니다. 값이 높으면 메시지 처리가 지연되고 한 번에 업데이트되는 것이 더 효율적입니다. 값이 낮으면 메시지가 더 빨리 업데이트되지만 성능 문제가 발생할 수 있습니다."
87+
"updateDebounceIntervalDesc": "이 값은 AI봇이 응답할 때 메시지 업데이트 속도를 조절합니다. 값이 높으면 메시지 처리가 지연되고 한 번에 업데이트되는 것이 더 효율적입니다. 값이 낮으면 메시지가 더 빨리 업데이트되지만 성능 문제가 발생할 수 있습니다.",
88+
"promptTitle": "프롬프트"
8889
},
8990
"bot": {
9091
"creatingConversation": "대화를 만드는 중...",

src/i18n/locales/vi.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282
"description": "Mô tả",
8383
"botNameDesc": "Tên của bot",
8484
"botResponseDesc": "Phản hồi của bot",
85-
"loading": "Đang tải..."
85+
"loading": "Đang tải...",
86+
"promptTitle": "Nhập liệu"
8687
},
8788
"bot": {
8889
"creatingConversation": "Đang tạo hội thoại...",

src/i18n/locales/zh.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@
8787
"botResponseDesc": "所选响应内容",
8888
"loading": "加载中...",
8989
"updateDebounceInterval": "消息更新间隔(毫秒)",
90-
"updateDebounceIntervalDesc": "此值控制 AI 机器人回复时,消息更新速度。更高的值会延迟消息处理,并一次性更新所有消息,效率更高。更低的值会更快更新消息,但可能会导致性能问题。"
90+
"updateDebounceIntervalDesc": "此值控制 AI 机器人回复时,消息更新速度。更高的值会延迟消息处理,并一次性更新所有消息,效率更高。更低的值会更快更新消息,但可能会导致性能问题。",
91+
"promptTitle": "提示"
9192
},
9293
"bot": {
9394
"creatingConversation": "创建新对话...",

0 commit comments

Comments
 (0)