From e82261723b06203886280f48d09b6ed7b95c433e Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Mon, 13 Nov 2023 09:37:01 +0100 Subject: [PATCH 1/4] Some package audit fix --- connectors/package-lock.json | 46 ++++++++++-------------------------- front/package-lock.json | 25 +++++++++++++------- 2 files changed, 28 insertions(+), 43 deletions(-) diff --git a/connectors/package-lock.json b/connectors/package-lock.json index cc755bc342da..b7ae99588e1e 100644 --- a/connectors/package-lock.json +++ b/connectors/package-lock.json @@ -1239,18 +1239,18 @@ } }, "node_modules/@slack/web-api": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/@slack/web-api/-/web-api-6.8.1.tgz", - "integrity": "sha512-eMPk2S99S613gcu7odSw/LV+Qxr8A+RXvBD0GYW510wJuTERiTjP5TgCsH8X09+lxSumbDE88wvWbuFuvGa74g==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@slack/web-api/-/web-api-6.9.1.tgz", + "integrity": "sha512-YqGbuiEJruhiDDsFb1EX6TqWNpyFoApJgkD9D0MQPaipiJyMUadscl8Vs2jfxkjNR0LspVQiCSDoeNWJK34GhQ==", "dependencies": { "@slack/logger": "^3.0.0", - "@slack/types": "^2.0.0", + "@slack/types": "^2.8.0", "@types/is-stream": "^1.1.0", "@types/node": ">=12.0.0", - "axios": "^0.27.2", + "axios": "^1.6.0", "eventemitter3": "^3.1.0", "form-data": "^2.5.0", - "is-electron": "2.2.0", + "is-electron": "2.2.2", "is-stream": "^1.1.0", "p-queue": "^6.6.1", "p-retry": "^4.0.0" @@ -1260,28 +1260,6 @@ "npm": ">= 6.12.0" } }, - "node_modules/@slack/web-api/node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", - "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" - } - }, - "node_modules/@slack/web-api/node_modules/axios/node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/@slack/web-api/node_modules/p-queue": { "version": "6.6.2", "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz", @@ -2352,9 +2330,9 @@ } }, "node_modules/axios": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.1.tgz", - "integrity": "sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz", + "integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -4215,9 +4193,9 @@ } }, "node_modules/is-electron": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.0.tgz", - "integrity": "sha512-SpMppC2XR3YdxSzczXReBjqs2zGscWQpBIKqwXYBFic0ERaxNVgwLCHwOLZeESfdJQjX0RDvrJ1lBXX2ij+G1Q==" + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.2.tgz", + "integrity": "sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg==" }, "node_modules/is-extglob": { "version": "2.1.1", diff --git a/front/package-lock.json b/front/package-lock.json index c4a5eb9ccf45..066e0f85ef64 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -4,6 +4,7 @@ "requires": true, "packages": { "": { + "name": "front", "dependencies": { "@dust-tt/sparkle": "^0.2.36", "@emoji-mart/data": "^1.1.2", @@ -2493,15 +2494,15 @@ } }, "node_modules/@slack/web-api": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@slack/web-api/-/web-api-6.9.0.tgz", - "integrity": "sha512-RME5/F+jvQmZHkoP+ogrDbixq1Ms1mBmylzuWq4sf3f7GCpMPWoiZ+WqWk+sism3vrlveKWIgO9R4Qg9fiRyoQ==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@slack/web-api/-/web-api-6.9.1.tgz", + "integrity": "sha512-YqGbuiEJruhiDDsFb1EX6TqWNpyFoApJgkD9D0MQPaipiJyMUadscl8Vs2jfxkjNR0LspVQiCSDoeNWJK34GhQ==", "dependencies": { "@slack/logger": "^3.0.0", "@slack/types": "^2.8.0", "@types/is-stream": "^1.1.0", "@types/node": ">=12.0.0", - "axios": "^0.27.2", + "axios": "^1.6.0", "eventemitter3": "^3.1.0", "form-data": "^2.5.0", "is-electron": "2.2.2", @@ -2515,12 +2516,13 @@ } }, "node_modules/@slack/web-api/node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz", + "integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==", "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "node_modules/@slack/web-api/node_modules/axios/node_modules/form-data": { @@ -11773,6 +11775,11 @@ "node": ">=12.0.0" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", From 2108995a406e78a17f9c1ba012853ee668b0c430 Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Mon, 13 Nov 2023 09:43:23 +0100 Subject: [PATCH 2/4] Message > MessageElement for Slack --- connectors/src/connectors/slack/bot.ts | 4 ++-- connectors/src/connectors/slack/temporal/activities.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/connectors/src/connectors/slack/bot.ts b/connectors/src/connectors/slack/bot.ts index 5be9eb5869c9..ea5e984ba391 100644 --- a/connectors/src/connectors/slack/bot.ts +++ b/connectors/src/connectors/slack/bot.ts @@ -1,5 +1,5 @@ import { WebClient } from "@slack/web-api"; -import { Message } from "@slack/web-api/dist/response/ConversationsHistoryResponse"; +import { MessageElement } from "@slack/web-api/dist/response/ConversationsHistoryResponse"; import { ConversationsRepliesResponse } from "@slack/web-api/dist/response/ConversationsRepliesResponse"; import levenshtein from "fast-levenshtein"; @@ -620,7 +620,7 @@ async function makeContentFragment( startingAtTs: string | null, connector: Connector ) { - let allMessages: Message[] = []; + let allMessages: MessageElement[] = []; let next_cursor = undefined; diff --git a/connectors/src/connectors/slack/temporal/activities.ts b/connectors/src/connectors/slack/temporal/activities.ts index 07f06dc89f5b..f9e530588f65 100644 --- a/connectors/src/connectors/slack/temporal/activities.ts +++ b/connectors/src/connectors/slack/temporal/activities.ts @@ -6,7 +6,7 @@ import { } from "@slack/web-api"; import { ConversationsHistoryResponse, - Message, + MessageElement, } from "@slack/web-api/dist/response/ConversationsHistoryResponse"; import { Channel, @@ -361,7 +361,7 @@ export async function syncNonThreaded( const dataSourceConfig = dataSourceConfigFromConnector(connector); const client = await getSlackClient(connectorId); const nextCursor: string | undefined = undefined; - const messages: Message[] = []; + const messages: MessageElement[] = []; const startTsSec = Math.round(startTsMs / 1000); const endTsSec = Math.round(endTsMs / 1000); @@ -523,7 +523,7 @@ export async function syncThread( const dataSourceConfig = dataSourceConfigFromConnector(connector); const slackClient = await getSlackClient(connectorId); - let allMessages: Message[] = []; + let allMessages: MessageElement[] = []; let next_cursor = undefined; @@ -645,7 +645,7 @@ async function processMessageForMentions( export async function formatMessagesForUpsert( channelId: string, - messages: Message[], + messages: MessageElement[], connectorId: ModelId, slackClient: WebClient ) { From bc2687587ac6b5e85de26762c332351f5cfce6f8 Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Mon, 13 Nov 2023 10:06:23 +0100 Subject: [PATCH 3/4] Fix some Rust extra warnings --- core/src/providers/ai21.rs | 2 +- core/src/providers/azure_openai.rs | 4 ++-- core/src/providers/cohere.rs | 2 +- core/src/providers/openai.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/providers/ai21.rs b/core/src/providers/ai21.rs index d52a995de754..f5a1012921a5 100644 --- a/core/src/providers/ai21.rs +++ b/core/src/providers/ai21.rs @@ -210,7 +210,7 @@ impl LLM for AI21LLM { ) -> Result { let r = self .generate( - prompt.clone(), + prompt, 1, // num_results match max_tokens { Some(f) => f, diff --git a/core/src/providers/azure_openai.rs b/core/src/providers/azure_openai.rs index 08a221f78013..a4c158e029b7 100644 --- a/core/src/providers/azure_openai.rs +++ b/core/src/providers/azure_openai.rs @@ -312,7 +312,7 @@ impl LLM for AzureOpenAILLM { self.api_key.clone().unwrap(), None, None, - prompt.clone(), + prompt, max_tokens, temperature, n, @@ -351,7 +351,7 @@ impl LLM for AzureOpenAILLM { self.api_key.clone().unwrap(), None, None, - prompt.clone(), + prompt, max_tokens, temperature, n, diff --git a/core/src/providers/cohere.rs b/core/src/providers/cohere.rs index 2e8b5d92bec9..40fa683dd16d 100644 --- a/core/src/providers/cohere.rs +++ b/core/src/providers/cohere.rs @@ -328,7 +328,7 @@ impl LLM for CohereLLM { let r = self .generate( - prompt.clone(), + prompt, max_tokens, temperature, n, diff --git a/core/src/providers/openai.rs b/core/src/providers/openai.rs index 55b7b15d34e1..fd485f117a4e 100644 --- a/core/src/providers/openai.rs +++ b/core/src/providers/openai.rs @@ -1221,7 +1221,7 @@ impl LLM for OpenAILLM { None => None, }, Some(self.id.clone()), - prompt.clone(), + prompt, max_tokens, temperature, n, @@ -1266,7 +1266,7 @@ impl LLM for OpenAILLM { None => None, }, Some(self.id.clone()), - prompt.clone(), + prompt, max_tokens, temperature, n, From c9374e621a16e926d5f715e9e3d034745787b768 Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Mon, 13 Nov 2023 11:19:02 +0100 Subject: [PATCH 4/4] nit --- front/pages/w/[wId]/builder/data-sources/managed.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/front/pages/w/[wId]/builder/data-sources/managed.tsx b/front/pages/w/[wId]/builder/data-sources/managed.tsx index 9e9ed69d9270..6135cce4f52c 100644 --- a/front/pages/w/[wId]/builder/data-sources/managed.tsx +++ b/front/pages/w/[wId]/builder/data-sources/managed.tsx @@ -384,7 +384,7 @@ export default function DataSourcesView({ ds.connectorProvider as ConnectorProvider ] || !isAdmin; - const onclick = async () => { + const onClick = async () => { let isDataSourceAllowedInPlan: boolean; switch (ds.connectorProvider) { @@ -439,7 +439,7 @@ export default function DataSourcesView({ variant="primary" icon={CloudArrowLeftRightIcon} disabled={disabled} - onClick={onclick} + onClick={onClick} label={label} /> )} @@ -503,7 +503,7 @@ export default function DataSourcesView({ variant="secondary" icon={CloudArrowLeftRightIcon} disabled={disabled} - onClick={onclick} + onClick={onClick} label="Acknowledge and Connect" />