Skip to content

Commit

Permalink
chat: smoother non-pdf files (fixes #7580) (#7581)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
Mutugiii and dogi authored Sep 30, 2024
1 parent 3e5ae00 commit b46d6b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions chatapi/src/utils/chat-helpers.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ export async function aiChatNonStream(
const typedAttachment = attachment as Attachment;
const contentType = typedAttachment.content_type;

const file = await fetchFileFromCouchDB(context.resource.id, attachmentName);
const text = await extractTextFromDocument(file as Buffer, contentType);
context.data += text;
if (contentType === 'application/pdf') {
const file = await fetchFileFromCouchDB(context.resource.id, attachmentName);
const text = await extractTextFromDocument(file as Buffer, contentType);
context.data += text;
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "planet",
"license": "AGPL-3.0",
"version": "0.14.80",
"version": "0.14.81",
"myplanet": {
"latest": "v0.19.65",
"min": "v0.18.65"
"latest": "v0.19.69",
"min": "v0.18.69"
},
"scripts": {
"ng": "ng",
Expand Down

0 comments on commit b46d6b4

Please sign in to comment.