feat: enhance multimodal support and image handling

- Updated configuration to improve handling of multimodal queries, including clearer guidelines for when to use [NO_SEARCH] in responses.
- Enhanced the user interface to include dedicated sections for multimodal configuration, allowing users to manage image uploads and related settings more effectively.
- Added localization support for new multimodal features in both English and Chinese, improving accessibility for a broader audience.
- Implemented backend changes to support image analysis and extraction of OCR text, enriching the interaction experience for users.

These enhancements significantly improve the application's capability to process and respond to multimodal queries, fostering a more interactive and user-friendly environment.
This commit is contained in:
wizardchen
2026-03-11 21:16:23 +08:00
parent 3a197f3333
commit bc2cb96d70
20 changed files with 467 additions and 247 deletions
+13 -1
View File
@@ -1231,6 +1231,9 @@ func (s *knowledgeBaseService) processSearchResults(ctx context.Context,
// Build final search results - preserve original order from input chunks
var searchResults []*types.SearchResult
addedChunkIDs := make(map[string]bool)
const maxInvalidChunkLog = 8
invalidChunkCnt := 0
invalidChunkSamples := make([]string, 0, maxInvalidChunkLog)
// First pass: Add results in the original order from input chunks
for _, inputChunk := range chunks {
@@ -1240,7 +1243,10 @@ func (s *knowledgeBaseService) processSearchResults(ctx context.Context,
continue
}
if !s.isValidTextChunk(chunk) {
logger.Debugf(ctx, "Chunk is not valid text chunk: %s, type: %s", chunk.ID, chunk.ChunkType)
invalidChunkCnt++
if len(invalidChunkSamples) < maxInvalidChunkLog {
invalidChunkSamples = append(invalidChunkSamples, chunk.ID+":"+chunk.ChunkType)
}
continue
}
if addedChunkIDs[chunk.ID] {
@@ -1257,6 +1263,12 @@ func (s *knowledgeBaseService) processSearchResults(ctx context.Context,
logger.Warnf(ctx, "Knowledge not found for chunk: %s, knowledge_id: %s", chunk.ID, chunk.KnowledgeID)
}
}
if invalidChunkCnt > 0 {
logger.Debugf(ctx,
"Skip non-text chunks in search results: total=%d sampled=%d samples=%v",
invalidChunkCnt, len(invalidChunkSamples), invalidChunkSamples,
)
}
// Second pass: Add additional chunks (parent, nearby, relation) that weren't in original input
if !skipEnrichment {