diff --git a/api/models/userMethods.js b/api/models/userMethods.js index 279672b926d..6aeee74b772 100644 --- a/api/models/userMethods.js +++ b/api/models/userMethods.js @@ -56,10 +56,11 @@ const updateUser = async function (userId, updateData) { * Creates a new user, optionally with a TTL of 1 week. * @param {MongoUser} data - The user data to be created, must contain user_id. * @param {boolean} [disableTTL=true] - Whether to disable the TTL. Defaults to `true`. + * @param {boolean} [returnUser=false] - Whether to disable the TTL. Defaults to `true`. * @returns {Promise} A promise that resolves to the created user document ID. * @throws {Error} If a user with the same user_id already exists. */ -const createUser = async (data, disableTTL = true) => { +const createUser = async (data, disableTTL = true, returnUser = false) => { const userData = { ...data, expiresAt: disableTTL ? null : new Date(Date.now() + 604800 * 1000), // 1 week in milliseconds @@ -71,6 +72,9 @@ const createUser = async (data, disableTTL = true) => { try { const user = await User.create(userData); + if (returnUser) { + return user.toObject(); + } return user._id; } catch (error) { if (error.code === 11000) { diff --git a/api/strategies/openidStrategy.js b/api/strategies/openidStrategy.js index 7fb108a4000..794a38778d8 100644 --- a/api/strategies/openidStrategy.js +++ b/api/strategies/openidStrategy.js @@ -164,8 +164,7 @@ async function setupOpenId() { emailVerified: userinfo.email_verified || false, name: fullName, }; - const userId = await createUser(); - user._id = userId; + user = await createUser(user, true, true); } else { user.provider = 'openid'; user.openidId = userinfo.sub; diff --git a/package-lock.json b/package-lock.json index 388ac0e92c4..3cc15e1e850 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29325,7 +29325,7 @@ }, "packages/data-provider": { "name": "librechat-data-provider", - "version": "0.6.7", + "version": "0.6.8", "license": "ISC", "dependencies": { "@types/js-yaml": "^4.0.9", diff --git a/package.json b/package.json index d72ef1b22ec..070bd907da3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "LibreChat", - "version": "0.7.3", + "version": "0.7.4-rc1", "description": "", "workspaces": [ "api", diff --git a/packages/data-provider/package.json b/packages/data-provider/package.json index abe80695dc1..3c78d44603d 100644 --- a/packages/data-provider/package.json +++ b/packages/data-provider/package.json @@ -1,6 +1,6 @@ { "name": "librechat-data-provider", - "version": "0.6.7", + "version": "0.6.8", "description": "data services for librechat apps", "main": "dist/index.js", "module": "dist/index.es.js", diff --git a/packages/data-provider/src/config.ts b/packages/data-provider/src/config.ts index 8808db3b14a..11bc5f6b70b 100644 --- a/packages/data-provider/src/config.ts +++ b/packages/data-provider/src/config.ts @@ -786,7 +786,7 @@ export enum SettingsTabValues { /** Enum for app-wide constants */ export enum Constants { /** Key for the app's version. */ - VERSION = 'v0.7.3', + VERSION = 'v0.7.4-rc1', /** Key for the Custom Config's version (librechat.yaml). */ CONFIG_VERSION = '1.1.4', /** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */