From 2607f157d3b391f0c5063aa2864a4158bf595186 Mon Sep 17 00:00:00 2001 From: Danny Avila <110412045+danny-avila@users.noreply.github.com> Date: Thu, 6 Jul 2023 21:03:31 -0400 Subject: [PATCH] Release: 0.5.3 (#599) * release: 0.5.3, add extra linting rule and minor fix for EndpointDialog * chore: revert to deprecated Message Classes as weird behavior seen in linux * chore(api): remove unused test scripts chore(package.json): remove unused langchain dependency * chore(.gitignore): add /images directory to the ignore list --- .eslintrc.js | 1 + .gitignore | 1 + api/app/clients/OpenAIClient.js | 2 +- api/app/clients/PluginsClient.js | 6 +- api/package.json | 10 +- client/package.json | 2 +- .../Endpoints/EndpointOptionsDialog.jsx | 15 +- .../Input/SetTokenDialog/SetTokenDialog.tsx | 2 +- package-lock.json | 266 +----------------- package.json | 3 +- 10 files changed, 19 insertions(+), 289 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 88123ff97..3dddeb8ea 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -36,6 +36,7 @@ module.exports = { } ], 'linebreak-style': 0, + 'object-curly-spacing': ['error', 'always'], 'no-trailing-spaces': 'error', 'no-multiple-empty-lines': ['error', { 'max': 1 }], // "arrow-parens": [2, "as-needed", { requireForBlockBody: true }], diff --git a/.gitignore b/.gitignore index 2bf3b872e..711c8b0cc 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,4 @@ data.ms/* auth.json /packages/ux-shared/ +/images \ No newline at end of file diff --git a/api/app/clients/OpenAIClient.js b/api/app/clients/OpenAIClient.js index d2fa14019..de7d646f3 100644 --- a/api/app/clients/OpenAIClient.js +++ b/api/app/clients/OpenAIClient.js @@ -245,7 +245,7 @@ class OpenAIClient extends BaseClient { // TODO: need to handle interleaving instructions better if (this.contextStrategy) { ({ payload, tokenCountMap, promptTokens, messages } = - await this.handleContextStrategy({instructions, orderedMessages, formattedMessages})); + await this.handleContextStrategy({ instructions, orderedMessages, formattedMessages })); } const result = { diff --git a/api/app/clients/PluginsClient.js b/api/app/clients/PluginsClient.js index 3767008bb..fc95196d4 100644 --- a/api/app/clients/PluginsClient.js +++ b/api/app/clients/PluginsClient.js @@ -4,7 +4,7 @@ const { CallbackManager } = require('langchain/callbacks'); const { initializeCustomAgent, initializeFunctionsAgent } = require('./agents/'); const { loadTools } = require('./tools/util'); const { SelfReflectionTool } = require('./tools/'); -const { HumanMessage, AIMessage } = require('langchain/schema'); +const { HumanChatMessage, AIChatMessage } = require('langchain/schema'); const { instructions, imageInstructions, @@ -237,8 +237,8 @@ Only respond with your conversational reply to the following User Message: // Map Messages to Langchain format const pastMessages = this.currentMessages.slice(0, -1).map( msg => msg?.isCreatedByUser || msg?.role?.toLowerCase() === 'user' - ? new HumanMessage(msg.text) - : new AIMessage(msg.text)); + ? new HumanChatMessage(msg.text) + : new AIChatMessage(msg.text)); // initialize agent const initializer = this.functionsAgent ? initializeFunctionsAgent : initializeCustomAgent; diff --git a/api/package.json b/api/package.json index 0fda7b803..e562573fa 100644 --- a/api/package.json +++ b/api/package.json @@ -1,18 +1,12 @@ { "name": "@librechat/backend", - "version": "0.5.2", + "version": "0.5.3", "description": "", "scripts": { "start": "echo 'please run this from the root directory'", "server-dev": "echo 'please run this from the root directory'", "test": "cross-env NODE_ENV=test jest", - "test:ci": "jest --ci", - "test2": "node --inspect app/langchain/test2.js", - "test3": "node --inspect app/langchain/test3.js", - "test4": "node --inspect app/langchain/test4.js", - "test5": "node --inspect app/langchain/test5.js", - "test8": "node --inspect app/langchain/test8.js", - "langchain": "node app/langchain/test2.js" + "test:ci": "jest --ci" }, "repository": { "type": "git", diff --git a/client/package.json b/client/package.json index 7ac7694ee..435ec2cc0 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "@librechat/frontend", - "version": "0.5.2", + "version": "0.5.3", "description": "", "scripts": { "data-provider": "cd .. && npm run build:data-provider", diff --git a/client/src/components/Endpoints/EndpointOptionsDialog.jsx b/client/src/components/Endpoints/EndpointOptionsDialog.jsx index 55a2715c3..003b99af8 100644 --- a/client/src/components/Endpoints/EndpointOptionsDialog.jsx +++ b/client/src/components/Endpoints/EndpointOptionsDialog.jsx @@ -1,10 +1,10 @@ import exportFromJSON from 'export-from-json'; import { useEffect, useState } from 'react'; import { useRecoilValue } from 'recoil'; -import { Dialog, DialogButton, DialogTemplate } from '~/components/'; +import { Dialog, DialogButton, DialogTemplate } from '~/components'; import SaveAsPresetDialog from './SaveAsPresetDialog'; import cleanupPreset from '~/utils/cleanupPreset'; - +import { alternateName } from '~/utils'; import Settings from './Settings'; import store from '~/store'; @@ -12,18 +12,9 @@ import store from '~/store'; // A preset dialog to show readonly preset values. const EndpointOptionsDialog = ({ open, onOpenChange, preset: _preset, title }) => { const [preset, setPreset] = useState(_preset); - const [endpointName, setEndpointName] = useState(preset?.endpoint); - const [saveAsDialogShow, setSaveAsDialogShow] = useState(false); const endpointsConfig = useRecoilValue(store.endpointsConfig); - - if (endpointName === 'google') { - setEndpointName('PaLM'); - } - - if (endpointName === 'gptPlugins') { - setEndpointName('Plugins'); - } + const endpointName = alternateName[preset?.endpoint] ?? 'Endpoint'; const setOption = (param) => (newValue) => { let update = {}; diff --git a/client/src/components/Input/SetTokenDialog/SetTokenDialog.tsx b/client/src/components/Input/SetTokenDialog/SetTokenDialog.tsx index 91cdc79d4..63954c69f 100644 --- a/client/src/components/Input/SetTokenDialog/SetTokenDialog.tsx +++ b/client/src/components/Input/SetTokenDialog/SetTokenDialog.tsx @@ -1,4 +1,4 @@ -import React, { useState }from 'react'; +import React, { useState } from 'react'; import HelpText from './HelpText'; import GoogleConfig from './GoogleConfig'; import OpenAIConfig from './OpenAIConfig'; diff --git a/package-lock.json b/package-lock.json index b35d81696..8df0a52c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "LibreChat", - "version": "0.5.2", + "version": "0.5.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "LibreChat", - "version": "0.5.2", + "version": "0.5.3", "hasInstallScript": true, "license": "ISC", "workspaces": [ @@ -16,7 +16,6 @@ ], "dependencies": { "axios": "^1.4.0", - "langchain": "^0.0.91", "passport": "^0.6.0", "passport-github2": "^0.1.12" }, @@ -44,7 +43,7 @@ }, "api": { "name": "@librechat/backend", - "version": "0.5.2", + "version": "0.5.3", "license": "ISC", "dependencies": { "@dqbd/tiktoken": "^1.0.2", @@ -373,7 +372,7 @@ }, "client": { "name": "@librechat/frontend", - "version": "0.5.2", + "version": "0.5.3", "license": "ISC", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.4.0", @@ -17451,231 +17450,6 @@ "node": ">=6" } }, - "node_modules/langchain": { - "version": "0.0.91", - "resolved": "https://registry.npmjs.org/langchain/-/langchain-0.0.91.tgz", - "integrity": "sha512-oCilhNDZDSt8rdvnuVv5J3BIZ1FwCccdqdO6xHddiCko26UkAJ+wKRWmV8YQOYUDZzoRjp4ogDIifETfhfb30w==", - "dependencies": { - "@anthropic-ai/sdk": "^0.4.3", - "ansi-styles": "^5.0.0", - "binary-extensions": "^2.2.0", - "expr-eval": "^2.0.2", - "flat": "^5.0.2", - "js-tiktoken": "^1.0.6", - "jsonpointer": "^5.0.1", - "ml-distance": "^4.0.0", - "object-hash": "^3.0.0", - "openai": "^3.2.0", - "p-queue": "^6.6.2", - "p-retry": "4", - "uuid": "^9.0.0", - "yaml": "^2.2.1", - "zod": "^3.21.4", - "zod-to-json-schema": "^3.20.4" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@aws-sdk/client-dynamodb": "^3.310.0", - "@aws-sdk/client-lambda": "^3.310.0", - "@aws-sdk/client-s3": "^3.310.0", - "@aws-sdk/client-sagemaker-runtime": "^3.310.0", - "@clickhouse/client": "^0.0.14", - "@getmetal/metal-sdk": "*", - "@getzep/zep-js": "^0.3.1", - "@gomomento/sdk": "^1.23.0", - "@huggingface/inference": "^1.5.1", - "@opensearch-project/opensearch": "*", - "@pinecone-database/pinecone": "*", - "@qdrant/js-client-rest": "^1.2.0", - "@supabase/postgrest-js": "^1.1.1", - "@supabase/supabase-js": "^2.10.0", - "@tensorflow-models/universal-sentence-encoder": "*", - "@tensorflow/tfjs-converter": "*", - "@tensorflow/tfjs-core": "*", - "@tigrisdata/vector": "^1.1.0", - "@upstash/redis": "^1.20.6", - "@zilliz/milvus2-sdk-node": ">=2.2.7", - "apify-client": "^2.7.1", - "axios": "*", - "cheerio": "^1.0.0-rc.12", - "chromadb": "^1.5.2", - "cohere-ai": "^5.0.2", - "d3-dsv": "^2.0.0", - "epub2": "^3.0.1", - "faiss-node": "^0.2.0", - "google-auth-library": "^8.8.0", - "hnswlib-node": "^1.4.2", - "html-to-text": "^9.0.5", - "ignore": "^5.2.0", - "mammoth": "*", - "mongodb": "^5.2.0", - "mysql2": "^3.3.3", - "pdf-parse": "1.1.1", - "peggy": "^3.0.2", - "pg": "^8.11.0", - "pickleparser": "^0.1.0", - "playwright": "^1.32.1", - "puppeteer": "^19.7.2", - "redis": "^4.6.4", - "replicate": "^0.9.0", - "srt-parser-2": "^1.2.2", - "typeorm": "^0.3.12", - "weaviate-ts-client": "^1.0.0" - }, - "peerDependenciesMeta": { - "@aws-sdk/client-dynamodb": { - "optional": true - }, - "@aws-sdk/client-lambda": { - "optional": true - }, - "@aws-sdk/client-s3": { - "optional": true - }, - "@aws-sdk/client-sagemaker-runtime": { - "optional": true - }, - "@clickhouse/client": { - "optional": true - }, - "@getmetal/metal-sdk": { - "optional": true - }, - "@getzep/zep-js": { - "optional": true - }, - "@gomomento/sdk": { - "optional": true - }, - "@huggingface/inference": { - "optional": true - }, - "@opensearch-project/opensearch": { - "optional": true - }, - "@pinecone-database/pinecone": { - "optional": true - }, - "@qdrant/js-client-rest": { - "optional": true - }, - "@supabase/postgrest-js": { - "optional": true - }, - "@supabase/supabase-js": { - "optional": true - }, - "@tensorflow-models/universal-sentence-encoder": { - "optional": true - }, - "@tensorflow/tfjs-converter": { - "optional": true - }, - "@tensorflow/tfjs-core": { - "optional": true - }, - "@tigrisdata/vector": { - "optional": true - }, - "@upstash/redis": { - "optional": true - }, - "@zilliz/milvus2-sdk-node": { - "optional": true - }, - "apify-client": { - "optional": true - }, - "axios": { - "optional": true - }, - "cheerio": { - "optional": true - }, - "chromadb": { - "optional": true - }, - "cohere-ai": { - "optional": true - }, - "d3-dsv": { - "optional": true - }, - "epub2": { - "optional": true - }, - "faiss-node": { - "optional": true - }, - "google-auth-library": { - "optional": true - }, - "hnswlib-node": { - "optional": true - }, - "html-to-text": { - "optional": true - }, - "ignore": { - "optional": true - }, - "mammoth": { - "optional": true - }, - "mongodb": { - "optional": true - }, - "mysql2": { - "optional": true - }, - "pdf-parse": { - "optional": true - }, - "peggy": { - "optional": true - }, - "pg": { - "optional": true - }, - "pickleparser": { - "optional": true - }, - "playwright": { - "optional": true - }, - "puppeteer": { - "optional": true - }, - "redis": { - "optional": true - }, - "replicate": { - "optional": true - }, - "srt-parser-2": { - "optional": true - }, - "typeorm": { - "optional": true - }, - "weaviate-ts-client": { - "optional": true - } - } - }, - "node_modules/langchain/node_modules/ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/langchainplus-sdk": { "version": "0.0.19", "resolved": "https://registry.npmjs.org/langchainplus-sdk/-/langchainplus-sdk-0.0.19.tgz", @@ -30456,7 +30230,7 @@ "jsonwebtoken": "^9.0.0", "keyv": "^4.5.2", "keyv-file": "^0.2.0", - "langchain": "0.0.103", + "langchain": "^0.0.103", "lodash": "^4.17.21", "meilisearch": "^0.33.0", "mongoose": "^7.1.1", @@ -39260,36 +39034,6 @@ "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", "dev": true }, - "langchain": { - "version": "0.0.91", - "resolved": "https://registry.npmjs.org/langchain/-/langchain-0.0.91.tgz", - "integrity": "sha512-oCilhNDZDSt8rdvnuVv5J3BIZ1FwCccdqdO6xHddiCko26UkAJ+wKRWmV8YQOYUDZzoRjp4ogDIifETfhfb30w==", - "requires": { - "@anthropic-ai/sdk": "^0.4.3", - "ansi-styles": "^5.0.0", - "binary-extensions": "^2.2.0", - "expr-eval": "^2.0.2", - "flat": "^5.0.2", - "js-tiktoken": "^1.0.6", - "jsonpointer": "^5.0.1", - "ml-distance": "^4.0.0", - "object-hash": "^3.0.0", - "openai": "^3.2.0", - "p-queue": "^6.6.2", - "p-retry": "4", - "uuid": "^9.0.0", - "yaml": "^2.2.1", - "zod": "^3.21.4", - "zod-to-json-schema": "^3.20.4" - }, - "dependencies": { - "ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==" - } - } - }, "langchainplus-sdk": { "version": "0.0.19", "resolved": "https://registry.npmjs.org/langchainplus-sdk/-/langchainplus-sdk-0.0.19.tgz", diff --git a/package.json b/package.json index 633e047ca..947529cc5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "LibreChat", - "version": "0.5.2", + "version": "0.5.3", "description": "", "workspaces": [ "api", @@ -40,7 +40,6 @@ "homepage": "https://github.com/danny-avila/LibreChat#readme", "dependencies": { "axios": "^1.4.0", - "langchain": "^0.0.91", "passport": "^0.6.0", "passport-github2": "^0.1.12" },