Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: add no-reply email to server config #1086

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions pkg/invoke/invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,26 @@ import (
var log = logger.Package()

type Invoker struct {
gptClient *gptscript.GPTScript
uncached kclient.WithWatch
gatewayClient *client.Client
tokenService *jwt.TokenService
events *events.Emitter
serverURL string
serverPort int
gptClient *gptscript.GPTScript
uncached kclient.WithWatch
gatewayClient *client.Client
tokenService *jwt.TokenService
events *events.Emitter
noReplyEmailAddress string
Copy link
Member Author

@njhale njhale Dec 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this configuration name specifically mention SendGrid; e.g. 'sendGridNoReplyAddress`?

Should it even be a full address? Maybe something like emailDomain (to match the version API) is better, and we just use a default address like obot-noreply@<emailDomain>?

(these questions apply for the environment variable names plumbed through as well)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it should specifically mention SendGrid. It is likely this would be useful for other similar tools we might add in the future.

I do like the idea of just using an emailDomain rather than requiring them to specify the full address, but I personally think it is fine either way.

serverURL string
serverPort int
}

func NewInvoker(c kclient.WithWatch, gptClient *gptscript.GPTScript, gatewayClient *client.Client, serverURL string, serverPort int, tokenService *jwt.TokenService, events *events.Emitter) *Invoker {
func NewInvoker(c kclient.WithWatch, gptClient *gptscript.GPTScript, gatewayClient *client.Client, noReplyEmailAddress, serverURL string, serverPort int, tokenService *jwt.TokenService, events *events.Emitter) *Invoker {
return &Invoker{
uncached: c,
gptClient: gptClient,
gatewayClient: gatewayClient,
tokenService: tokenService,
events: events,
serverURL: serverURL,
serverPort: serverPort,
uncached: c,
gptClient: gptClient,
gatewayClient: gatewayClient,
tokenService: tokenService,
events: events,
serverURL: serverURL,
serverPort: serverPort,
noReplyEmailAddress: noReplyEmailAddress,
}
}

Expand Down Expand Up @@ -515,7 +517,8 @@ func (i *Invoker) Resume(ctx context.Context, c kclient.WithWatch, thread *v1.Th
"OBOT_USER_ID="+userID,
"OBOT_USER_NAME="+userName,
"OBOT_USER_EMAIL="+userEmail,
"GPTSCRIPT_HTTP_ENV=OBOT_TOKEN,OBOT_RUN_ID,OBOT_THREAD_ID,OBOT_WORKFLOW_ID,OBOT_WORKFLOW_STEP_ID,OBOT_AGENT_ID",
"OBOT_NO_REPLY_EMAIL="+i.noReplyEmailAddress,
"GPTSCRIPT_HTTP_ENV=OBOT_TOKEN,OBOT_RUN_ID,OBOT_THREAD_ID,OBOT_WORKFLOW_ID,OBOT_WORKFLOW_STEP_ID,OBOT_AGENT_ID,OBOT_NO_REPLY_EMAIL",
),
DefaultModel: run.Spec.DefaultModel,
DefaultModelProvider: modelProvider,
Expand Down
3 changes: 2 additions & 1 deletion pkg/services/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type Config struct {
EncryptionConfigFile string `usage:"The path to the encryption configuration file" default:"./encryption.yaml"`
KnowledgeSetIngestionLimit int `usage:"The maximum number of files to ingest into a knowledge set" default:"1000" env:"OBOT_KNOWLEDGESET_INGESTION_LIMIT" name:"knowledge-set-ingestion-limit"`
EmailServerName string `usage:"The name of the email server to display for email receivers (default: ui-hostname value)"`
NoReplyEmailAddress string `usage:"The email to use for no-reply emails from obot"`

AuthConfig
GatewayConfig
Expand Down Expand Up @@ -217,7 +218,7 @@ func New(ctx context.Context, config Config) (*Services, error) {
tokenServer = &jwt.TokenService{}
events = events.NewEmitter(storageClient)
gatewayClient = client.New(gatewayDB, config.AuthAdminEmails)
invoker = invoke.NewInvoker(storageClient, c, client.New(gatewayDB, config.AuthAdminEmails), config.Hostname, config.HTTPListenPort, tokenServer, events)
invoker = invoke.NewInvoker(storageClient, c, client.New(gatewayDB, config.AuthAdminEmails), config.NoReplyEmailAddress, config.Hostname, config.HTTPListenPort, tokenServer, events)
modelProviderDispatcher = dispatcher.New(invoker, storageClient, c)

proxyServer *proxy.Proxy
Expand Down