MCPcopy Index your code
hub / github.com/simstudioai/sim / inferDocumentFileInfo

Function inferDocumentFileInfo

apps/sim/tools/knowledge/types.ts:21–34  ·  view source on GitHub ↗
(documentName: string)

Source from the content-addressed store, hash-verified

19 * Otherwise, the filename is normalized to `.txt` with `text/plain`.
20 */
21export function inferDocumentFileInfo(documentName: string): {
22 filename: string
23 mimeType: string
24} {
25 const ext = getFileExtension(documentName)
26 if (ext) {
27 const mimeType = getUploadMimeType(ext)
28 if (TEXT_COMPATIBLE_MIME_TYPES.has(mimeType)) {
29 return { filename: documentName, mimeType }
30 }
31 }
32 const base = ext ? documentName.slice(0, documentName.lastIndexOf('.')) : documentName
33 return { filename: `${base || documentName}.txt`, mimeType: 'text/plain' }
34}
35
36interface KnowledgeSearchResult {
37 documentId: string

Callers 2

create_document.tsFile · 0.90
upsert_document.tsFile · 0.90

Calls 1

getFileExtensionFunction · 0.90

Tested by

no test coverage detected