Bugfix/Upsert files extension to input field (#3288)

get upsert files extension to input field
This commit is contained in:
Henry Heng
2024-09-30 22:52:02 +01:00
committed by GitHub
parent 01ae2ac7c4
commit 04e8d02a99
3 changed files with 89 additions and 6 deletions
+29
View File
@@ -872,6 +872,35 @@ export const getVersion: () => Promise<{ version: string }> = async () => {
throw new Error('None of the package.json paths could be parsed')
}
/**
* Map Ext to InputField
* @param {string} ext
* @returns {string}
*/
export const mapExtToInputField = (ext: string) => {
switch (ext) {
case '.txt':
return 'txtFile'
case '.pdf':
return 'pdfFile'
case '.json':
return 'jsonFile'
case '.csv':
case '.xls':
case '.xlsx':
return 'csvFile'
case '.jsonl':
return 'jsonlinesFile'
case '.docx':
case '.doc':
return 'docxFile'
case '.yaml':
return 'yamlFile'
default:
return 'txtFile'
}
}
/**
* Map MimeType to InputField
* @param {string} mimeType