From b8a6efa649c69ebf6deed139861a87aa5d6509c9 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Wed, 31 Jul 2024 12:06:27 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F=20chore?= =?UTF-8?q?:=20pass=20Tavily=20Response=20error=20and=20revert=20test=20co?= =?UTF-8?q?mmit=20on=20`userSchema.js`=20(#3496)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: revert test commit * chore: make sure tavily error gets passed --- api/app/clients/tools/structured/TavilySearchResults.js | 4 +++- api/models/schema/userSchema.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/api/app/clients/tools/structured/TavilySearchResults.js b/api/app/clients/tools/structured/TavilySearchResults.js index 3945ac1d00..b1691a63db 100644 --- a/api/app/clients/tools/structured/TavilySearchResults.js +++ b/api/app/clients/tools/structured/TavilySearchResults.js @@ -82,7 +82,9 @@ class TavilySearchResults extends Tool { const json = await response.json(); if (!response.ok) { - throw new Error(`Request failed with status ${response.status}: ${json.error}`); + throw new Error( + `Request failed with status ${response.status}: ${json?.detail?.error || json?.error}`, + ); } return JSON.stringify(json); diff --git a/api/models/schema/userSchema.js b/api/models/schema/userSchema.js index f32da48cc9..715d823516 100644 --- a/api/models/schema/userSchema.js +++ b/api/models/schema/userSchema.js @@ -1,4 +1,5 @@ const mongoose = require('mongoose'); +const { SystemRoles } = require('librechat-data-provider'); /** * @typedef {Object} MongoSession @@ -78,7 +79,7 @@ const userSchema = mongoose.Schema( }, role: { type: String, - default: 'USER', + default: SystemRoles.USER, }, googleId: { type: String,