diff --git a/connectors/src/lib/data_sources.ts b/connectors/src/lib/data_sources.ts index 4ae838605d35..203b029c36ba 100644 --- a/connectors/src/lib/data_sources.ts +++ b/connectors/src/lib/data_sources.ts @@ -153,7 +153,7 @@ async function _upsertToDatasource({ title, mime_type: mimeType, tags: tags?.map((tag) => tag.substring(0, 512)), - parentId: null, + parent_id: null, parents, light_document_output: true, upsert_context: upsertContext, diff --git a/front/components/data_source/DocumentUploadOrEditModal.tsx b/front/components/data_source/DocumentUploadOrEditModal.tsx index 67c48bc4a780..24e3f4b8d2f3 100644 --- a/front/components/data_source/DocumentUploadOrEditModal.tsx +++ b/front/components/data_source/DocumentUploadOrEditModal.tsx @@ -140,7 +140,7 @@ export const DocumentUploadOrEditModal = ({ title: initialId ?? document.name, mime_type: document.mimeType ?? undefined, timestamp: null, - parentId: null, + parent_id: null, parents: [initialId ?? document.name], section: { prefix: null, content: document.text, sections: [] }, text: null, diff --git a/front/components/data_source/MultipleDocumentsUpload.tsx b/front/components/data_source/MultipleDocumentsUpload.tsx index 97c10e481a8d..ccfe67e0ae9a 100644 --- a/front/components/data_source/MultipleDocumentsUpload.tsx +++ b/front/components/data_source/MultipleDocumentsUpload.tsx @@ -144,7 +144,7 @@ export const MultipleDocumentsUpload = ({ title: blob.filename, mime_type: blob.contentType ?? undefined, timestamp: null, - parentId: null, + parent_id: null, parents: [blob.filename], section: { prefix: null, diff --git a/front/lib/api/data_sources.ts b/front/lib/api/data_sources.ts index a9445f6834f9..499bcda32af4 100644 --- a/front/lib/api/data_sources.ts +++ b/front/lib/api/data_sources.ts @@ -228,7 +228,7 @@ export async function upsertDocument({ text, section, tags, - parentId, + parent_id, parents, timestamp, light_document_output, @@ -242,7 +242,7 @@ export async function upsertDocument({ text?: string | null; section?: FrontDataSourceDocumentSectionType | null; tags?: string[] | null; - parentId?: string | null; + parent_id?: string | null; parents?: string[] | null; timestamp?: number | null; light_document_output?: boolean; @@ -387,7 +387,7 @@ export async function upsertDocument({ dataSourceId: dataSource.dustAPIDataSourceId, documentId: documentId, tags: nonNullTags, - parentId: parentId ?? null, + parentId: parent_id ?? null, parents: documentParents, sourceUrl, // TEMPORARY -- need to unstuck a specific entry diff --git a/front/pages/api/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/[documentId]/index.ts b/front/pages/api/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/[documentId]/index.ts index 629509dbc9dc..794879a4c92e 100644 --- a/front/pages/api/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/[documentId]/index.ts +++ b/front/pages/api/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/[documentId]/index.ts @@ -105,9 +105,31 @@ async function handler( }); } + const { + source_url, + text, + section, + tags, + parent_id, + parents, + timestamp, + light_document_output, + mime_type, + title, + } = bodyValidation.right; + const upsertResult = await upsertDocument({ name: documentId, - ...bodyValidation.right, + source_url, + text, + section, + tags, + parent_id, + parents, + timestamp, + light_document_output, + mime_type, + title, dataSource, auth, }); diff --git a/front/pages/api/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/index.ts b/front/pages/api/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/index.ts index bad4ebd59ff8..ee58775b331d 100644 --- a/front/pages/api/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/index.ts +++ b/front/pages/api/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/documents/index.ts @@ -96,8 +96,32 @@ async function handler( }); } + const { + name, + source_url, + text, + section, + tags, + parent_id, + parents, + timestamp, + light_document_output, + mime_type, + title, + } = bodyValidation.right; + const upsertResult = await upsertDocument({ - ...bodyValidation.right, + name, + source_url, + text, + section, + tags, + parent_id, + parents, + timestamp, + light_document_output, + mime_type, + title, dataSource, auth, }); diff --git a/types/src/front/api_handlers/public/data_sources.ts b/types/src/front/api_handlers/public/data_sources.ts index 98f9816fd416..aae9fc0c2589 100644 --- a/types/src/front/api_handlers/public/data_sources.ts +++ b/types/src/front/api_handlers/public/data_sources.ts @@ -31,7 +31,7 @@ export const PostDataSourceDocumentRequestBodySchema = t.intersection([ t.type({ timestamp: t.union([t.Int, t.undefined, t.null]), tags: t.union([t.array(t.string), t.undefined, t.null]), - parentId: t.union([t.string, t.undefined, t.null]), + parent_id: t.union([t.string, t.undefined, t.null]), parents: t.union([t.array(t.string), t.undefined, t.null]), source_url: t.union([t.string, t.undefined, t.null]), upsert_context: t.union([UpsertContextSchema, t.undefined, t.null]),