Refactored orchestrator for staged file handling, added structured prompt support, adjusted Feishu file handling

This commit is contained in:
whlaoding
2026-03-08 22:38:29 +08:00
parent e2f806edb3
commit 52b8dbb835
30 changed files with 9325 additions and 34 deletions

View File

@@ -177,6 +177,24 @@ func runMessageChannel(ctx context.Context, cfg config.Config, engine *agent.Orc
}
lg.Infof("starting feishu transport")
return fs.Run(ctx, func(ctx context.Context, msg feishu.IncomingMessage) (string, error) {
if msg.MsgType == "file" && len(msg.FileBytes) > 0 {
content := msg.FileBytes
if msg.FilePath != "" {
if b, err := os.ReadFile(msg.FilePath); err == nil && len(b) > 0 {
content = b
} else if lg != nil {
lg.Warnf("read local file failed path=%s err=%v; fallback to in-memory bytes", msg.FilePath, err)
}
}
files := []llm.InputFile{{
FileName: msg.FileName,
MimeType: msg.FileMime,
Content: content,
}}
// Feishu file event and user question are split into separate messages.
// Use empty text so file IDs are cached and consumed by the next text query.
return engine.HandleMessageWithFiles(ctx, msg.ChatID, msg.UserID, "", files)
}
return engine.HandleMessage(ctx, msg.ChatID, msg.UserID, msg.Text)
})
default: