Merge pull request #935 from MaoMengww/feat/attachment_support

feat: attachment_support
This commit is contained in:
lyingbug
2026-04-14 17:35:31 +08:00
committed by GitHub
26 changed files with 1080 additions and 19 deletions
@@ -95,6 +95,10 @@ func (p *PluginIntoChatMessage) OnEvent(ctx context.Context,
if chatManage.QuotedContext != "" {
userContent += "\n\n" + chatManage.QuotedContext
}
// Inject attachment content (documents, audio transcripts, etc.)
if len(chatManage.Attachments) > 0 {
userContent += chatManage.Attachments.BuildPrompt()
}
if tpl := chatManage.SummaryConfig.ContextTemplate; tpl != "" {
chatManage.UserContent = types.RenderPromptPlaceholders(tpl, types.PlaceholderValues{
@@ -180,6 +184,10 @@ func (p *PluginIntoChatMessage) OnEvent(ctx context.Context,
if chatManage.QuotedContext != "" {
userContent += "\n\n" + chatManage.QuotedContext
}
// Inject attachment content (documents, audio transcripts, etc.)
if len(chatManage.Attachments) > 0 {
userContent += chatManage.Attachments.BuildPrompt()
}
// Set formatted content back to chat management
chatManage.UserContent = userContent
@@ -122,6 +122,7 @@ func (s *sessionService) KnowledgeQA(
Images: req.ImageURLs,
VLMModelID: vlmModelID,
ChatModelSupportsVision: chatModelSupportsVision,
Attachments: req.Attachments,
Language: types.LanguageNameFromContext(ctx),
},
PipelineState: types.PipelineState{
@@ -155,6 +156,10 @@ func (s *sessionService) KnowledgeQA(
if req.QuotedContext != "" {
userContent += "\n\n" + req.QuotedContext
}
// Inject attachment content for pure-chat path (RAG path handles this in INTO_CHAT_MESSAGE).
if len(req.Attachments) > 0 {
userContent += req.Attachments.BuildPrompt()
}
chatManage.UserContent = userContent
pipeline = types.NewPipelineBuilder().