From 75deaeec002a4c06047aa8f494a69716cd32a950 Mon Sep 17 00:00:00 2001 From: mfbloom <7750763+mfbloom@users.noreply.github.com> Date: Tue, 1 Apr 2025 20:11:13 -0400 Subject: [PATCH] Remove @/lib/encryption from route due to IV error --- src/app/api/chat-rooms/[id]/messages/route.ts | 3 +-- src/app/api/llm-providers/[id]/route.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/api/chat-rooms/[id]/messages/route.ts b/src/app/api/chat-rooms/[id]/messages/route.ts index 46be9a7..14529e3 100644 --- a/src/app/api/chat-rooms/[id]/messages/route.ts +++ b/src/app/api/chat-rooms/[id]/messages/route.ts @@ -1,7 +1,6 @@ import {NextRequest, NextResponse} from "next/server"; import prisma, {Prisma} from "@/lib/prisma"; import {auth} from "@/auth"; -import {decrypt} from "@/lib/encryption"; import {currentDeploymentEnv} from "@/lib/current-deployment-env"; import {ChatOpenAI} from "@langchain/openai"; import {ChatAnthropic} from "@langchain/anthropic"; @@ -90,7 +89,7 @@ export async function POST( let apiKey: string if (currentDeploymentEnv === 'local') { - apiKey = decrypt(llmProvider.apiKey) + apiKey = llmProvider.apiKey } else if (currentDeploymentEnv === 'cloud') { switch (llmProvider.providerId) { case 'openai': diff --git a/src/app/api/llm-providers/[id]/route.ts b/src/app/api/llm-providers/[id]/route.ts index 0329a86..9109e95 100644 --- a/src/app/api/llm-providers/[id]/route.ts +++ b/src/app/api/llm-providers/[id]/route.ts @@ -1,7 +1,6 @@ import {NextRequest, NextResponse} from "next/server"; import prisma from "@/lib/prisma"; import {LLMProvider} from "@/app/api/llm-providers/route"; -import {encrypt} from '@/lib/encryption' export interface LLMProviderPatchRequest { apiKey?: string @@ -19,7 +18,7 @@ export async function PATCH( const body: LLMProviderPatchRequest = await req.json() // API key encryption - if (body.apiKey) body.apiKey = encrypt(body.apiKey) + if (body.apiKey) body.apiKey = body.apiKey const llmProvider = await prisma.lLMProvider.update({ where: {id},