@botonic/core
Version:
Runtime and APIs for Botonic bots: actions, context, messaging, and integration hooks used by the **current** framework line.
72 lines • 2.42 kB
JavaScript
export class BotonicContextSettings {
constructor(rawSettings) {
this.rawSettings = rawSettings;
}
get raw() {
return this.rawSettings;
}
get hubtypeApiUrl() {
return this.rawSettings.HUBTYPE_API_URL;
}
get staticUrl() {
return this.rawSettings.STATIC_URL;
}
get languageDetectionEnabled() {
return !!this.rawSettings.LANGUAGE_DETECTION_ENABLED;
}
get litellmApiUrl() {
return this.rawSettings.LITELLM_API_URL;
}
get azureOpenAiApiBase() {
return this.rawSettings.AZURE_OPENAI_API_BASE;
}
get azureOpenAiApiVersion() {
return this.rawSettings.AZURE_OPENAI_API_VERSION;
}
// TODO: Implement the rest getters when needed.
get allSettings() {
return {
HUBTYPE_API_URL: this.rawSettings.HUBTYPE_API_URL,
FLOW_BUILDER_API_URL: this.rawSettings.FLOW_BUILDER_API_URL,
STATIC_URL: this.rawSettings.STATIC_URL,
LITELLM_API_URL: this.rawSettings.LITELLM_API_URL,
AZURE_OPENAI_API_BASE: this.rawSettings.AZURE_OPENAI_API_BASE,
AZURE_OPENAI_API_VERSION: this.rawSettings.AZURE_OPENAI_API_VERSION,
CUSTOM_SHORT_URL_HOST: this.rawSettings.CUSTOM_SHORT_URL_HOST,
custom: this.rawSettings.custom,
};
}
}
export class BotonicContextSecrets {
constructor(rawSecrets) {
this.rawSecrets = rawSecrets;
}
get raw() {
return this.rawSecrets;
}
get hubtypeAccessToken() {
return this.rawSecrets.HUBTYPE_ACCESS_TOKEN;
}
get azureOpenAiApiKey() {
if (!this.rawSecrets.AZURE_OPENAI_API_KEY) {
throw new Error('AZURE_OPENAI_API_KEY is not set');
}
return this.rawSecrets.AZURE_OPENAI_API_KEY;
}
get litellmApiKey() {
if (!this.rawSecrets.LITELLM_API_KEY) {
throw new Error('LITELLM_API_KEY is not set');
}
return this.rawSecrets.LITELLM_API_KEY;
}
// TODO: Implement the rest getters when needed
get allSecrets() {
return {
HUBTYPE_ACCESS_TOKEN: this.rawSecrets.HUBTYPE_ACCESS_TOKEN,
LITELLM_API_KEY: this.rawSecrets.LITELLM_API_KEY,
AZURE_OPENAI_API_KEY: this.rawSecrets.AZURE_OPENAI_API_KEY,
custom: this.rawSecrets.custom,
};
}
}
//# sourceMappingURL=botonic-context-settings.js.map