diff --git a/app/javascript/dashboard/api/helpCenter/pdfDocuments.js b/app/javascript/dashboard/api/helpCenter/pdfDocuments.js
deleted file mode 100644
index 876678edf..000000000
--- a/app/javascript/dashboard/api/helpCenter/pdfDocuments.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/* global axios */
-import ApiClient from '../ApiClient';
-
-class PdfDocumentsAPI extends ApiClient {
- constructor() {
- super('portals', { accountScoped: true });
- }
-
- uploadContent(portalSlug, formData) {
- return axios.post(`${this.url}/${portalSlug}/upload_content`, formData, {
- headers: {
- 'Content-Type': 'multipart/form-data',
- },
- });
- }
-
- getGeneratedContent(portalSlug) {
- return axios.get(`${this.url}/${portalSlug}/generated_content`);
- }
-
- publishContent(portalSlug, responseIds, categoryId = null) {
- return axios.post(`${this.url}/${portalSlug}/publish_content`, {
- response_ids: responseIds,
- category_id: categoryId
- });
- }
-}
-
-export default PdfDocumentsAPI;
\ No newline at end of file
diff --git a/app/javascript/dashboard/components-next/HelpCenter/Pages/PdfDocumentsPage/ContentGeneration.vue b/app/javascript/dashboard/components-next/HelpCenter/Pages/PdfDocumentsPage/ContentGeneration.vue
deleted file mode 100644
index 028bf090b..000000000
--- a/app/javascript/dashboard/components-next/HelpCenter/Pages/PdfDocumentsPage/ContentGeneration.vue
+++ /dev/null
@@ -1,284 +0,0 @@
-
-
-
-
- {{ $t('HELP_CENTER.CONTENT_GENERATION.TITLE') }}
-
-
- {{ $t('HELP_CENTER.CONTENT_GENERATION.DESCRIPTION') }}
-
-
-
-
-
-
- {{ $t('HELP_CENTER.CONTENT_GENERATION.UPLOAD_TITLE') }}
-
-
-
-
-
-
- {{ $t('HELP_CENTER.CONTENT_GENERATION.DRAG_DROP') }}
-
-
-
-
-
-
-
-
{{ $t('HELP_CENTER.CONTENT_GENERATION.UPLOADING') }}
-
-
-
-
-
{{ $t('HELP_CENTER.CONTENT_GENERATION.UPLOAD_SUCCESS') }}
-
-
-
-
-
-
-
-
-
-
- {{ $t('HELP_CENTER.CONTENT_GENERATION.GENERATED_CONTENT') }}
-
-
-
-
-
-
-
-
-
-
- {{ response.question }}
-
-
- {{ response.answer }}
-
-
- {{ $t('HELP_CENTER.CONTENT_GENERATION.FROM_DOCUMENT') }}: {{ response.documentable?.name }}
-
-
-
-
-
-
-
-
-
-
-
- {{ $t('HELP_CENTER.CONTENT_GENERATION.NO_CONTENT') }}
-
-
-
-
-
-
-
{{ $t('HELP_CENTER.CONTENT_GENERATION.LOADING') }}
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/javascript/dashboard/components-next/HelpCenter/Pages/PdfDocumentsPage/PdfDocumentsPage.vue b/app/javascript/dashboard/components-next/HelpCenter/Pages/PdfDocumentsPage/PdfDocumentsPage.vue
deleted file mode 100644
index a10219513..000000000
--- a/app/javascript/dashboard/components-next/HelpCenter/Pages/PdfDocumentsPage/PdfDocumentsPage.vue
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
- {{ $t('HELP_CENTER.CONTENT_GENERATION.TITLE') }}
-
-
- {{ $t('HELP_CENTER.CONTENT_GENERATION.DESCRIPTION') }}
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/javascript/dashboard/components-next/captain/assistant/DocumentCard.vue b/app/javascript/dashboard/components-next/captain/assistant/DocumentCard.vue
index 94fdf6c64..a81324008 100644
--- a/app/javascript/dashboard/components-next/captain/assistant/DocumentCard.vue
+++ b/app/javascript/dashboard/components-next/captain/assistant/DocumentCard.vue
@@ -73,7 +73,9 @@ const displayLink = computed(() => {
}
return props.externalLink;
});
-const linkIcon = computed(() => isPdfDocument.value ? 'i-ph-file-pdf' : 'i-ph-link-simple');
+const linkIcon = computed(() =>
+ isPdfDocument.value ? 'i-ph-file-pdf' : 'i-ph-link-simple'
+);
const handleAction = ({ action, value }) => {
toggleDropdown(false);
diff --git a/app/javascript/dashboard/components-next/captain/pageComponents/document/CreateDocumentDialog.vue b/app/javascript/dashboard/components-next/captain/pageComponents/document/CreateDocumentDialog.vue
index fc7591966..1762f8df4 100644
--- a/app/javascript/dashboard/components-next/captain/pageComponents/document/CreateDocumentDialog.vue
+++ b/app/javascript/dashboard/components-next/captain/pageComponents/document/CreateDocumentDialog.vue
@@ -23,8 +23,8 @@ const handleSubmit = async newDocument => {
dialogRef.value.close();
} catch (error) {
const errorMessage =
- error?.response?.data?.message ||
- error?.response?.message ||
+ error?.response?.data?.message ||
+ error?.response?.message ||
t(`${i18nKey}.ERROR_MESSAGE`);
useAlert(errorMessage);
}
diff --git a/app/javascript/dashboard/components-next/captain/pageComponents/document/DocumentForm.vue b/app/javascript/dashboard/components-next/captain/pageComponents/document/DocumentForm.vue
index a191fc184..32efbaeac 100644
--- a/app/javascript/dashboard/components-next/captain/pageComponents/document/DocumentForm.vue
+++ b/app/javascript/dashboard/components-next/captain/pageComponents/document/DocumentForm.vue
@@ -2,7 +2,7 @@
import { reactive, computed, ref, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import { useVuelidate } from '@vuelidate/core';
-import { required, minLength, url, requiredIf } from '@vuelidate/validators';
+import { required, minLength, requiredIf } from '@vuelidate/validators';
import { useMapGetter } from 'dashboard/composables/store';
import { useAlert } from 'dashboard/composables';
@@ -31,14 +31,14 @@ const state = reactive({ ...initialState });
const fileInputRef = ref(null);
const validationRules = {
- url: {
- required: requiredIf(() => state.documentType === 'url'),
- url: requiredIf(() => state.documentType === 'url'),
- minLength: minLength(1)
+ url: {
+ required: requiredIf(() => state.documentType === 'url'),
+ url: requiredIf(() => state.documentType === 'url'),
+ minLength: minLength(1),
},
assistantId: { required },
- pdfFile: {
- required: requiredIf(() => state.documentType === 'pdf')
+ pdfFile: {
+ required: requiredIf(() => state.documentType === 'pdf'),
},
};
@@ -67,7 +67,7 @@ const formErrors = computed(() => ({
const handleCancel = () => emit('cancel');
-const handleFileChange = (event) => {
+const handleFileChange = event => {
const file = event.target.files[0];
if (file) {
if (file.type !== 'application/pdf') {
@@ -75,7 +75,8 @@ const handleFileChange = (event) => {
event.target.value = '';
return;
}
- if (file.size > 512 * 1024 * 1024) { // 512MB
+ if (file.size > 20 * 1024 * 1024) {
+ // 20MB
useAlert(t('CAPTAIN.DOCUMENTS.FORM.PDF_FILE.TOO_LARGE'));
event.target.value = '';
return;
@@ -97,16 +98,19 @@ const openFileDialog = () => {
const prepareDocumentDetails = () => {
const formData = new FormData();
formData.append('document[assistant_id]', state.assistantId);
-
+
if (state.documentType === 'url') {
formData.append('document[external_link]', state.url);
formData.append('document[name]', state.name || state.url);
} else {
formData.append('document[pdf_file]', state.pdfFile);
- formData.append('document[name]', state.name || state.pdfFile.name);
+ formData.append(
+ 'document[name]',
+ state.name || state.pdfFile.name.replace('.pdf', '')
+ );
// No need to send external_link for PDF - it's auto-generated in the backend
}
-
+
return formData;
};
@@ -129,22 +133,26 @@ const handleSubmit = async () => {