mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-30 18:47:51 +00:00 
			
		
		
		
	 2f3b4ad215
			
		
	
	2f3b4ad215
	
	
	
		
			
			Linked PR https://github.com/chatwoot/chatwoot/pull/12113 ## Linear Link https://linear.app/chatwoot/issue/CW-4515/upload-pdfs-to-captain ## Description This PR adds support for PDF file uploads to the Captain document knowledge base system. The feature enables users to upload PDF files directly to the knowledge base for FAQ generation and document processing, expanding beyond the existing URL-based document ingestion. ## Type of change - [ ] New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Unit Tests - Manually via UI ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged and published in downstream modules --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: iamsivin <iamsivin@gmail.com>
		
			
				
	
	
		
			55 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <script setup>
 | |
| import { ref } from 'vue';
 | |
| import { useStore } from 'dashboard/composables/store';
 | |
| import { useAlert } from 'dashboard/composables';
 | |
| import { useI18n } from 'vue-i18n';
 | |
| import { parseAPIErrorResponse } from 'dashboard/store/utils/api';
 | |
| 
 | |
| import Dialog from 'dashboard/components-next/dialog/Dialog.vue';
 | |
| import DocumentForm from './DocumentForm.vue';
 | |
| 
 | |
| const emit = defineEmits(['close']);
 | |
| const { t } = useI18n();
 | |
| const store = useStore();
 | |
| 
 | |
| const dialogRef = ref(null);
 | |
| 
 | |
| const i18nKey = 'CAPTAIN.DOCUMENTS.CREATE';
 | |
| 
 | |
| const handleSubmit = async newDocument => {
 | |
|   try {
 | |
|     await store.dispatch('captainDocuments/create', newDocument);
 | |
|     useAlert(t(`${i18nKey}.SUCCESS_MESSAGE`));
 | |
|     dialogRef.value.close();
 | |
|   } catch (error) {
 | |
|     const errorMessage =
 | |
|       parseAPIErrorResponse(error) || t(`${i18nKey}.ERROR_MESSAGE`);
 | |
|     useAlert(errorMessage);
 | |
|   }
 | |
| };
 | |
| 
 | |
| const handleClose = () => {
 | |
|   emit('close');
 | |
| };
 | |
| 
 | |
| const handleCancel = () => {
 | |
|   dialogRef.value.close();
 | |
| };
 | |
| 
 | |
| defineExpose({ dialogRef });
 | |
| </script>
 | |
| 
 | |
| <template>
 | |
|   <Dialog
 | |
|     ref="dialogRef"
 | |
|     :title="$t(`${i18nKey}.TITLE`)"
 | |
|     :description="$t('CAPTAIN.DOCUMENTS.FORM_DESCRIPTION')"
 | |
|     :show-cancel-button="false"
 | |
|     :show-confirm-button="false"
 | |
|     @close="handleClose"
 | |
|   >
 | |
|     <DocumentForm @submit="handleSubmit" @cancel="handleCancel" />
 | |
|     <template #footer />
 | |
|   </Dialog>
 | |
| </template>
 |