feat(image-multimodal): add task enqueuing for question generation based on image knowledge
- Introduced a new task enqueuer in the ImageMultimodalService to handle question generation for image knowledge. - Implemented logic to enqueue question generation tasks when valid captions or OCR content are available, enhancing the knowledge base's interactivity. - Updated image reference handling to ensure markdown URLs are correctly formatted, accommodating filenames with spaces. - Enhanced regex pattern in image resolver to support filenames with spaces, improving image processing accuracy.
This commit is contained in:
@@ -77,14 +77,16 @@ func imageToResult(fileName string, data []byte) *types.ReadResult {
|
||||
fileName = "image.png"
|
||||
}
|
||||
refPath := "images/" + fileName
|
||||
// Encode spaces so the markdown URL is valid and matches the regex in ResolveAndStore.
|
||||
safeRef := strings.ReplaceAll(refPath, " ", "%20")
|
||||
mime := http.DetectContentType(data)
|
||||
|
||||
return &types.ReadResult{
|
||||
MarkdownContent: fmt.Sprintf("", fileName, refPath),
|
||||
MarkdownContent: fmt.Sprintf("", fileName, safeRef),
|
||||
ImageRefs: []types.ImageRef{
|
||||
{
|
||||
Filename: fileName,
|
||||
OriginalRef: refPath,
|
||||
OriginalRef: safeRef,
|
||||
MimeType: mime,
|
||||
ImageData: data,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user