MCPcopy Create free account
hub / github.com/53AI/53AIHub / NewFileProcessor

Function NewFileProcessor

api/service/file_processor.go:42–61  ·  view source on GitHub ↗

NewFileProcessor 创建文件处理器

()

Source from the content-addressed store, hash-verified

40
41// NewFileProcessor 创建文件处理器
42func NewFileProcessor() *FileProcessor {
43 return &FileProcessor{
44 supportedFormats: []string{
45 ".txt", ".md", ".html", ".htm", // 现有格式
46 ".pdf", // PDF
47 ".ppt", ".pptx", // PowerPoint
48 ".doc", ".docx", // Word
49 ".xls", ".xlsx", // Excel
50 ".csv", ".json", ".xml", // Text-based formats
51 ".epub", // EPub
52 // 音频格式支持阿里云通义听悟API
53 ".mp3", ".wav", ".m4a", ".wma", ".aac", ".ogg", ".amr", ".flac", ".aiff",
54 // 视频格式也可以转音频
55 ".mp4", ".wmv", ".m4v", ".flv", ".rmvb", ".dat", ".mov", ".mkv", ".webm", ".avi", ".mpeg", ".3gp",
56 ".pcm", ".opus", ".speex", // 实时音频流格式
57 },
58 lightweightFormats: []string{".txt", ".md"}, // md, txt 文件不保存原始文件
59 heavyweightFormats: []string{".html", ".htm"}, // html 文件需要完整保护
60 }
61}
62
63// isLightweightFile 判断是否为轻量级文件
64func (fp *FileProcessor) isLightweightFile(filename string) bool {

Callers 3

CreateBatchMethod · 0.85
NewBatchUploadManagerFunction · 0.85
executeUploadMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected