llm mail integration

This commit is contained in:
Christoph K.
2026-03-19 21:46:12 +01:00
parent fdc7a8588d
commit 0e7aa3e7f2
19 changed files with 1707 additions and 306 deletions

View File

@@ -0,0 +1,52 @@
// tool/agent.go Tool-Agent: Dispatcher für externe Tools (Email, ...)
package tool
import (
"fmt"
"my-brain-importer/internal/agents"
"my-brain-importer/internal/agents/tool/email"
)
// Agent verteilt Tool-Anfragen an spezialisierte Sub-Agenten.
type Agent struct{}
func New() *Agent { return &Agent{} }
// Handle unterstützt: email
func (a *Agent) Handle(req agents.Request) agents.Response {
switch req.Action {
case agents.ActionEmail:
return a.handleEmail(req)
default:
return agents.Response{Text: "❌ Unbekannte Tool-Aktion. Verfügbar: email"}
}
}
func (a *Agent) handleEmail(req agents.Request) agents.Response {
subAction := agents.ActionEmailSummary
if len(req.Args) > 0 {
subAction = req.Args[0]
}
var (
result string
err error
)
switch subAction {
case agents.ActionEmailSummary:
result, err = email.Summarize()
case agents.ActionEmailUnread:
result, err = email.SummarizeUnread()
case agents.ActionEmailRemind:
result, err = email.ExtractReminders()
default:
return agents.Response{Text: fmt.Sprintf("❌ Unbekannte Email-Aktion `%s`. Verfügbar: summary, unread, remind", subAction)}
}
if err != nil {
return agents.Response{Error: err, Text: fmt.Sprintf("❌ Email-Fehler: %v", err)}
}
return agents.Response{Text: "📧 **Email-Analyse:**\n\n" + result}
}