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
@@ -77,6 +77,30 @@ func (p *PluginIntoChatMessage) OnEvent(ctx context.Context,
// Prepare weekday names
weekdayName := []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
// Intent-based no-search path: bypass "reference materials" template entirely.
if chatManage.SkipKBSearch {
// Prefer rewritten query in no-search mode; fallback to original query.
userContent := safeQuery
if rewrite := strings.TrimSpace(chatManage.RewriteQuery); rewrite != "" {
if safeRewrite, ok := utils.ValidateInput(rewrite); ok {
userContent = safeRewrite
} else {
pipelineWarn(ctx, "IntoChatMessage", "invalid_rewrite_query_fallback", map[string]interface{}{
"session_id": chatManage.SessionID,
})
}
}
if chatManage.ImageOCRText != "" && !chatManage.ChatModelSupportsVision {
userContent += "\n\n[用户上传图片内容]\n" + chatManage.ImageOCRText
}
chatManage.UserContent = userContent
pipelineInfo(ctx, "IntoChatMessage", "skip_template_no_search", map[string]interface{}{
"session_id": chatManage.SessionID,
"user_content_len": len(chatManage.UserContent),
})
return next()
}
var contextsBuilder strings.Builder
// Build contexts string based on FAQ priority strategy