Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🗄️ refactor: Make `APP_CONFIG` a Dedicated Cache Store (#9558)

Theo N. Truongc0f95f971a9f
diff --git a/api/cache/getLogStores.js b/api/cache/getLogStores.js
index dfb2017448..e6714f55ec 100644
--- a/api/cache/getLogStores.js
+++ b/api/cache/getLogStores.js
@@ -31,6 +31,7 @@ const namespaces = {
[CacheKeys.SAML_SESSION]: sessionCache(CacheKeys.SAML_SESSION),
[CacheKeys.ROLES]: standardCache(CacheKeys.ROLES),
+ [CacheKeys.APP_CONFIG]: standardCache(CacheKeys.APP_CONFIG),
[CacheKeys.CONFIG_STORE]: standardCache(CacheKeys.CONFIG_STORE),
[CacheKeys.STATIC_CONFIG]: standardCache(CacheKeys.STATIC_CONFIG),
[CacheKeys.PENDING_REQ]: standardCache(CacheKeys.PENDING_REQ),
diff --git a/api/server/services/Config/app.js b/api/server/services/Config/app.js
index e357b55d9f..a5e771eff7 100644
--- a/api/server/services/Config/app.js
+++ b/api/server/services/Config/app.js
@@ -4,6 +4,8 @@ const AppService = require('~/server/services/AppService');
const { setCachedTools } = require('./getCachedTools');
const getLogStores = require('~/cache/getLogStores');
+const BASE_CONFIG_KEY = '_BASE_';
+
/**
* Get the app configuration based on user context
* @param {Object} [options]
@@ -14,8 +16,8 @@ const getLogStores = require('~/cache/getLogStores');
async function getAppConfig(options = {}) {
const { role, refresh } = options;
- const cache = getLogStores(CacheKeys.CONFIG_STORE);
- const cacheKey = role ? `${CacheKeys.APP_CONFIG}:${role}` : CacheKeys.APP_CONFIG;
+ const cache = getLogStores(CacheKeys.APP_CONFIG);
+ const cacheKey = role ? role : BASE_CONFIG_KEY;
if (!refresh) {
const cached = await cache.get(cacheKey);
@@ -24,7 +26,7 @@ async function getAppConfig(options = {}) {
}
}
- let baseConfig = await cache.get(CacheKeys.APP_CONFIG);
+ let baseConfig = await cache.get(BASE_CONFIG_KEY);
if (!baseConfig) {
logger.info('[getAppConfig] App configuration not initialized. Initializing AppService...');
baseConfig = await AppService();
@@ -37,7 +39,7 @@ async function getAppConfig(options = {}) {
await setCachedTools(baseConfig.availableTools, { isGlobal: true });
}
- await cache.set(CacheKeys.APP_CONFIG, baseConfig);
+ await cache.set(BASE_CONFIG_KEY, baseConfig);
}
// For now, return the base config