From 8ce2cf5c3b683a9cbf981fa79da1b1993ec3f9ee Mon Sep 17 00:00:00 2001 From: glay Date: Tue, 26 Nov 2024 11:57:49 +0800 Subject: [PATCH] Remove detailed error error message. --- app/api/bedrock.ts | 3 +-- app/client/platforms/bedrock.ts | 16 ++++++++-------- app/utils/aws.ts | 2 -- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/app/api/bedrock.ts b/app/api/bedrock.ts index 097ac5f9c..1cc177348 100644 --- a/app/api/bedrock.ts +++ b/app/api/bedrock.ts @@ -101,8 +101,7 @@ async function requestBedrock(req: NextRequest) { shouldStream, ); - console.log("[Bedrock Request] Endpoint:", endpoint); - console.log("[Bedrock Request] Model ID:", modelId); + console.log("[Bedrock Request] Initiating request"); // Handle tools for different models const isMistralLargeModel = modelId diff --git a/app/client/platforms/bedrock.ts b/app/client/platforms/bedrock.ts index 856c67b47..2260eae05 100644 --- a/app/client/platforms/bedrock.ts +++ b/app/client/platforms/bedrock.ts @@ -228,14 +228,14 @@ export class BedrockApi implements LLMApi { const headers = getHeaders(); headers.XModelID = modelConfig.model; headers.XEncryptionKey = accessStore.encryptionKey; - - console.log("[Bedrock Client] Request:", { - path: chatPath, - model: modelConfig.model, - messages: messages.length, - stream: shouldStream, - }); - + if (process.env.NODE_ENV !== "production") { + console.debug("[Bedrock Client] Request:", { + path: chatPath, + model: modelConfig.model, + messages: messages.length, + stream: shouldStream, + }); + } const finalRequestBody = this.formatRequestBody(messages, modelConfig); console.log( "[Bedrock Client] Request Body:", diff --git a/app/utils/aws.ts b/app/utils/aws.ts index e0b8e479f..395c8fe3e 100644 --- a/app/utils/aws.ts +++ b/app/utils/aws.ts @@ -28,13 +28,11 @@ export interface ModelValidationConfig { export function encrypt(data: string, encryptionKey: string): string { if (!data) return ""; if (!encryptionKey) { - console.error("[AWS Encryption Error] Encryption key is required"); throw new Error("Encryption key is required for AWS credential encryption"); } try { return AES.encrypt(data, encryptionKey).toString(); } catch (error) { - console.error("[AWS Encryption Error]:", error); throw new Error("Failed to encrypt AWS credentials"); } }