diff options
Diffstat (limited to 'doConnect.go')
| -rw-r--r-- | doConnect.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/doConnect.go b/doConnect.go index 4082aa6..03e9dc9 100644 --- a/doConnect.go +++ b/doConnect.go @@ -10,8 +10,11 @@ import ( "google.golang.org/genai" ) -// doConnect initializes the Gemini client and handles the request flow. -func doConnect() error { +func initGeminiAPI() error { + if me.ctx != nil { + // already initialized + return nil + } apiKey := os.Getenv("GEMINI_API_KEY") if apiKey == "" { return log.Errorf("GEMINI_API_KEY environment variable not set") @@ -23,6 +26,12 @@ func doConnect() error { if err != nil { return log.Errorf("failed to create new genai client: %w", err) } + return nil +} + +// doConnect initializes the Gemini client and handles the request flow. +func doConnect() error { + initGeminiAPI() if me.lastChat == nil { log.Info("WTF. lastChat is nil") @@ -105,7 +114,7 @@ func simpleHello() error { // Create the parts slice parts := []*genai.Part{ - {Text: "hello, how are you"}, + {Text: "What is my brothers name?"}, } content := []*genai.Content{{Parts: parts}} |
