mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-28 19:06:12 +01:00
chore: add OpenAI API key configuration (#8400)
https://linear.app/unleash/issue/2-2787/add-openai-api-key-to-our-configuration Adds the OpenAI API key to our configuration and exposes a new `unleashAIAvailable` boolean in our UI config to let our frontend know that we have configured this. This can be used together with our flag to decide whether we should enable our experiment for our users.
This commit is contained in:
parent
3a2206d228
commit
d00873c357
@ -32,6 +32,7 @@ export interface IUiConfig {
|
||||
resourceLimits: ResourceLimitsSchema;
|
||||
oidcConfiguredThroughEnv?: boolean;
|
||||
samlConfiguredThroughEnv?: boolean;
|
||||
unleashAIAvailable?: boolean;
|
||||
}
|
||||
|
||||
export interface IProclamationToast {
|
||||
|
@ -94,6 +94,7 @@ exports[`should create default config 1`] = `
|
||||
"frontendMetricsMaxPerMinute": 6000,
|
||||
"frontendRegisterMaxPerMinute": 6000,
|
||||
},
|
||||
"openAIAPIKey": undefined,
|
||||
"preHook": undefined,
|
||||
"preRouterHook": undefined,
|
||||
"prometheusApi": undefined,
|
||||
|
@ -711,6 +711,8 @@ export function createConfig(options: IUnleashOptions): IUnleashConfig {
|
||||
),
|
||||
};
|
||||
|
||||
const openAIAPIKey = process.env.OPENAI_API_KEY;
|
||||
|
||||
return {
|
||||
db,
|
||||
session,
|
||||
@ -749,6 +751,7 @@ export function createConfig(options: IUnleashOptions): IUnleashConfig {
|
||||
rateLimiting,
|
||||
feedbackUriPath,
|
||||
dailyMetricsStorageDays,
|
||||
openAIAPIKey,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -180,6 +180,11 @@ export const uiConfigSchema = {
|
||||
'Whether the SAML configuration is set through environment variables or not.',
|
||||
example: false,
|
||||
},
|
||||
unleashAIAvailable: {
|
||||
type: 'boolean',
|
||||
description: 'Whether Unleash AI is available.',
|
||||
example: false,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
schemas: {
|
||||
|
@ -152,6 +152,7 @@ class ConfigController extends Controller {
|
||||
disablePasswordAuth,
|
||||
maintenanceMode,
|
||||
feedbackUriPath: this.config.feedbackUriPath,
|
||||
unleashAIAvailable: this.config.openAIAPIKey !== undefined,
|
||||
};
|
||||
|
||||
this.openApiService.respondWithValidation(
|
||||
|
@ -273,4 +273,5 @@ export interface IUnleashConfig {
|
||||
isEnterprise: boolean;
|
||||
rateLimiting: IRateLimiting;
|
||||
feedbackUriPath?: string;
|
||||
openAIAPIKey?: string;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user