feat: change max token handling

This commit is contained in:
2025-11-13 11:51:12 +01:00
parent b7e4c8d6ac
commit e88ac7caff
8 changed files with 255 additions and 91 deletions

View File

@@ -51,8 +51,8 @@ type LoggingConfig struct {
}
type ProcessingConfig struct {
MaxEmailSizeBytes int `yaml:"max_email_size_bytes"` // Maximum email body size in bytes (0 = no limit)
SkipJunkEmails bool `yaml:"skip_junk_emails"` // Skip emails marked as junk/spam
MaxTokens int `yaml:"max_tokens"` // Maximum total tokens for API request (0 = no limit)
SkipJunkEmails bool `yaml:"skip_junk_emails"` // Skip emails marked as junk/spam
}
func readFileContent(path string) (string, error) {
@@ -112,21 +112,21 @@ func Load(path string) (*Config, error) {
}
logger.WithFields(logrus.Fields{
"imapServer": config.IMAP.Server,
"imapPort": config.IMAP.Port,
"imapUsername": config.IMAP.Username,
"imapMailboxIn": config.IMAP.MailboxIn,
"imapDraftBox": config.IMAP.DraftBox,
"imapUseTLS": config.IMAP.UseTLS,
"aiModel": config.AI.Model,
"aiTemperature": config.AI.Temperature,
"aiMaxTokens": config.AI.MaxTokens,
"contextUrlCount": len(config.Context.URLs),
"pollingInterval": config.Polling.Interval,
"loggingLevel": config.Logging.Level,
"loggingFilePath": config.Logging.FilePath,
"maxEmailSizeBytes": config.Processing.MaxEmailSizeBytes,
"skipJunkEmails": config.Processing.SkipJunkEmails,
"imapServer": config.IMAP.Server,
"imapPort": config.IMAP.Port,
"imapUsername": config.IMAP.Username,
"imapMailboxIn": config.IMAP.MailboxIn,
"imapDraftBox": config.IMAP.DraftBox,
"imapUseTLS": config.IMAP.UseTLS,
"aiModel": config.AI.Model,
"aiTemperature": config.AI.Temperature,
"aiMaxTokens": config.AI.MaxTokens,
"contextUrlCount": len(config.Context.URLs),
"pollingInterval": config.Polling.Interval,
"loggingLevel": config.Logging.Level,
"loggingFilePath": config.Logging.FilePath,
"maxTokens": config.Processing.MaxTokens,
"skipJunkEmails": config.Processing.SkipJunkEmails,
}).Debug("Configuration loaded successfully")
return &config, nil