fix: update environment variable names for AI API configuration in RunAiQuery - #479
satti-hari-krishna-reddy wants to merge 7 commits into
Conversation
| decrypted, err := HandleKeyDecryption([]byte(field.Value), parsedKey) | ||
| if err == nil { | ||
| curApiKey = string(decrypted) | ||
| if !auth.Encrypted { |
There was a problem hiding this comment.
It's probably better here to not fully trust auth.Encrypted, as this can also be controlled by the user (manual override)
You may want to just TRY decrypt, and if it fails, use the raw value.
| } | ||
|
|
||
| // Custom URL must only be used when paired with an API key | ||
| if len(curUrl) > 0 && len(curApiKey) == 0 { |
There was a problem hiding this comment.
Weird, wasn't this here already?
|
|
||
| // Checks if cloud sync is set up | ||
| if len(org.SyncConfig.Apikey) > 0 { | ||
| if len(org.SyncConfig.Apikey) > 0 && org.SyncConfig.AiCloudSync { |
There was a problem hiding this comment.
AiCloudSync is a specific parameter introduced by Lalit that acts as a control flag. It requires the user to explicitly enable AI cloud sync. @LalitDeore , mind chiming in here with the exact details or context on this ?
There was a problem hiding this comment.
What is AiCloudSync used for?
AiCloudSync is used to track whether user have enabled/disabled the ai execution through cloud sync or not. By default it is off and it can be enable from admin page.
There was a problem hiding this comment.
Why would it be off by default? On by default obviously makes more sense lol
…to using plain text if decrypt fails
| orgId = os.Getenv("OPENAI_API_ORG") | ||
| } | ||
| // Fallback only. Using SHUFFLE_AI_* instead of AI_API_KEY so legacy env vars | ||
| // don't accidentally block Cloud Gemini. If this is set, it's intentional. |
There was a problem hiding this comment.
This is a stupid rationale.
Fixing gemini implementation is the choice here (which I kin of did anyway) 🤦 The fallback and fallback is obviously better as it uses more standard API-keys and such. And most people won't use this shit anyway
No description provided.