fix: pptx/ppt attachment parsing fails — missing parser engine + markitdown extras (#2621)

main
Xi(Darcy) Chen 2026-08-09 01:23:36 -07:00 committed by GitHub
parent d823ef61ae
commit 090612da54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 32 additions and 4 deletions

View File

@ -134,6 +134,8 @@ def _build_default_registry() -> ParserEngineRegistry:
"markdown": MarkdownParser,
"xlsx": ExcelParser,
"xls": ExcelParser,
"pptx": MarkitdownParser,
"ppt": MarkitdownParser,
"epub": EPUBParser,
"html": HTMLParser,
"htm": HTMLParser,

View File

@ -12,7 +12,7 @@ dependencies = [
"grpcio-tools>=1.78.0",
"lxml>=6.1.0",
"markdownify>=0.13.1",
"markitdown[docx,pdf,xls,xlsx]>=0.1.3",
"markitdown[docx,pdf,xls,xlsx,pptx]>=0.1.3",
"opendataloader-pdf>=2.4.7",
"openpyxl>=3.1.0",
"pandas>=2.0.0",

View File

@ -458,7 +458,7 @@ dependencies = [
{ name = "grpcio-tools" },
{ name = "lxml" },
{ name = "markdownify" },
{ name = "markitdown", extra = ["docx", "pdf", "xls", "xlsx"] },
{ name = "markitdown", extra = ["docx", "pdf", "pptx", "xls", "xlsx"] },
{ name = "opendataloader-pdf" },
{ name = "openpyxl" },
{ name = "pandas" },
@ -484,7 +484,7 @@ requires-dist = [
{ name = "grpcio-tools", specifier = ">=1.78.0" },
{ name = "lxml", specifier = ">=6.1.0" },
{ name = "markdownify", specifier = ">=0.13.1" },
{ name = "markitdown", extras = ["docx", "pdf", "xls", "xlsx"], specifier = ">=0.1.3" },
{ name = "markitdown", extras = ["docx", "pdf", "xls", "xlsx", "pptx"], specifier = ">=0.1.3" },
{ name = "opendataloader-pdf", specifier = ">=2.4.7" },
{ name = "openpyxl", specifier = ">=3.1.0" },
{ name = "pandas", specifier = ">=2.0.0" },
@ -994,6 +994,9 @@ docx = [
pdf = [
{ name = "pdfminer-six" },
]
pptx = [
{ name = "python-pptx" },
]
xls = [
{ name = "pandas" },
{ name = "xlrd" },

View File

@ -235,13 +235,21 @@ func (p *AttachmentProcessor) processWithDocumentReader(
if p.documentReader == nil {
return fmt.Errorf("DocumentReader not configured")
}
normalizedType := strings.TrimPrefix(fileType, ".")
parserEngine := ""
if v := ctx.Value(types.ChatParserEngineContextKey); v != nil {
if s, ok := v.(string); ok {
parserEngine = s
}
}
result, err := p.documentReader.Read(ctx, &types.ReadRequest{
FileContent: data,
FileName: fileName,
FileType: normalizedType,
ParserEngine: parserEngine,
ParserEngineOverrides: getParserEngineOverridesFromContext(ctx),
})
if err != nil {

View File

@ -7,6 +7,7 @@ import (
"fmt"
"net/http"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
@ -235,6 +236,17 @@ func (h *Handler) parseQARequest(c *gin.Context, logPrefix string) (*qaRequestCo
asrModelID = customAgent.Config.ASRModelID
}
// Resolve the agent's chat parser engine from attachment file types
if customAgent != nil {
for _, att := range request.AttachmentUploads {
ext := strings.ToLower(filepath.Ext(att.FileName))
if engine := customAgent.Config.ResolveChatParserEngine(ext); engine != "" {
attachmentRuntimeCtx = context.WithValue(attachmentRuntimeCtx, types.ChatParserEngineContextKey, engine)
break
}
}
}
// Process all attachments concurrently.
processedAttachments = make(types.MessageAttachments, len(request.AttachmentUploads))
var wg sync.WaitGroup

View File

@ -61,6 +61,9 @@ const (
// the agent emits a one-shot authorization notice and continues instead of
// blocking until the OAuth wait times out. See IsMCPOAuthNonInteractive.
MCPOAuthNonInteractiveContextKey ContextKey = "MCPOAuthNonInteractive"
// ChatParserEngineContextKey carries the resolved parser engine
// from the agent's ChatParserEngineRules for chat attachment processing.
ChatParserEngineContextKey ContextKey = "ChatParserEngine"
)
// String returns the string representation of the context key