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

@@ -36,6 +36,27 @@ type Config struct {
GuildID string `yaml:"guild_id"`
} `yaml:"discord"`
Email struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
User string `yaml:"user"`
Password string `yaml:"password"`
TLS bool `yaml:"tls"`
StartTLS bool `yaml:"starttls"`
Folder string `yaml:"folder"`
Model string `yaml:"model"` // Optional: überschreibt chat.model für Email-Zusammenfassungen
} `yaml:"email"`
Tasks struct {
StorePath string `yaml:"store_path"`
} `yaml:"tasks"`
Daemon struct {
ChannelID string `yaml:"channel_id"`
EmailIntervalMin int `yaml:"email_interval_min"`
TaskReminderHour int `yaml:"task_reminder_hour"`
} `yaml:"daemon"`
BrainRoot string `yaml:"brain_root"`
TopK uint64 `yaml:"top_k"`
ScoreThreshold float32 `yaml:"score_threshold"`
@@ -70,7 +91,7 @@ func NewChatClient() *openai.Client {
return openai.NewClientWithConfig(c)
}
// LoadConfig liest config.yml aus dem aktuellen Verzeichnis.
// LoadConfig liest config.yml aus dem aktuellen Verzeichnis und validiert Pflichtfelder.
func LoadConfig() {
data, err := os.ReadFile("config.yml")
if err != nil {
@@ -79,4 +100,34 @@ func LoadConfig() {
if err := yaml.Unmarshal(data, &Cfg); err != nil {
log.Fatalf("❌ config.yml ungültig: %v", err)
}
validateConfig()
}
// validateConfig prüft Pflichtfelder und gibt früh eine klare Fehlermeldung.
func validateConfig() {
var errs []string
if Cfg.Qdrant.Host == "" {
errs = append(errs, "qdrant.host fehlt")
}
if Cfg.Qdrant.Port == "" {
errs = append(errs, "qdrant.port fehlt")
}
if Cfg.Embedding.URL == "" {
errs = append(errs, "embedding.url fehlt")
}
if Cfg.Embedding.Model == "" {
errs = append(errs, "embedding.model fehlt")
}
if Cfg.Chat.URL == "" {
errs = append(errs, "chat.url fehlt")
}
if Cfg.Chat.Model == "" {
errs = append(errs, "chat.model fehlt")
}
if len(errs) > 0 {
for _, e := range errs {
log.Printf("❌ config.yml: %s", e)
}
log.Fatal("❌ Konfiguration unvollständig Bot wird nicht gestartet.")
}
}