From 2f55ec27280dd12c8f51eeb66fb0a2a6461a88c4 Mon Sep 17 00:00:00 2001 From: jackmc Date: Thu, 14 Dec 2023 20:53:07 +0000 Subject: [PATCH] fix: do not fatal --- internal/dom/chatmodels/gemini_api.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/dom/chatmodels/gemini_api.go b/internal/dom/chatmodels/gemini_api.go index 5856662..e5c5935 100644 --- a/internal/dom/chatmodels/gemini_api.go +++ b/internal/dom/chatmodels/gemini_api.go @@ -2,7 +2,6 @@ package chatmodels import ( "context" - "log" "github.com/google/generative-ai-go/genai" "github.com/sashabaranov/go-openai" @@ -23,7 +22,7 @@ func NewGeminiApiClient(token string) *GeminiApiClient { func (api *GeminiApiClient) GeminiChat(ctx context.Context, prompt string) (*genai.GenerateContentResponse, error) { client, err := genai.NewClient(ctx, option.WithCredentialsJSON(api.Token)) if err != nil { - log.Fatal(err) + return nil, err } defer client.Close() model := client.GenerativeModel("gemini-pro")