diff --git a/internal/source/ai-brain/assistant.go b/internal/source/ai-brain/assistant.go index bce4f79..14ab463 100644 --- a/internal/source/ai-brain/assistant.go +++ b/internal/source/ai-brain/assistant.go @@ -118,7 +118,7 @@ func newAssistant(cfg *Config, log logrus.FieldLogger, out chan source.Event, ku return nil, fmt.Errorf("while creating Botkube runner: %w", err) } - config := openai.DefaultConfig("") + config := openai.DefaultConfig(cfg.OpenAIAPIToken) config.BaseURL = cfg.OpenAIBaseURL config.AssistantVersion = "v2" diff --git a/internal/source/ai-brain/config.go b/internal/source/ai-brain/config.go index 883a7df..0fdd401 100644 --- a/internal/source/ai-brain/config.go +++ b/internal/source/ai-brain/config.go @@ -17,7 +17,8 @@ const assistantID = "asst_eMM9QaWLi6cajHE4PdG1yU53" type Config struct { Log config.Logger `yaml:"log"` OpenAIBaseURL string `yaml:"openAIBaseURL"` - OpenAIAssistantID string `yaml:"openAIAssistantId"` + OpenAIAssistantID string `yaml:"openAIAssistantID"` + OpenAIAPIToken string `yaml:"openAIAPIToken"` HoneycombAPIKey string `yaml:"honeycombAPIKey"` HoneycombSampleRate int `yaml:"honeycombSampleRate"` VectorStoreIDForThread string `yaml:"vectorStoreIDForThread"` @@ -30,6 +31,9 @@ func (c *Config) Validate() error { if c.OpenAIAssistantID == "" { issues = multierror.Append(issues, errors.New("the Open AI Assistant ID cannot be empty")) } + if c.OpenAIAPIToken == "" { + issues = multierror.Append(issues, errors.New("the Open AI API token cannot be empty")) + } return issues.ErrorOrNil() }