summaryrefslogtreecommitdiff
path: root/doConnect.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-03 01:19:37 -0500
committerJeff Carr <[email protected]>2025-09-03 01:19:37 -0500
commitf5b513fa05ddbaaa2149cf0527ae1206e653266b (patch)
tree5e3776433b90c16e6cf30acb4468af712c5712da /doConnect.go
parent785591ab4cb3026ff069271b6f322a2e6f13eec8 (diff)
buttons for different stuffv0.0.6
Diffstat (limited to 'doConnect.go')
-rw-r--r--doConnect.go15
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}}