Skip to content

Commit

Permalink
fixes for parent_id
Browse files Browse the repository at this point in the history
  • Loading branch information
tdraier committed Dec 11, 2024
1 parent 6c39ed0 commit 58936b2
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 9 deletions.
2 changes: 1 addition & 1 deletion connectors/src/lib/data_sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion front/components/data_source/DocumentUploadOrEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion front/components/data_source/MultipleDocumentsUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions front/lib/api/data_sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export async function upsertDocument({
text,
section,
tags,
parentId,
parent_id,
parents,
timestamp,
light_document_output,
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
2 changes: 1 addition & 1 deletion types/src/front/api_handlers/public/data_sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand Down

0 comments on commit 58936b2

Please sign in to comment.