Allow for disabling OpenAI integration
For offline development
This commit is contained in:
parent
f90faa4732
commit
96237c7599
1 changed files with 5 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/maruel/genai"
|
"github.com/maruel/genai"
|
||||||
|
|
@ -13,6 +14,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateOpenAIClient(ctx context.Context, logger *zerolog.Logger) error {
|
func CreateOpenAIClient(ctx context.Context, logger *zerolog.Logger) error {
|
||||||
|
if os.Getenv("OPENAI_API_KEY") == "" {
|
||||||
|
logger.Warn().Msg("Disabling OpenAI integration due to empty OPENAI_API_KEY")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
linkLogger(logger)
|
linkLogger(logger)
|
||||||
|
|
||||||
opts := genai.ProviderOptions{
|
opts := genai.ProviderOptions{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue