feat: Insert captain response to reply editor (#10581)

This commit is contained in:
Sivin Varghese
2024-12-13 15:13:16 +05:30
committed by GitHub
parent 19ff5bdd5e
commit 9220afce6e
7 changed files with 57 additions and 7 deletions

View File

@@ -1,12 +1,36 @@
<script setup>
import { computed } from 'vue';
import { emitter } from 'shared/helpers/mitt';
import { BUS_EVENTS } from 'shared/constants/busEvents';
import { INBOX_TYPES } from 'dashboard/helper/inbox';
import Button from 'dashboard/components-next/button/Button.vue';
import Avatar from '../avatar/Avatar.vue';
defineProps({
const props = defineProps({
message: {
type: Object,
required: true,
},
conversationInboxType: {
type: String,
required: true,
},
});
const insertIntoRichEditor = computed(() => {
return [INBOX_TYPES.WEB, INBOX_TYPES.EMAIL].includes(
props.conversationInboxType
);
});
const useCopilotResponse = () => {
if (insertIntoRichEditor.value) {
emitter.emit(BUS_EVENTS.INSERT_INTO_RICH_EDITOR, props.message?.content);
} else {
emitter.emit(BUS_EVENTS.INSERT_INTO_NORMAL_EDITOR, props.message?.content);
}
};
</script>
<template>
@@ -22,6 +46,15 @@ defineProps({
<div class="break-words">
{{ message.content }}
</div>
<div class="flex flex-row mt-1">
<Button
:label="$t('CAPTAIN.COPILOT.USE')"
faded
sm
slate
@click="useCopilotResponse"
/>
</div>
</div>
</div>
</template>