From f082839a48aff85524fddd0d279661c501965a4c Mon Sep 17 00:00:00 2001 From: CahidArda Date: Mon, 21 Oct 2024 21:12:12 +0300 Subject: [PATCH 1/2] fix: initialize redis if env vars are set --- src/config.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/config.ts b/src/config.ts index 0e38904..735ff09 100644 --- a/src/config.ts +++ b/src/config.ts @@ -48,11 +48,10 @@ export class Config { * and returns undefined, allowing RAG CHAT to fall back to using an in-memory database. */ const initializeRedis = () => { - try { - return Redis.fromEnv(); - } catch { - return; - } + const environment = typeof process === "undefined" ? ({} as Record) : process.env; + return environment.UPSTASH_REDIS_REST_URL && environment.UPSTASH_REDIS_REST_TOKEN + ? Redis.fromEnv() + : undefined; }; /** From 3ca5c227671c739960f3735c06d17b352f0ec7ad Mon Sep 17 00:00:00 2001 From: CahidArda Date: Mon, 21 Oct 2024 22:29:51 +0300 Subject: [PATCH 2/2] fix: rm clean command to fix missing d.ts file issue when I built the project, d.ts files inside the nextjs would be missing --- tsup.config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tsup.config.ts b/tsup.config.ts index 1798cbf..ce556b0 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -4,7 +4,6 @@ export default defineConfig([ entry: ["src/index.ts"], outDir: "dist", format: ["cjs", "esm"], - clean: true, dts: true, }, {