Text Files As Prompts (#156)
* Add: .txt file reading * Update: version increment
This commit is contained in:
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user