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:
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user