feat(chat_pipeline): enhance query handling with image and attachment metadata

- Updated the query content to include metadata for uploaded images and attachments, improving the context provided to the assistant.
- Modified the attachment prompt format to use XML-like tags for better structure and readability, including metadata for file type and size.
- Enhanced error handling for unsupported file content extraction, providing clearer feedback to users.

This update improves the assistant's ability to process and respond to queries involving multimedia content.
This commit is contained in:
wizardchen
2026-04-14 17:58:43 +08:00
committed by lyingbug
parent 5a2f9f6a44
commit bf3e913398
2 changed files with 22 additions and 9 deletions
@@ -3,6 +3,7 @@ package chatpipeline
import (
"context"
"encoding/json"
"fmt"
"regexp"
"strings"
"time"
@@ -317,9 +318,17 @@ func (p *PluginQueryUnderstand) buildPrompts(chatManage *types.ChatManage, histo
conversationText := formatConversationHistory(historyList)
queryContent := chatManage.Query
if len(chatManage.Images) > 0 {
queryContent += fmt.Sprintf("\n\n<images_uploaded count=\"%d\" />", len(chatManage.Images))
}
if len(chatManage.Attachments) > 0 {
queryContent += chatManage.Attachments.BuildPrompt()
}
vals := types.PlaceholderValues{
"conversation": conversationText,
"query": chatManage.Query,
"query": queryContent,
"language": chatManage.Language,
}