From acf1da48b9e9b62ae9ab587b80012984d8f5d04c Mon Sep 17 00:00:00 2001 From: nl_0 Date: Wed, 14 Aug 2024 17:33:48 +0200 Subject: [PATCH] preview: treat ipynb as text; dedupe object names --- .../components/Assistant/Model/GlobalContext/preview.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/catalog/app/components/Assistant/Model/GlobalContext/preview.ts b/catalog/app/components/Assistant/Model/GlobalContext/preview.ts index 539fc392a10..087f6c634b5 100644 --- a/catalog/app/components/Assistant/Model/GlobalContext/preview.ts +++ b/catalog/app/components/Assistant/Model/GlobalContext/preview.ts @@ -252,7 +252,9 @@ const getDocumentPreview = (handle: S3ObjectLocation, format: Content.DocumentFo return Content.text('Could not get object contents') } return Content.ToolResultContentBlock.Document({ - name: normalizeDocumentName(handle.key), + name: normalizeDocumentName( + `${handle.bucket} ${handle.key} ${handle.version || ''}`, + ), format, source: blob as $TSFixMe, }) @@ -430,5 +432,8 @@ const detectFileType = (key: string): FileType => { if (isText(key)) { return FileType.Document({ format: 'txt' }) } + if (ext === '.ipynb') { + return FileType.Document({ format: 'txt' }) + } return FileType.Unidentified() }