mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-03 12:37:56 +00:00
Migration Guide: https://chwt.app/v4/migration This PR imports all the work related to Captain into the EE codebase. Captain represents the AI-based features in Chatwoot and includes the following key components: - Assistant: An assistant has a persona, the product it would be trained on. At the moment, the data at which it is trained is from websites. Future integrations on Notion documents, PDF etc. This PR enables connecting an assistant to an inbox. The assistant would run the conversation every time before transferring it to an agent. - Copilot for Agents: When an agent is supporting a customer, we will be able to offer additional help to lookup some data or fetch information from integrations etc via copilot. - Conversation FAQ generator: When a conversation is resolved, the Captain integration would identify questions which were not in the knowledge base. - CRM memory: Learns from the conversations and identifies important information about the contact. --------- Co-authored-by: Vishnu Narayanan <vishnu@chatwoot.com> Co-authored-by: Sojan <sojan@pepalo.com> Co-authored-by: iamsivin <iamsivin@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
88 lines
2.0 KiB
Vue
88 lines
2.0 KiB
Vue
<script setup>
|
|
import { ref, computed } from 'vue';
|
|
import { useStore } from 'dashboard/composables/store';
|
|
import { useAlert } from 'dashboard/composables';
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
import Dialog from 'dashboard/components-next/dialog/Dialog.vue';
|
|
import AssistantForm from './AssistantForm.vue';
|
|
|
|
const props = defineProps({
|
|
selectedAssistant: {
|
|
type: Object,
|
|
default: () => ({}),
|
|
},
|
|
type: {
|
|
type: String,
|
|
default: 'create',
|
|
validator: value => ['create', 'edit'].includes(value),
|
|
},
|
|
});
|
|
const emit = defineEmits(['close']);
|
|
const { t } = useI18n();
|
|
const store = useStore();
|
|
|
|
const dialogRef = ref(null);
|
|
const assistantForm = ref(null);
|
|
|
|
const updateAssistant = assistantDetails =>
|
|
store.dispatch('captainAssistants/update', {
|
|
id: props.selectedAssistant.id,
|
|
...assistantDetails,
|
|
});
|
|
|
|
const i18nKey = computed(
|
|
() => `CAPTAIN.ASSISTANTS.${props.type.toUpperCase()}`
|
|
);
|
|
|
|
const createAssistant = assistantDetails =>
|
|
store.dispatch('captainAssistants/create', assistantDetails);
|
|
|
|
const handleSubmit = async updatedAssistant => {
|
|
try {
|
|
if (props.type === 'edit') {
|
|
await updateAssistant(updatedAssistant);
|
|
} else {
|
|
await createAssistant(updatedAssistant);
|
|
}
|
|
useAlert(t(`${i18nKey.value}.SUCCESS_MESSAGE`));
|
|
dialogRef.value.close();
|
|
} catch (error) {
|
|
const errorMessage = error?.message || t(`${i18nKey.value}.ERROR_MESSAGE`);
|
|
useAlert(errorMessage);
|
|
}
|
|
};
|
|
|
|
const handleClose = () => {
|
|
emit('close');
|
|
};
|
|
|
|
const handleCancel = () => {
|
|
dialogRef.value.close();
|
|
};
|
|
|
|
defineExpose({ dialogRef });
|
|
</script>
|
|
|
|
<template>
|
|
<Dialog
|
|
ref="dialogRef"
|
|
type="edit"
|
|
:title="t(`${i18nKey}.TITLE`)"
|
|
:description="t('CAPTAIN.ASSISTANTS.FORM_DESCRIPTION')"
|
|
:show-cancel-button="false"
|
|
:show-confirm-button="false"
|
|
overflow-y-auto
|
|
@close="handleClose"
|
|
>
|
|
<AssistantForm
|
|
ref="assistantForm"
|
|
:mode="type"
|
|
:assistant="selectedAssistant"
|
|
@submit="handleSubmit"
|
|
@cancel="handleCancel"
|
|
/>
|
|
<template #footer />
|
|
</Dialog>
|
|
</template>
|