feat(knowledge): resolve remote images in file upload path
The file upload pipeline (ProcessDocument) only called ResolveAndStore(), which handles inline bytes and base64 data URIs but explicitly skips http/https URLs. This meant markdown files with external image URLs (e.g. GitHub issue screenshots) were never downloaded, stored, or processed by VLM multimodal. Add ResolveRemoteImages() call after ResolveAndStore() in the file upload path, matching the existing manual processing path behavior.main
parent
5c0cda3630
commit
5df0ea2de2
|
|
@ -7576,7 +7576,20 @@ func (s *knowledgeService) ProcessDocument(ctx context.Context, t *asynq.Task) e
|
|||
convertResult.MarkdownContent = updatedMarkdown
|
||||
}
|
||||
storedImages = images
|
||||
logger.Infof(ctx, "Resolved %d images for knowledge %s", len(storedImages), knowledge.ID)
|
||||
|
||||
// Resolve remote http(s) images (e.g. markdown external URLs) → download + upload to storage.
|
||||
// ResolveAndStore handles inline bytes and base64; ResolveRemoteImages handles http/https URLs.
|
||||
updatedContent, remoteImages, remoteErr := s.imageResolver.ResolveRemoteImages(ctx, convertResult.MarkdownContent, fileSvc, tenantID)
|
||||
if remoteErr != nil {
|
||||
logger.Warnf(ctx, "Remote image resolution partially failed: %v", remoteErr)
|
||||
}
|
||||
if len(remoteImages) > 0 {
|
||||
logger.Infof(ctx, "Resolved %d remote images for knowledge %s", len(remoteImages), knowledge.ID)
|
||||
convertResult.MarkdownContent = updatedContent
|
||||
storedImages = append(storedImages, remoteImages...)
|
||||
}
|
||||
|
||||
logger.Infof(ctx, "Resolved %d total images for knowledge %s", len(storedImages), knowledge.ID)
|
||||
}
|
||||
|
||||
// Step 3: Split into chunks using Go chunker
|
||||
|
|
|
|||
Loading…
Reference in New Issue