Text Files As Prompts (#156)

* Add: .txt file reading

* Update: version increment
This commit is contained in:
Kevin Dang
2025-01-31 14:12:11 -08:00
committed by GitHub
parent 2ea77c92f0
commit 2a39e20fee
6 changed files with 26 additions and 10 deletions

View File

@@ -54,4 +54,13 @@ export async function getAttachmentData(attachment: Attachment | undefined): Pro
const buffer = await getAttachmentBuffer(url)
const base64String = arrayBufferToBase64(buffer)
return [base64String]
}
/**
* Method to retrieve the string data from the text file
*
* @param attachment the text file to convert to a string
*/
export async function getTextFileAttachmentData(attachment: Attachment): Promise<string> {
return await (await fetch(attachment.url)).text()
}