From dc6653e5ccd941070dd151d67daf8a4d9c21dd40 Mon Sep 17 00:00:00 2001 From: Willy Douhard Date: Tue, 14 Nov 2023 11:24:18 +0100 Subject: [PATCH 1/5] bump version --- libs/components/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/components/package.json b/libs/components/package.json index a89a10a608..ffc0e3f640 100644 --- a/libs/components/package.json +++ b/libs/components/package.json @@ -1,7 +1,7 @@ { "name": "@chainlit/components", "description": "Reusable components of the Chainlit UI.", - "version": "0.1.0", + "version": "0.1.1", "scripts": { "build": "tsup src/index.ts --clean --format esm,cjs --dts --external react --legacy-output --minify --sourcemap --treeshake", "build:watch": "tsup src/index.ts --watch --clean --format esm,cjs --dts --external react --legacy-output --minify --sourcemap --treeshake", From 3cd4f338e41ac46cd6365bef967bd4d7a655de40 Mon Sep 17 00:00:00 2001 From: Willy Douhard Date: Wed, 15 Nov 2023 14:30:02 +0100 Subject: [PATCH 2/5] split react clients from components --- .github/CONTRIBUTING.md | 10 +- .github/workflows/tests-components.yaml | 10 +- frontend/package.json | 5 +- frontend/pnpm-lock.yaml | 71 +- frontend/src/App.tsx | 4 +- frontend/src/api/chainlitApi.ts | 2 +- .../src/components/atoms/element/sideView.tsx | 2 +- .../src/components/molecules/chatProfiles.tsx | 5 +- .../components/molecules/newChatButton.tsx | 3 +- .../components/molecules/newChatDialog.tsx | 2 +- .../components/molecules/settingsModal.tsx | 2 +- .../components/molecules/tasklist/Task.tsx | 2 +- .../molecules/tasklist/TaskList.tsx | 4 +- .../molecules/tasklist/TaskStatusIcon.tsx | 2 +- .../organisms/chat/Messages/container.tsx | 21 +- .../organisms/chat/Messages/index.tsx | 2 +- .../organisms/chat/Messages/welcomeScreen.tsx | 2 +- .../organisms/chat/history/index.tsx | 2 +- .../src/components/organisms/chat/index.tsx | 8 +- .../organisms/chat/inputBox/UploadButton.tsx | 4 +- .../organisms/chat/inputBox/index.tsx | 2 +- .../organisms/chat/inputBox/input.tsx | 4 +- .../components/organisms/chat/settings.tsx | 9 +- .../components/organisms/chat/stopButton.tsx | 3 +- .../conversationsHistory/Conversation.tsx | 2 +- .../sidebar/ConversationsHistoryList.tsx | 2 +- .../sidebar/filters/FeedbackSelect.tsx | 2 +- .../sidebar/filters/SearchBar.tsx | 2 +- frontend/src/components/organisms/header.tsx | 2 +- .../components/organisms/playground/index.tsx | 32 +- frontend/src/helpers/groupeByDate.ts | 2 +- frontend/src/hooks/auth.ts | 2 +- frontend/src/hooks/useLLMProviders.ts | 2 +- frontend/src/pages/Conversation.tsx | 2 +- frontend/src/pages/Design.tsx | 10 +- frontend/src/pages/Element.tsx | 7 +- frontend/src/pages/Env.tsx | 2 +- frontend/src/pages/Login.tsx | 2 +- frontend/src/pages/ResumeButton.tsx | 2 +- frontend/src/state/chat.ts | 2 +- frontend/src/state/playground.ts | 2 +- frontend/src/state/project.ts | 2 +- frontend/src/state/user.ts | 2 +- frontend/src/types/chatHistory.ts | 2 +- libs/components/hooks/index.ts | 8 - libs/react-client/package.json | 58 + libs/react-client/pnpm-lock.yaml | 2982 +++++++++++++++++ libs/react-client/src/index.ts | 7 + .../useChat => react-client/src}/state.ts | 10 +- .../src/types/action.ts | 0 .../src/types/conversation.ts | 0 .../src/types/element.ts | 0 .../src/types/file.ts | 0 libs/react-client/src/types/index.ts | 6 + .../src/types/message.ts | 15 +- .../src/types/user.ts | 0 .../src}/useChatData.ts | 0 .../src}/useChatInteract.ts | 7 +- .../src}/useChatMessages.ts | 0 .../src}/useChatSession.ts | 37 +- .../src}/utils/message.ts | 3 +- libs/react-client/tsconfig.json | 38 + .../.gitignore | 0 .../README.md | 0 .../contexts/MessageContext.tsx | 0 .../contexts/PlaygroundContext.tsx | 0 libs/react-components/hooks/index.ts | 4 + .../hooks/useApi.tsx | 0 .../hooks/useColors.tsx | 0 .../hooks/useIsDarkMode.tsx | 0 .../hooks/useUpload.tsx | 2 +- .../package.json | 12 +- .../pnpm-lock.yaml | 145 +- .../src/Attachments.tsx | 3 +- .../src/ClipboardCopy.tsx | 0 .../src/Code.tsx | 0 .../src/Collapse.tsx | 0 .../src/Dialog.tsx | 0 .../src/ErrorBoundary.tsx | 0 .../src/InlineCode.tsx | 0 .../src/Markdown.tsx | 3 +- .../src/NotificationCount.tsx | 0 .../src/auth/Auth0.tsx | 0 .../src/auth/AuthForgotPassword.tsx | 1 - .../src/auth/AuthLogin.tsx | 0 .../src/auth/AuthResetPassword.tsx | 0 .../src/auth/AuthTemplate.tsx | 0 .../src/auth/AuthVerifyEmail.tsx | 0 .../src/auth/Descope.tsx | 0 .../src/auth/Okta.tsx | 0 .../src/auth/ProviderButton.tsx | 2 +- .../src/auth/index.ts | 0 .../src/buttons/AccentButton.tsx | 0 .../src/buttons/GreyButton.tsx | 0 .../src/buttons/RegularButton.tsx | 0 .../src/buttons/Toggle.tsx | 0 .../src/buttons/index.ts | 0 .../src/elements/Audio.tsx | 2 +- .../src/elements/Avatar.tsx | 4 +- .../src/elements/Element.tsx | 2 +- .../src/elements/ElementSideView.tsx | 2 +- .../src/elements/ElementView.tsx | 2 +- .../src/elements/File.tsx | 2 +- .../src/elements/Frame.tsx | 0 .../src/elements/Image.tsx | 2 +- .../src/elements/InlinedAudioList.tsx | 2 +- .../src/elements/InlinedElements.tsx | 2 +- .../src/elements/InlinedFileList.tsx | 2 +- .../src/elements/InlinedImageList.tsx | 2 +- .../src/elements/InlinedPDFList.tsx | 2 +- .../src/elements/InlinedPlotlyList.tsx | 2 +- .../src/elements/InlinedTextList.tsx | 2 +- .../src/elements/InlinedVideoList.tsx | 2 +- .../src/elements/ListWithSize.tsx | 2 +- .../src/elements/PDF.tsx | 2 +- .../src/elements/Plotly.tsx | 4 +- .../src/elements/Text.tsx | 4 +- .../src/elements/Video.tsx | 2 +- .../src/elements/index.ts | 0 .../src/index.ts | 1 - .../src/inputs/FormInput.tsx | 0 .../src/inputs/InputLabel.tsx | 0 .../src/inputs/InputStateHandler.tsx | 0 .../src/inputs/SliderInput.tsx | 0 .../src/inputs/SwitchInput.tsx | 0 .../src/inputs/TagsInput.tsx | 0 .../src/inputs/TextInput.tsx | 0 .../src/inputs/index.ts | 0 .../src/inputs/selects/MenuItem.tsx | 0 .../inputs/selects/SelectCategoryInput.tsx | 0 .../src/inputs/selects/SelectInput.tsx | 0 .../src/messages/Message.tsx | 6 +- .../src/messages/MessageContainer.tsx | 5 +- .../src/messages/Messages.tsx | 10 +- .../src/messages/components/ActionButton.tsx | 2 +- .../components/ActionDrawerButton.tsx | 2 +- .../messages/components/AskUploadButton.tsx | 4 +- .../src/messages/components/Author.tsx | 4 +- .../src/messages/components/DetailsButton.tsx | 2 +- .../src/messages/components/ElementRef.tsx | 2 +- .../messages/components/FeedbackButtons.tsx | 17 +- .../messages/components/MessageActions.tsx | 3 +- .../messages/components/MessageButtons.tsx | 2 +- .../messages/components/MessageContent.tsx | 3 +- .../src/messages/components/MessageTime.tsx | 0 .../messages/components/PlaygroundButton.tsx | 2 +- .../src/messages/index.ts | 0 .../src/playground/actionBar.tsx | 0 .../src/playground/basic.tsx | 2 +- .../src/playground/chat.tsx | 2 +- .../src/playground/editor/EditorWrapper.tsx | 10 +- .../src/playground/editor/MessageWrapper.tsx | 3 +- .../src/playground/editor/completion.tsx | 0 .../src/playground/editor/formatted.tsx | 3 +- .../src/playground/editor/functionModal.tsx | 0 .../src/playground/editor/promptMessage.tsx | 3 +- .../src/playground/editor/template/index.tsx | 3 +- .../playground/editor/template/variable.tsx | 0 .../src/playground/editor/variableModal.tsx | 0 .../src/playground/functionInput.tsx | 0 .../src/playground/header.tsx | 0 .../src/playground/helpers/format.ts | 0 .../src/playground/helpers/provider.ts | 0 .../src/playground/index.tsx | 0 .../src/playground/modeToggle.tsx | 0 .../src/playground/modelSettings.tsx | 3 +- .../src/playground/submitButton.tsx | 0 .../src/playground/variableInput.tsx | 0 .../src/types/Input.ts | 0 .../src/types/NotificationCount.tsx | 0 .../src/types/index.ts | 6 - .../src/types/messageContext.ts | 11 +- .../src/types/playground.ts | 16 +- .../src/types/playgroundContext.ts | 4 +- .../tests/content.spec.tsx | 4 +- .../tests/message.spec.tsx | 0 .../tests/setup-tests.ts | 0 .../theme/index.ts | 0 .../theme/palette.ts | 0 .../theme/theme.tsx | 0 .../tsconfig.json | 0 .../utils/exportToFile.ts | 0 .../utils/omit.ts | 0 .../vitest.config.ts | 8 +- libs/sdk/package.json | 32 - libs/sdk/pnpm-lock.yaml | 212 -- libs/sdk/src/index.ts | 531 --- libs/sdk/tsconfig.json | 29 - package.json | 10 +- pnpm-workspace.yaml | 3 +- 190 files changed, 3415 insertions(+), 1198 deletions(-) delete mode 100644 libs/components/hooks/index.ts create mode 100644 libs/react-client/package.json create mode 100644 libs/react-client/pnpm-lock.yaml create mode 100644 libs/react-client/src/index.ts rename libs/{components/hooks/useChat => react-client/src}/state.ts (92%) rename libs/{components => react-client}/src/types/action.ts (100%) rename libs/{components => react-client}/src/types/conversation.ts (100%) rename libs/{components => react-client}/src/types/element.ts (100%) rename libs/{components => react-client}/src/types/file.ts (100%) create mode 100644 libs/react-client/src/types/index.ts rename libs/{components => react-client}/src/types/message.ts (82%) rename libs/{components => react-client}/src/types/user.ts (100%) rename libs/{components/hooks/useChat => react-client/src}/useChatData.ts (100%) rename libs/{components/hooks/useChat => react-client/src}/useChatInteract.ts (97%) rename libs/{components/hooks/useChat => react-client/src}/useChatMessages.ts (100%) rename libs/{components/hooks/useChat => react-client/src}/useChatSession.ts (98%) rename libs/{components => react-client/src}/utils/message.ts (98%) create mode 100644 libs/react-client/tsconfig.json rename libs/{components => react-components}/.gitignore (100%) rename libs/{components => react-components}/README.md (100%) rename libs/{components => react-components}/contexts/MessageContext.tsx (100%) rename libs/{components => react-components}/contexts/PlaygroundContext.tsx (100%) create mode 100644 libs/react-components/hooks/index.ts rename libs/{components => react-components}/hooks/useApi.tsx (100%) rename libs/{components => react-components}/hooks/useColors.tsx (100%) rename libs/{components => react-components}/hooks/useIsDarkMode.tsx (100%) rename libs/{components => react-components}/hooks/useUpload.tsx (97%) rename libs/{components => react-components}/package.json (86%) rename libs/{components => react-components}/pnpm-lock.yaml (97%) rename libs/{components => react-components}/src/Attachments.tsx (94%) rename libs/{components => react-components}/src/ClipboardCopy.tsx (100%) rename libs/{components => react-components}/src/Code.tsx (100%) rename libs/{components => react-components}/src/Collapse.tsx (100%) rename libs/{components => react-components}/src/Dialog.tsx (100%) rename libs/{components => react-components}/src/ErrorBoundary.tsx (100%) rename libs/{components => react-components}/src/InlineCode.tsx (100%) rename libs/{components => react-components}/src/Markdown.tsx (98%) rename libs/{components => react-components}/src/NotificationCount.tsx (100%) rename libs/{components => react-components}/src/auth/Auth0.tsx (100%) rename libs/{components => react-components}/src/auth/AuthForgotPassword.tsx (99%) rename libs/{components => react-components}/src/auth/AuthLogin.tsx (100%) rename libs/{components => react-components}/src/auth/AuthResetPassword.tsx (100%) rename libs/{components => react-components}/src/auth/AuthTemplate.tsx (100%) rename libs/{components => react-components}/src/auth/AuthVerifyEmail.tsx (100%) rename libs/{components => react-components}/src/auth/Descope.tsx (100%) rename libs/{components => react-components}/src/auth/Okta.tsx (100%) rename libs/{components => react-components}/src/auth/ProviderButton.tsx (100%) rename libs/{components => react-components}/src/auth/index.ts (100%) rename libs/{components => react-components}/src/buttons/AccentButton.tsx (100%) rename libs/{components => react-components}/src/buttons/GreyButton.tsx (100%) rename libs/{components => react-components}/src/buttons/RegularButton.tsx (100%) rename libs/{components => react-components}/src/buttons/Toggle.tsx (100%) rename libs/{components => react-components}/src/buttons/index.ts (100%) rename libs/{components => react-components}/src/elements/Audio.tsx (93%) rename libs/{components => react-components}/src/elements/Avatar.tsx (89%) rename libs/{components => react-components}/src/elements/Element.tsx (94%) rename libs/{components => react-components}/src/elements/ElementSideView.tsx (98%) rename libs/{components => react-components}/src/elements/ElementView.tsx (95%) rename libs/{components => react-components}/src/elements/File.tsx (98%) rename libs/{components => react-components}/src/elements/Frame.tsx (100%) rename libs/{components => react-components}/src/elements/Image.tsx (95%) rename libs/{components => react-components}/src/elements/InlinedAudioList.tsx (89%) rename libs/{components => react-components}/src/elements/InlinedElements.tsx (96%) rename libs/{components => react-components}/src/elements/InlinedFileList.tsx (88%) rename libs/{components => react-components}/src/elements/InlinedImageList.tsx (84%) rename libs/{components => react-components}/src/elements/InlinedPDFList.tsx (89%) rename libs/{components => react-components}/src/elements/InlinedPlotlyList.tsx (89%) rename libs/{components => react-components}/src/elements/InlinedTextList.tsx (90%) rename libs/{components => react-components}/src/elements/InlinedVideoList.tsx (84%) rename libs/{components => react-components}/src/elements/ListWithSize.tsx (94%) rename libs/{components => react-components}/src/elements/PDF.tsx (90%) rename libs/{components => react-components}/src/elements/Plotly.tsx (95%) rename libs/{components => react-components}/src/elements/Text.tsx (92%) rename libs/{components => react-components}/src/elements/Video.tsx (87%) rename libs/{components => react-components}/src/elements/index.ts (100%) rename libs/{components => react-components}/src/index.ts (92%) rename libs/{components => react-components}/src/inputs/FormInput.tsx (100%) rename libs/{components => react-components}/src/inputs/InputLabel.tsx (100%) rename libs/{components => react-components}/src/inputs/InputStateHandler.tsx (100%) rename libs/{components => react-components}/src/inputs/SliderInput.tsx (100%) rename libs/{components => react-components}/src/inputs/SwitchInput.tsx (100%) rename libs/{components => react-components}/src/inputs/TagsInput.tsx (100%) rename libs/{components => react-components}/src/inputs/TextInput.tsx (100%) rename libs/{components => react-components}/src/inputs/index.ts (100%) rename libs/{components => react-components}/src/inputs/selects/MenuItem.tsx (100%) rename libs/{components => react-components}/src/inputs/selects/SelectCategoryInput.tsx (100%) rename libs/{components => react-components}/src/inputs/selects/SelectInput.tsx (100%) rename libs/{components => react-components}/src/messages/Message.tsx (96%) rename libs/{components => react-components}/src/messages/MessageContainer.tsx (92%) rename libs/{components => react-components}/src/messages/Messages.tsx (91%) rename libs/{components => react-components}/src/messages/components/ActionButton.tsx (95%) rename libs/{components => react-components}/src/messages/components/ActionDrawerButton.tsx (97%) rename libs/{components => react-components}/src/messages/components/AskUploadButton.tsx (97%) rename libs/{components => react-components}/src/messages/components/Author.tsx (97%) rename libs/{components => react-components}/src/messages/components/DetailsButton.tsx (97%) rename libs/{components => react-components}/src/messages/components/ElementRef.tsx (91%) rename libs/{components => react-components}/src/messages/components/FeedbackButtons.tsx (91%) rename libs/{components => react-components}/src/messages/components/MessageActions.tsx (93%) rename libs/{components => react-components}/src/messages/components/MessageButtons.tsx (95%) rename libs/{components => react-components}/src/messages/components/MessageContent.tsx (95%) rename libs/{components => react-components}/src/messages/components/MessageTime.tsx (100%) rename libs/{components => react-components}/src/messages/components/PlaygroundButton.tsx (93%) rename libs/{components => react-components}/src/messages/index.ts (100%) rename libs/{components => react-components}/src/playground/actionBar.tsx (100%) rename libs/{components => react-components}/src/playground/basic.tsx (97%) rename libs/{components => react-components}/src/playground/chat.tsx (98%) rename libs/{components => react-components}/src/playground/editor/EditorWrapper.tsx (87%) rename libs/{components => react-components}/src/playground/editor/MessageWrapper.tsx (98%) rename libs/{components => react-components}/src/playground/editor/completion.tsx (100%) rename libs/{components => react-components}/src/playground/editor/formatted.tsx (99%) rename libs/{components => react-components}/src/playground/editor/functionModal.tsx (100%) rename libs/{components => react-components}/src/playground/editor/promptMessage.tsx (96%) rename libs/{components => react-components}/src/playground/editor/template/index.tsx (98%) rename libs/{components => react-components}/src/playground/editor/template/variable.tsx (100%) rename libs/{components => react-components}/src/playground/editor/variableModal.tsx (100%) rename libs/{components => react-components}/src/playground/functionInput.tsx (100%) rename libs/{components => react-components}/src/playground/header.tsx (100%) rename libs/{components => react-components}/src/playground/helpers/format.ts (100%) rename libs/{components => react-components}/src/playground/helpers/provider.ts (100%) rename libs/{components => react-components}/src/playground/index.tsx (100%) rename libs/{components => react-components}/src/playground/modeToggle.tsx (100%) rename libs/{components => react-components}/src/playground/modelSettings.tsx (99%) rename libs/{components => react-components}/src/playground/submitButton.tsx (100%) rename libs/{components => react-components}/src/playground/variableInput.tsx (100%) rename libs/{components => react-components}/src/types/Input.ts (100%) rename libs/{components => react-components}/src/types/NotificationCount.tsx (100%) rename libs/{components => react-components}/src/types/index.ts (50%) rename libs/{components => react-components}/src/types/messageContext.ts (78%) rename libs/{components => react-components}/src/types/playground.ts (66%) rename libs/{components => react-components}/src/types/playgroundContext.ts (94%) rename libs/{components => react-components}/tests/content.spec.tsx (98%) rename libs/{components => react-components}/tests/message.spec.tsx (100%) rename libs/{components => react-components}/tests/setup-tests.ts (100%) rename libs/{components => react-components}/theme/index.ts (100%) rename libs/{components => react-components}/theme/palette.ts (100%) rename libs/{components => react-components}/theme/theme.tsx (100%) rename libs/{components => react-components}/tsconfig.json (100%) rename libs/{components => react-components}/utils/exportToFile.ts (100%) rename libs/{components => react-components}/utils/omit.ts (100%) rename libs/{components => react-components}/vitest.config.ts (64%) delete mode 100644 libs/sdk/package.json delete mode 100644 libs/sdk/pnpm-lock.yaml delete mode 100644 libs/sdk/src/index.ts delete mode 100644 libs/sdk/tsconfig.json diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index edcb514477..3c99630500 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -18,7 +18,7 @@ I've copy/pasted the whole document there, without the previous two headings. - [Install python dependencies](#install-python-dependencies) - [Start the Chainlit server from source](#start-the-chainlit-server-from-source) - [Start the UI from source](#start-the-ui-from-source) - - [Develop locally on `libs/components`](#develop-locally-on--libs-components-) + - [Develop locally on `libs/react-components`](#develop-locally-on-libsreact-components) - [Run the tests](#run-the-tests) - [Run one test](#run-one-test) @@ -117,18 +117,18 @@ pnpm run dev --port 5174 If you visit `http://127.0.0.1:5174/`, it should connect to your local server. If the local server is not running, it should say that it can't connect to the server. -## Develop locally on `libs/components` +## Develop locally on `libs/react-components` -Reusable UI components are living in the separate npm package `libs/components`. The main Chainlit UI build and import that package automatically. +Reusable UI components are living in the separate npm package `libs/react-components`. The main Chainlit UI build and import that package automatically. You can enable hot module replacement for development. ```sh -cd libs/components +cd libs/react-components pnpm run build:watch ``` -This will watch for file changes in `libs/components` and automatically rebuild the library as you develop. +This will watch for file changes in `libs/react-components` and automatically rebuild the library as you develop. ## Run the tests diff --git a/.github/workflows/tests-components.yaml b/.github/workflows/tests-components.yaml index 7443321c8f..30c254d833 100644 --- a/.github/workflows/tests-components.yaml +++ b/.github/workflows/tests-components.yaml @@ -1,9 +1,9 @@ -name: Tests @chainlit/components +name: Tests @chainlit/react-components # on: # push: # paths: -# - 'libs/components' +# - 'libs/react-components' on: [workflow_call] @@ -26,8 +26,8 @@ jobs: - name: Install JS dependencies run: pnpm install --no-frozen-lockfile - name: Build components - run: pnpm run build:components + run: pnpm run build:react-components - name: Lint components - run: pnpm run lint:components + run: pnpm run lint:react-components - name: Run tests - run: pnpm test:components + run: pnpm test:react-components diff --git a/frontend/package.json b/frontend/package.json index 77633c2935..b36a3037e8 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,7 +12,8 @@ "format": "prettier src/**/*.{ts,tsx} --write --loglevel error" }, "dependencies": { - "@chainlit/components": "workspace:^", + "@chainlit/react-components": "workspace:^", + "@chainlit/react-client": "workspace:^", "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@mui/icons-material": "^5.14.9", @@ -27,7 +28,7 @@ "react-hotkeys-hook": "^4.4.1", "react-router-dom": "^6.15.0", "react-speech-recognition": "^3.10.0", - "recoil": "^0.7.6", + "recoil": "^0.7.7", "regenerator-runtime": "^0.14.0", "socket.io-client": "^4.7.2", "swr": "^2.2.2", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index 9cdd54fb57..1e03e54686 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -5,9 +5,12 @@ settings: excludeLinksFromLockfile: false dependencies: - '@chainlit/components': + '@chainlit/react-client': specifier: workspace:^ - version: link:../libs/components + version: link:../libs/react-client + '@chainlit/react-components': + specifier: workspace:^ + version: link:../libs/react-components '@emotion/react': specifier: ^11.11.1 version: 11.11.1(@types/react@18.2.0)(react@18.2.0) @@ -51,8 +54,8 @@ dependencies: specifier: ^3.10.0 version: 3.10.0(react@18.2.0) recoil: - specifier: ^0.7.6 - version: 0.7.6(react-dom@18.2.0)(react@18.2.0) + specifier: ^0.7.7 + version: 0.7.7(react-dom@18.2.0)(react@18.2.0) regenerator-runtime: specifier: ^0.14.0 version: 0.14.0 @@ -508,8 +511,8 @@ packages: dependencies: '@babel/runtime': 7.23.2 '@emotion/is-prop-valid': 1.2.1 - '@mui/types': 7.2.8(@types/react@18.2.0) - '@mui/utils': 5.14.17(@types/react@18.2.0)(react@18.2.0) + '@mui/types': 7.2.9(@types/react@18.2.0) + '@mui/utils': 5.14.18(@types/react@18.2.0)(react@18.2.0) '@popperjs/core': 2.11.8 '@types/react': 18.2.0 clsx: 1.2.1 @@ -532,8 +535,8 @@ packages: dependencies: '@babel/runtime': 7.23.2 '@floating-ui/react-dom': 2.0.4(react-dom@18.2.0)(react@18.2.0) - '@mui/types': 7.2.8(@types/react@18.2.0) - '@mui/utils': 5.14.17(@types/react@18.2.0)(react@18.2.0) + '@mui/types': 7.2.9(@types/react@18.2.0) + '@mui/utils': 5.14.18(@types/react@18.2.0)(react@18.2.0) '@popperjs/core': 2.11.8 '@types/react': 18.2.0 clsx: 2.0.0 @@ -542,8 +545,8 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: false - /@mui/core-downloads-tracker@5.14.17: - resolution: {integrity: sha512-eE0uxrpJAEL2ZXkeGLKg8HQDafsiXY+6eNpP4lcv3yIjFfGbU6Hj9/P7Adt8jpU+6JIhmxvILGj2r27pX+zdrQ==} + /@mui/core-downloads-tracker@5.14.18: + resolution: {integrity: sha512-yFpF35fEVDV81nVktu0BE9qn2dD/chs7PsQhlyaV3EnTeZi9RZBuvoEfRym1/jmhJ2tcfeWXiRuHG942mQXJJQ==} dev: false /@mui/icons-material@5.14.9(@mui/material@5.14.10)(@types/react@18.2.0)(react@18.2.0): @@ -586,9 +589,9 @@ packages: '@emotion/styled': 11.11.0(@emotion/react@11.11.1)(@types/react@18.2.0)(react@18.2.0) '@mui/base': 5.0.0-alpha.120(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) '@mui/material': 5.14.10(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) - '@mui/system': 5.14.17(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react@18.2.0) - '@mui/types': 7.2.8(@types/react@18.2.0) - '@mui/utils': 5.14.17(@types/react@18.2.0)(react@18.2.0) + '@mui/system': 5.14.18(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react@18.2.0) + '@mui/types': 7.2.9(@types/react@18.2.0) + '@mui/utils': 5.14.18(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 clsx: 1.2.1 prop-types: 15.8.1 @@ -618,10 +621,10 @@ packages: '@emotion/react': 11.11.1(@types/react@18.2.0)(react@18.2.0) '@emotion/styled': 11.11.0(@emotion/react@11.11.1)(@types/react@18.2.0)(react@18.2.0) '@mui/base': 5.0.0-beta.16(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) - '@mui/core-downloads-tracker': 5.14.17 - '@mui/system': 5.14.17(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react@18.2.0) - '@mui/types': 7.2.8(@types/react@18.2.0) - '@mui/utils': 5.14.17(@types/react@18.2.0)(react@18.2.0) + '@mui/core-downloads-tracker': 5.14.18 + '@mui/system': 5.14.18(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react@18.2.0) + '@mui/types': 7.2.9(@types/react@18.2.0) + '@mui/utils': 5.14.18(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 '@types/react-transition-group': 4.4.9 clsx: 2.0.0 @@ -633,8 +636,8 @@ packages: react-transition-group: 4.4.5(react-dom@18.2.0)(react@18.2.0) dev: false - /@mui/private-theming@5.14.17(@types/react@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-u4zxsCm9xmQrlhVPug+Ccrtsjv7o2+rehvrgHoh0siSguvVgVQq5O3Hh10+tp/KWQo2JR4/nCEwquSXgITS1+g==} + /@mui/private-theming@5.14.18(@types/react@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-WSgjqRlzfHU+2Rou3HlR2Gqfr4rZRsvFgataYO3qQ0/m6gShJN+lhVEvwEiJ9QYyVzMDvNpXZAcqp8Y2Vl+PAw==} engines: {node: '>=12.0.0'} peerDependencies: '@types/react': ^17.0.0 || ^18.0.0 @@ -644,14 +647,14 @@ packages: optional: true dependencies: '@babel/runtime': 7.23.2 - '@mui/utils': 5.14.17(@types/react@18.2.0)(react@18.2.0) + '@mui/utils': 5.14.18(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 prop-types: 15.8.1 react: 18.2.0 dev: false - /@mui/styled-engine@5.14.17(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(react@18.2.0): - resolution: {integrity: sha512-AqpVjBEA7wnBvKPW168bNlqB6EN7HxTjLOY7oi275AzD/b1C7V0wqELy6NWoJb2yya5sRf7ENf4iNi3+T5cOgw==} + /@mui/styled-engine@5.14.18(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(react@18.2.0): + resolution: {integrity: sha512-pW8bpmF9uCB5FV2IPk6mfbQCjPI5vGI09NOLhtGXPeph/4xIfC3JdIX0TILU0WcTs3aFQqo6s2+1SFgIB9rCXA==} engines: {node: '>=12.0.0'} peerDependencies: '@emotion/react': ^11.4.1 @@ -672,8 +675,8 @@ packages: react: 18.2.0 dev: false - /@mui/system@5.14.17(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-Ccz3XlbCqka6DnbHfpL3o3TfOeWQPR+ewvNAgm8gnS9M0yVMmzzmY6z0w/C1eebb+7ZP7IoLUj9vojg/GBaTPg==} + /@mui/system@5.14.18(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-hSQQdb3KF72X4EN2hMEiv8EYJZSflfdd1TRaGPoR7CIAG347OxCslpBUwWngYobaxgKvq6xTrlIl+diaactVww==} engines: {node: '>=12.0.0'} peerDependencies: '@emotion/react': ^11.5.0 @@ -691,10 +694,10 @@ packages: '@babel/runtime': 7.23.2 '@emotion/react': 11.11.1(@types/react@18.2.0)(react@18.2.0) '@emotion/styled': 11.11.0(@emotion/react@11.11.1)(@types/react@18.2.0)(react@18.2.0) - '@mui/private-theming': 5.14.17(@types/react@18.2.0)(react@18.2.0) - '@mui/styled-engine': 5.14.17(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(react@18.2.0) - '@mui/types': 7.2.8(@types/react@18.2.0) - '@mui/utils': 5.14.17(@types/react@18.2.0)(react@18.2.0) + '@mui/private-theming': 5.14.18(@types/react@18.2.0)(react@18.2.0) + '@mui/styled-engine': 5.14.18(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(react@18.2.0) + '@mui/types': 7.2.9(@types/react@18.2.0) + '@mui/utils': 5.14.18(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 clsx: 2.0.0 csstype: 3.1.2 @@ -702,8 +705,8 @@ packages: react: 18.2.0 dev: false - /@mui/types@7.2.8(@types/react@18.2.0): - resolution: {integrity: sha512-9u0ji+xspl96WPqvrYJF/iO+1tQ1L5GTaDOeG3vCR893yy7VcWwRNiVMmPdPNpMDqx0WV1wtEW9OMwK9acWJzQ==} + /@mui/types@7.2.9(@types/react@18.2.0): + resolution: {integrity: sha512-k1lN/PolaRZfNsRdAqXtcR71sTnv3z/VCCGPxU8HfdftDkzi335MdJ6scZxvofMAd/K/9EbzCZTFBmlNpQVdCg==} peerDependencies: '@types/react': ^17.0.0 || ^18.0.0 peerDependenciesMeta: @@ -713,8 +716,8 @@ packages: '@types/react': 18.2.0 dev: false - /@mui/utils@5.14.17(@types/react@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-yxnWgSS4J6DMFPw2Dof85yBkG02VTbEiqsikymMsnZnXDurtVGTIhlNuV24GTmFTuJMzEyTTU9UF+O7zaL8LEQ==} + /@mui/utils@5.14.18(@types/react@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-HZDRsJtEZ7WMSnrHV9uwScGze4wM/Y+u6pDVo+grUjt5yXzn+wI8QX/JwTHh9YSw/WpnUL80mJJjgCnWj2VrzQ==} engines: {node: '>=12.0.0'} peerDependencies: '@types/react': ^17.0.0 || ^18.0.0 @@ -1360,8 +1363,8 @@ packages: loose-envify: 1.4.0 dev: false - /recoil@0.7.6(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-hsBEw7jFdpBCY/tu2GweiyaqHKxVj6EqF2/SfrglbKvJHhpN57SANWvPW+gE90i3Awi+A5gssOd3u+vWlT+g7g==} + /recoil@0.7.7(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-8Og5KPQW9LwC577Vc7Ug2P0vQshkv1y3zG3tSSkWMqkWSwHmE+by06L8JtnGocjW6gcCvfwB3YtrJG6/tWivNQ==} peerDependencies: react: '>=16.13.1' react-dom: '*' diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index d3a4501d01..9aa7208efa 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -8,8 +8,8 @@ import { router } from 'router'; import { Box, GlobalStyles } from '@mui/material'; import { Theme, ThemeProvider } from '@mui/material/styles'; -import { useChatSession } from '@chainlit/components'; -import { makeTheme } from '@chainlit/components/theme'; +import { useChatSession } from '@chainlit/react-client'; +import { makeTheme } from '@chainlit/react-components/theme'; import Hotkeys from 'components/Hotkeys'; import SettingsModal from 'components/molecules/settingsModal'; diff --git a/frontend/src/api/chainlitApi.ts b/frontend/src/api/chainlitApi.ts index 74ed819dbf..ede025a7d4 100644 --- a/frontend/src/api/chainlitApi.ts +++ b/frontend/src/api/chainlitApi.ts @@ -1,4 +1,4 @@ -import { IConversation, IPrompt } from '@chainlit/components'; +import { IConversation, IPrompt } from '@chainlit/react-client'; import { IPageInfo, diff --git a/frontend/src/components/atoms/element/sideView.tsx b/frontend/src/components/atoms/element/sideView.tsx index b1953449bd..5ef5b8eed1 100644 --- a/frontend/src/components/atoms/element/sideView.tsx +++ b/frontend/src/components/atoms/element/sideView.tsx @@ -1,6 +1,6 @@ import { useRecoilState } from 'recoil'; -import { ElementSideView } from '@chainlit/components'; +import { ElementSideView } from '@chainlit/react-components'; import { sideViewState } from 'state/project'; diff --git a/frontend/src/components/molecules/chatProfiles.tsx b/frontend/src/components/molecules/chatProfiles.tsx index ded59f29b6..9911dc828f 100644 --- a/frontend/src/components/molecules/chatProfiles.tsx +++ b/frontend/src/components/molecules/chatProfiles.tsx @@ -4,14 +4,13 @@ import { useRecoilValue } from 'recoil'; import { Box, Popover, Tab, Tabs } from '@mui/material'; +import { useChatInteract, useChatSession } from '@chainlit/react-client'; import { InputStateHandler, Markdown, grey, - useChatInteract, - useChatSession, useIsDarkMode -} from '@chainlit/components'; +} from '@chainlit/react-components'; import { projectSettingsState } from 'state/project'; diff --git a/frontend/src/components/molecules/newChatButton.tsx b/frontend/src/components/molecules/newChatButton.tsx index 4ffbb0373f..d43fc7dd35 100644 --- a/frontend/src/components/molecules/newChatButton.tsx +++ b/frontend/src/components/molecules/newChatButton.tsx @@ -4,7 +4,8 @@ import { useNavigate } from 'react-router-dom'; import AddIcon from '@mui/icons-material/Add'; import { Box } from '@mui/material'; -import { AccentButton, useChatInteract } from '@chainlit/components'; +import { useChatInteract } from '@chainlit/react-client'; +import { AccentButton } from '@chainlit/react-components'; import NewChatDialog from './newChatDialog'; diff --git a/frontend/src/components/molecules/newChatDialog.tsx b/frontend/src/components/molecules/newChatDialog.tsx index cf74ae6170..ffe7d5c54c 100644 --- a/frontend/src/components/molecules/newChatDialog.tsx +++ b/frontend/src/components/molecules/newChatDialog.tsx @@ -4,7 +4,7 @@ import DialogContent from '@mui/material/DialogContent'; import DialogContentText from '@mui/material/DialogContentText'; import DialogTitle from '@mui/material/DialogTitle'; -import { AccentButton, RegularButton } from '@chainlit/components'; +import { AccentButton, RegularButton } from '@chainlit/react-components'; type Props = { open: boolean; diff --git a/frontend/src/components/molecules/settingsModal.tsx b/frontend/src/components/molecules/settingsModal.tsx index fa5e00a955..140a8e1593 100644 --- a/frontend/src/components/molecules/settingsModal.tsx +++ b/frontend/src/components/molecules/settingsModal.tsx @@ -14,7 +14,7 @@ import { ListSubheader } from '@mui/material'; -import { SwitchInput } from '@chainlit/components'; +import { SwitchInput } from '@chainlit/react-components'; import { settingsState } from 'state/settings'; diff --git a/frontend/src/components/molecules/tasklist/Task.tsx b/frontend/src/components/molecules/tasklist/Task.tsx index b9a57bcfdb..5aa9986cc4 100644 --- a/frontend/src/components/molecules/tasklist/Task.tsx +++ b/frontend/src/components/molecules/tasklist/Task.tsx @@ -2,7 +2,7 @@ import { useSetRecoilState } from 'recoil'; import { Box, ListItem, ListItemButton, useTheme } from '@mui/material'; -import { grey } from '@chainlit/components/theme'; +import { grey } from '@chainlit/react-components/theme'; import { highlightMessage } from 'state/project'; diff --git a/frontend/src/components/molecules/tasklist/TaskList.tsx b/frontend/src/components/molecules/tasklist/TaskList.tsx index a0c189c489..cc9d90dbf1 100644 --- a/frontend/src/components/molecules/tasklist/TaskList.tsx +++ b/frontend/src/components/molecules/tasklist/TaskList.tsx @@ -1,7 +1,7 @@ import { Box, Chip, List, Theme, useTheme } from '@mui/material'; -import { useChatData } from '@chainlit/components'; -import { grey } from '@chainlit/components/theme'; +import { useChatData } from '@chainlit/react-client'; +import { grey } from '@chainlit/react-components/theme'; import { ITaskList, Task } from './Task'; diff --git a/frontend/src/components/molecules/tasklist/TaskStatusIcon.tsx b/frontend/src/components/molecules/tasklist/TaskStatusIcon.tsx index 3c071fab83..9f6ed35374 100644 --- a/frontend/src/components/molecules/tasklist/TaskStatusIcon.tsx +++ b/frontend/src/components/molecules/tasklist/TaskStatusIcon.tsx @@ -1,6 +1,6 @@ import { Box, CircularProgress, SvgIcon } from '@mui/material'; -import { green, grey, primary, white } from '@chainlit/components/theme'; +import { green, grey, primary, white } from '@chainlit/react-components/theme'; import type { ITask } from './Task'; diff --git a/frontend/src/components/organisms/chat/Messages/container.tsx b/frontend/src/components/organisms/chat/Messages/container.tsx index 94d927630c..d5296c4c5a 100644 --- a/frontend/src/components/organisms/chat/Messages/container.tsx +++ b/frontend/src/components/organisms/chat/Messages/container.tsx @@ -5,15 +5,17 @@ import { useNavigate } from 'react-router-dom'; import { useRecoilValue, useSetRecoilState } from 'recoil'; import { - MessageContainer as CMessageContainer, IAction, IAsk, IAvatarElement, IFunction, IMessage, IMessageElement, - ITool -} from '@chainlit/components'; + ITool, + messagesState, + updateMessageById +} from '@chainlit/react-client'; +import { MessageContainer as CMessageContainer } from '@chainlit/react-components'; import { playgroundState } from 'state/playground'; import { highlightMessage, sideViewState } from 'state/project'; @@ -49,6 +51,7 @@ const MessageContainer = memo( const appSettings = useRecoilValue(settingsState); const projectSettings = useRecoilValue(projectSettingsState); const setPlayground = useSetRecoilState(playgroundState); + const setMessages = useSetRecoilState(messagesState); const setSideView = useSetRecoilState(sideViewState); const highlightedMessage = useRecoilValue(highlightMessage); @@ -94,7 +97,7 @@ const MessageContainer = memo( const onFeedbackUpdated = useCallback( async ( - messageId: string, + message: IMessage, feedback: number, onSuccess: () => void, feedbackComment?: string @@ -102,7 +105,7 @@ const MessageContainer = memo( try { await toast.promise( ChainlitAPI.setHumanFeedback( - messageId!, + message.id, feedback, feedbackComment, accessToken @@ -115,7 +118,13 @@ const MessageContainer = memo( } } ); - + setMessages((prev) => + updateMessageById(prev, message.id, { + ...message, + humanFeedback: feedback, + humanFeedbackComment: feedbackComment + }) + ); onSuccess(); } catch (err) { console.log(err); diff --git a/frontend/src/components/organisms/chat/Messages/index.tsx b/frontend/src/components/organisms/chat/Messages/index.tsx index dd8fca82fd..98aa969ef1 100644 --- a/frontend/src/components/organisms/chat/Messages/index.tsx +++ b/frontend/src/components/organisms/chat/Messages/index.tsx @@ -2,7 +2,7 @@ import { useChatData, useChatInteract, useChatMessages -} from '@chainlit/components'; +} from '@chainlit/react-client'; import { IProjectSettings } from 'state/project'; diff --git a/frontend/src/components/organisms/chat/Messages/welcomeScreen.tsx b/frontend/src/components/organisms/chat/Messages/welcomeScreen.tsx index aa54e5e003..c1617a47ee 100644 --- a/frontend/src/components/organisms/chat/Messages/welcomeScreen.tsx +++ b/frontend/src/components/organisms/chat/Messages/welcomeScreen.tsx @@ -2,7 +2,7 @@ import { memo } from 'react'; import { Box } from '@mui/material'; -import { Markdown } from '@chainlit/components'; +import { Markdown } from '@chainlit/react-components'; const WelcomeScreen = memo(({ markdown }: { markdown?: string }) => { if (!markdown) return ; diff --git a/frontend/src/components/organisms/chat/history/index.tsx b/frontend/src/components/organisms/chat/history/index.tsx index 8eab0edc2e..9dcc31d572 100644 --- a/frontend/src/components/organisms/chat/history/index.tsx +++ b/frontend/src/components/organisms/chat/history/index.tsx @@ -14,7 +14,7 @@ import { Typography } from '@mui/material'; -import { grey } from '@chainlit/components/theme'; +import { grey } from '@chainlit/react-components/theme'; import { chatHistoryState } from 'state/chatHistory'; diff --git a/frontend/src/components/organisms/chat/index.tsx b/frontend/src/components/organisms/chat/index.tsx index 089703d967..9267cb0cc0 100644 --- a/frontend/src/components/organisms/chat/index.tsx +++ b/frontend/src/components/organisms/chat/index.tsx @@ -5,12 +5,8 @@ import { v4 as uuidv4 } from 'uuid'; import { Alert, Box } from '@mui/material'; -import { - ErrorBoundary, - IFileResponse, - useChatData, - useUpload -} from '@chainlit/components'; +import { IFileResponse, useChatData } from '@chainlit/react-client'; +import { ErrorBoundary, useUpload } from '@chainlit/react-components'; import SideView from 'components/atoms/element/sideView'; import ChatProfiles from 'components/molecules/chatProfiles'; diff --git a/frontend/src/components/organisms/chat/inputBox/UploadButton.tsx b/frontend/src/components/organisms/chat/inputBox/UploadButton.tsx index a93156aeb9..59efbd8257 100644 --- a/frontend/src/components/organisms/chat/inputBox/UploadButton.tsx +++ b/frontend/src/components/organisms/chat/inputBox/UploadButton.tsx @@ -3,8 +3,8 @@ import { useRecoilValue } from 'recoil'; import AttachFile from '@mui/icons-material/AttachFile'; import { IconButton, Tooltip } from '@mui/material'; -import { FileSpec, IFileResponse } from '@chainlit/components'; -import { useUpload } from '@chainlit/components'; +import { FileSpec, IFileResponse } from '@chainlit/react-client'; +import { useUpload } from '@chainlit/react-components'; import { projectSettingsState } from 'state/project'; diff --git a/frontend/src/components/organisms/chat/inputBox/index.tsx b/frontend/src/components/organisms/chat/inputBox/index.tsx index 218c341c34..687d892a11 100644 --- a/frontend/src/components/organisms/chat/inputBox/index.tsx +++ b/frontend/src/components/organisms/chat/inputBox/index.tsx @@ -10,7 +10,7 @@ import { IFileResponse, IMessage, useChatInteract -} from '@chainlit/components'; +} from '@chainlit/react-client'; import { useAuth } from 'hooks/auth'; diff --git a/frontend/src/components/organisms/chat/inputBox/input.tsx b/frontend/src/components/organisms/chat/inputBox/input.tsx index 421364b915..45a7ee1224 100644 --- a/frontend/src/components/organisms/chat/inputBox/input.tsx +++ b/frontend/src/components/organisms/chat/inputBox/input.tsx @@ -8,12 +8,12 @@ import { Box, IconButton, Stack, TextField } from '@mui/material'; import InputAdornment from '@mui/material/InputAdornment'; import { - Attachments, FileSpec, IFileElement, IFileResponse, useChatData -} from '@chainlit/components'; +} from '@chainlit/react-client'; +import { Attachments } from '@chainlit/react-components'; import HistoryButton from 'components/organisms/chat/history'; diff --git a/frontend/src/components/organisms/chat/settings.tsx b/frontend/src/components/organisms/chat/settings.tsx index b515dd3522..fa9d3f1f65 100644 --- a/frontend/src/components/organisms/chat/settings.tsx +++ b/frontend/src/components/organisms/chat/settings.tsx @@ -10,14 +10,13 @@ import { DialogTitle } from '@mui/material'; +import { useChatData, useChatInteract } from '@chainlit/react-client'; import { AccentButton, FormInput, RegularButton, - TFormInputValue, - useChatData, - useChatInteract -} from '@chainlit/components'; + TFormInputValue +} from '@chainlit/react-components'; import { chatSettingsOpenState } from 'state/project'; @@ -71,7 +70,7 @@ export default function ChatSettingsModal() { gap: '15px' }} > - {chatSettingsInputs.map((input) => ( + {chatSettingsInputs.map((input: any) => ( + ); } diff --git a/frontend/src/helpers/groupeByDate.ts b/frontend/src/helpers/groupeByDate.ts index db1f8bf9fc..0a6689d711 100644 --- a/frontend/src/helpers/groupeByDate.ts +++ b/frontend/src/helpers/groupeByDate.ts @@ -1,4 +1,4 @@ -import { IConversation } from '@chainlit/components'; +import { IConversation } from '@chainlit/react-client'; export const groupByDate = (data: IConversation[]) => { const groupedData: { [key: string]: IConversation[] } = {}; diff --git a/frontend/src/hooks/auth.ts b/frontend/src/hooks/auth.ts index 9699bc9bbc..fa4c2a5200 100644 --- a/frontend/src/hooks/auth.ts +++ b/frontend/src/hooks/auth.ts @@ -4,7 +4,7 @@ import { useEffect } from 'react'; import { useRecoilState, useSetRecoilState } from 'recoil'; import useSWRImmutable from 'swr/immutable'; -import { IAppUser } from '@chainlit/components'; +import { IAppUser } from '@chainlit/react-client'; import { conversationsHistoryState } from 'state/conversations'; import { accessTokenState, userState } from 'state/user'; diff --git a/frontend/src/hooks/useLLMProviders.ts b/frontend/src/hooks/useLLMProviders.ts index 12557a20bc..7026faf1f9 100644 --- a/frontend/src/hooks/useLLMProviders.ts +++ b/frontend/src/hooks/useLLMProviders.ts @@ -2,7 +2,7 @@ import { useEffect } from 'react'; import toast from 'react-hot-toast'; import { useSetRecoilState } from 'recoil'; -import { IPlayground } from '@chainlit/components'; +import { IPlayground } from '@chainlit/react-components'; import { useApi } from 'hooks/useApi'; diff --git a/frontend/src/pages/Conversation.tsx b/frontend/src/pages/Conversation.tsx index 6997b1bff4..1054c8c18d 100644 --- a/frontend/src/pages/Conversation.tsx +++ b/frontend/src/pages/Conversation.tsx @@ -4,7 +4,7 @@ import { useRecoilState } from 'recoil'; import { Box } from '@mui/material'; -import { IConversation } from '@chainlit/components'; +import { IConversation } from '@chainlit/react-client'; import { Conversation } from 'components/organisms/conversationsHistory/Conversation'; diff --git a/frontend/src/pages/Design.tsx b/frontend/src/pages/Design.tsx index 2c023edb98..9df903c2b8 100644 --- a/frontend/src/pages/Design.tsx +++ b/frontend/src/pages/Design.tsx @@ -5,9 +5,13 @@ import { useRecoilState } from 'recoil'; import { Typography } from '@mui/material'; import Box from '@mui/material/Box'; -import { FormInput, InputLabel, Toggle } from '@chainlit/components'; -import { useIsDarkMode } from '@chainlit/components'; -import { green, grey, primary } from '@chainlit/components/theme'; +import { + FormInput, + InputLabel, + Toggle, + useIsDarkMode +} from '@chainlit/react-components'; +import { green, grey, primary } from '@chainlit/react-components/theme'; import { settingsState } from 'state/settings'; diff --git a/frontend/src/pages/Element.tsx b/frontend/src/pages/Element.tsx index f6c7e20d70..3409acc6d6 100644 --- a/frontend/src/pages/Element.tsx +++ b/frontend/src/pages/Element.tsx @@ -3,11 +3,8 @@ import { useNavigate, useParams } from 'react-router-dom'; import Page from 'pages/Page'; -import { - ElementView, - IMessageElement, - useChatData -} from '@chainlit/components'; +import { IMessageElement, useChatData } from '@chainlit/react-client'; +import { ElementView } from '@chainlit/react-components'; import { useQuery } from 'hooks/query'; import { useApi } from 'hooks/useApi'; diff --git a/frontend/src/pages/Env.tsx b/frontend/src/pages/Env.tsx index fd57e3d3bc..2dff0299f9 100644 --- a/frontend/src/pages/Env.tsx +++ b/frontend/src/pages/Env.tsx @@ -6,7 +6,7 @@ import * as yup from 'yup'; import { Alert, Box, Button, Typography } from '@mui/material'; -import { TextInput } from '@chainlit/components'; +import { TextInput } from '@chainlit/react-components'; import { Header } from 'components/organisms/header'; diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx index 7d27ca3cc7..5104e2df13 100644 --- a/frontend/src/pages/Login.tsx +++ b/frontend/src/pages/Login.tsx @@ -2,7 +2,7 @@ import { httpEndpoint } from 'api'; import { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; -import { AuthLogin } from '@chainlit/components'; +import { AuthLogin } from '@chainlit/react-components'; import { Logo } from 'components/atoms/logo'; diff --git a/frontend/src/pages/ResumeButton.tsx b/frontend/src/pages/ResumeButton.tsx index 8f5bcc679e..4d199cc99a 100644 --- a/frontend/src/pages/ResumeButton.tsx +++ b/frontend/src/pages/ResumeButton.tsx @@ -4,7 +4,7 @@ import { useRecoilValue } from 'recoil'; import { Box, Button } from '@mui/material'; -import { useChatInteract } from '@chainlit/components'; +import { useChatInteract } from '@chainlit/react-client'; import WaterMark from 'components/organisms/chat/inputBox/waterMark'; diff --git a/frontend/src/state/chat.ts b/frontend/src/state/chat.ts index 8d4532b206..ff44d3689b 100644 --- a/frontend/src/state/chat.ts +++ b/frontend/src/state/chat.ts @@ -1,6 +1,6 @@ import { atom } from 'recoil'; -import { IFileElement } from '@chainlit/components'; +import { IFileElement } from '@chainlit/react-client'; export const attachmentsState = atom({ key: 'Attachments', diff --git a/frontend/src/state/playground.ts b/frontend/src/state/playground.ts index 545b1b7aad..ee18d5bc08 100644 --- a/frontend/src/state/playground.ts +++ b/frontend/src/state/playground.ts @@ -1,6 +1,6 @@ import { atom } from 'recoil'; -import { IPlayground, PromptMode } from '@chainlit/components'; +import { IPlayground, PromptMode } from '@chainlit/react-components'; export const playgroundState = atom({ key: 'Playground', diff --git a/frontend/src/state/project.ts b/frontend/src/state/project.ts index d110392b96..4fd3c91ced 100644 --- a/frontend/src/state/project.ts +++ b/frontend/src/state/project.ts @@ -1,6 +1,6 @@ import { atom } from 'recoil'; -import { IMessage, IMessageElement } from '@chainlit/components'; +import { IMessage, IMessageElement } from '@chainlit/react-client'; export interface ChatProfile { icon: string; diff --git a/frontend/src/state/user.ts b/frontend/src/state/user.ts index e815656220..18047ec200 100644 --- a/frontend/src/state/user.ts +++ b/frontend/src/state/user.ts @@ -1,6 +1,6 @@ import { atom } from 'recoil'; -import { IAppUser, Role } from '@chainlit/components'; +import { IAppUser, Role } from '@chainlit/react-client'; export const accessTokenState = atom({ key: 'AccessToken', diff --git a/frontend/src/types/chatHistory.ts b/frontend/src/types/chatHistory.ts index f17e9b6a50..27506b4ea5 100644 --- a/frontend/src/types/chatHistory.ts +++ b/frontend/src/types/chatHistory.ts @@ -1,4 +1,4 @@ -import { IConversation } from '@chainlit/components'; +import { IConversation } from '@chainlit/react-client'; import { IPageInfo } from 'components/organisms/conversationsHistory/sidebar/ConversationsHistoryList'; diff --git a/libs/components/hooks/index.ts b/libs/components/hooks/index.ts deleted file mode 100644 index cfbfc977d2..0000000000 --- a/libs/components/hooks/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { useApi } from './useApi'; -export { useChatData } from './useChat/useChatData'; -export { useColors } from './useColors'; -export { useChatMessages } from './useChat/useChatMessages'; -export { useChatInteract } from './useChat/useChatInteract'; -export { useIsDarkMode } from './useIsDarkMode'; -export { useChatSession } from './useChat/useChatSession'; -export { useUpload } from './useUpload'; diff --git a/libs/react-client/package.json b/libs/react-client/package.json new file mode 100644 index 0000000000..0e2b7dcd9b --- /dev/null +++ b/libs/react-client/package.json @@ -0,0 +1,58 @@ +{ + "name": "@chainlit/react-client", + "description": "Websocket client to connect to your chainlit app.", + "version": "0.0.1", + "scripts": { + "build": "tsup src/index.ts --clean --format esm,cjs --dts --external react --external recoil --minify --sourcemap --treeshake", + "dev": "tsup src/index.ts --clean --format esm,cjs --dts --external react --external recoil --minify --sourcemap --treeshake", + "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "format": "prettier **/*.{ts,tsx} --write --loglevel error", + "test": "echo no tests yet", + "prepublish": "pnpm run build" + }, + "repository": { + "type": "git", + "url": "https://github.com/Chainlit/" + }, + "private": false, + "keywords": [ + "llm", + "ai", + "chain of thought" + ], + "author": "Chainlit", + "license": "Apache-2.0", + "files": [ + "dist" + ], + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "devDependencies": { + "@swc/core": "^1.3.86", + "@testing-library/jest-dom": "^5.17.0", + "@testing-library/react": "^14.0.0", + "@types/uuid": "^9.0.3", + "@vitejs/plugin-react": "^4.0.4", + "@vitejs/plugin-react-swc": "^3.3.2", + "@types/lodash": "^4.14.199", + "jsdom": "^22.1.0", + "tslib": "^2.6.2", + "tsup": "^7.2.0", + "typescript": "^5.2.2", + "vite": "^4.4.9", + "vite-tsconfig-paths": "^4.2.0", + "vitest": "^0.34.4" + }, + "peerDependencies": { + "@types/react": "^18.2.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "recoil": "^0.7.7" + }, + "dependencies": { + "socket.io-client": "^4.7.2", + "lodash": "^4.17.21", + "uuid": "^9.0.0" + } +} diff --git a/libs/react-client/pnpm-lock.yaml b/libs/react-client/pnpm-lock.yaml new file mode 100644 index 0000000000..a5a7aba869 --- /dev/null +++ b/libs/react-client/pnpm-lock.yaml @@ -0,0 +1,2982 @@ +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +dependencies: + '@types/react': + specifier: ^18.2.0 + version: 18.2.0 + lodash: + specifier: ^4.17.21 + version: 4.17.21 + react: + specifier: ^18.2.0 + version: 18.2.0 + react-dom: + specifier: ^18.2.0 + version: 18.2.0(react@18.2.0) + recoil: + specifier: ^0.7.7 + version: 0.7.7(react-dom@18.2.0)(react@18.2.0) + socket.io-client: + specifier: ^4.7.2 + version: 4.7.2 + uuid: + specifier: ^9.0.0 + version: 9.0.0 + +devDependencies: + '@swc/core': + specifier: ^1.3.86 + version: 1.3.86 + '@testing-library/jest-dom': + specifier: ^5.17.0 + version: 5.17.0 + '@testing-library/react': + specifier: ^14.0.0 + version: 14.0.0(react-dom@18.2.0)(react@18.2.0) + '@types/lodash': + specifier: ^4.14.199 + version: 4.14.199 + '@types/uuid': + specifier: ^9.0.3 + version: 9.0.3 + '@vitejs/plugin-react': + specifier: ^4.0.4 + version: 4.0.4(vite@4.4.9) + '@vitejs/plugin-react-swc': + specifier: ^3.3.2 + version: 3.3.2(vite@4.4.9) + jsdom: + specifier: ^22.1.0 + version: 22.1.0 + tslib: + specifier: ^2.6.2 + version: 2.6.2 + tsup: + specifier: ^7.2.0 + version: 7.2.0(@swc/core@1.3.86)(typescript@5.2.2) + typescript: + specifier: ^5.2.2 + version: 5.2.2 + vite: + specifier: ^4.4.9 + version: 4.4.9(@types/node@20.9.0) + vite-tsconfig-paths: + specifier: ^4.2.0 + version: 4.2.0(typescript@5.2.2)(vite@4.4.9) + vitest: + specifier: ^0.34.4 + version: 0.34.4(jsdom@22.1.0) + +packages: + + /@adobe/css-tools@4.3.1: + resolution: {integrity: sha512-/62yikz7NLScCGAAST5SHdnjaDJQBDq0M2muyRTpf2VQhw6StBg2ALiu73zSJQ4fMVLA+0uBhBHAle7Wg+2kSg==} + dev: true + + /@ampproject/remapping@2.2.1: + resolution: {integrity: sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/gen-mapping': 0.3.3 + '@jridgewell/trace-mapping': 0.3.20 + dev: true + + /@babel/code-frame@7.22.13: + resolution: {integrity: sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/highlight': 7.22.20 + chalk: 2.4.2 + dev: true + + /@babel/compat-data@7.23.3: + resolution: {integrity: sha512-BmR4bWbDIoFJmJ9z2cZ8Gmm2MXgEDgjdWgpKmKWUt54UGFJdlj31ECtbaDvCG/qVdG3AQ1SfpZEs01lUFbzLOQ==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/core@7.23.3: + resolution: {integrity: sha512-Jg+msLuNuCJDyBvFv5+OKOUjWMZgd85bKjbICd3zWrKAo+bJ49HJufi7CQE0q0uR8NGyO6xkCACScNqyjHSZew==} + engines: {node: '>=6.9.0'} + dependencies: + '@ampproject/remapping': 2.2.1 + '@babel/code-frame': 7.22.13 + '@babel/generator': 7.23.3 + '@babel/helper-compilation-targets': 7.22.15 + '@babel/helper-module-transforms': 7.23.3(@babel/core@7.23.3) + '@babel/helpers': 7.23.2 + '@babel/parser': 7.23.3 + '@babel/template': 7.22.15 + '@babel/traverse': 7.23.3 + '@babel/types': 7.23.3 + convert-source-map: 2.0.0 + debug: 4.3.4 + gensync: 1.0.0-beta.2 + json5: 2.2.3 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + dev: true + + /@babel/generator@7.23.3: + resolution: {integrity: sha512-keeZWAV4LU3tW0qRi19HRpabC/ilM0HRBBzf9/k8FFiG4KVpiv0FIy4hHfLfFQZNhziCTPTmd59zoyv6DNISzg==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.23.3 + '@jridgewell/gen-mapping': 0.3.3 + '@jridgewell/trace-mapping': 0.3.20 + jsesc: 2.5.2 + dev: true + + /@babel/helper-compilation-targets@7.22.15: + resolution: {integrity: sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/compat-data': 7.23.3 + '@babel/helper-validator-option': 7.22.15 + browserslist: 4.22.1 + lru-cache: 5.1.1 + semver: 6.3.1 + dev: true + + /@babel/helper-environment-visitor@7.22.20: + resolution: {integrity: sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-function-name@7.23.0: + resolution: {integrity: sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/template': 7.22.15 + '@babel/types': 7.23.3 + dev: true + + /@babel/helper-hoist-variables@7.22.5: + resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.23.3 + dev: true + + /@babel/helper-module-imports@7.22.15: + resolution: {integrity: sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.23.3 + dev: true + + /@babel/helper-module-transforms@7.23.3(@babel/core@7.23.3): + resolution: {integrity: sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + dependencies: + '@babel/core': 7.23.3 + '@babel/helper-environment-visitor': 7.22.20 + '@babel/helper-module-imports': 7.22.15 + '@babel/helper-simple-access': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 + '@babel/helper-validator-identifier': 7.22.20 + dev: true + + /@babel/helper-plugin-utils@7.22.5: + resolution: {integrity: sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-simple-access@7.22.5: + resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.23.3 + dev: true + + /@babel/helper-split-export-declaration@7.22.6: + resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.23.3 + dev: true + + /@babel/helper-string-parser@7.22.5: + resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-validator-identifier@7.22.20: + resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-validator-option@7.22.15: + resolution: {integrity: sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helpers@7.23.2: + resolution: {integrity: sha512-lzchcp8SjTSVe/fPmLwtWVBFC7+Tbn8LGHDVfDp9JGxpAY5opSaEFgt8UQvrnECWOTdji2mOWMz1rOhkHscmGQ==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/template': 7.22.15 + '@babel/traverse': 7.23.3 + '@babel/types': 7.23.3 + transitivePeerDependencies: + - supports-color + dev: true + + /@babel/highlight@7.22.20: + resolution: {integrity: sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/helper-validator-identifier': 7.22.20 + chalk: 2.4.2 + js-tokens: 4.0.0 + dev: true + + /@babel/parser@7.23.3: + resolution: {integrity: sha512-uVsWNvlVsIninV2prNz/3lHCb+5CJ+e+IUBfbjToAHODtfGYLfCFuY4AU7TskI+dAKk+njsPiBjq1gKTvZOBaw==} + engines: {node: '>=6.0.0'} + hasBin: true + dependencies: + '@babel/types': 7.23.3 + dev: true + + /@babel/plugin-transform-react-jsx-self@7.23.3(@babel/core@7.23.3): + resolution: {integrity: sha512-qXRvbeKDSfwnlJnanVRp0SfuWE5DQhwQr5xtLBzp56Wabyo+4CMosF6Kfp+eOD/4FYpql64XVJ2W0pVLlJZxOQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.23.3 + '@babel/helper-plugin-utils': 7.22.5 + dev: true + + /@babel/plugin-transform-react-jsx-source@7.23.3(@babel/core@7.23.3): + resolution: {integrity: sha512-91RS0MDnAWDNvGC6Wio5XYkyWI39FMFO+JK9+4AlgaTH+yWwVTsw7/sn6LK0lH7c5F+TFkpv/3LfCJ1Ydwof/g==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.23.3 + '@babel/helper-plugin-utils': 7.22.5 + dev: true + + /@babel/runtime@7.23.2: + resolution: {integrity: sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==} + engines: {node: '>=6.9.0'} + dependencies: + regenerator-runtime: 0.14.0 + dev: true + + /@babel/template@7.22.15: + resolution: {integrity: sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/code-frame': 7.22.13 + '@babel/parser': 7.23.3 + '@babel/types': 7.23.3 + dev: true + + /@babel/traverse@7.23.3: + resolution: {integrity: sha512-+K0yF1/9yR0oHdE0StHuEj3uTPzwwbrLGfNOndVJVV2TqA5+j3oljJUb4nmB954FLGjNem976+B+eDuLIjesiQ==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/code-frame': 7.22.13 + '@babel/generator': 7.23.3 + '@babel/helper-environment-visitor': 7.22.20 + '@babel/helper-function-name': 7.23.0 + '@babel/helper-hoist-variables': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 + '@babel/parser': 7.23.3 + '@babel/types': 7.23.3 + debug: 4.3.4 + globals: 11.12.0 + transitivePeerDependencies: + - supports-color + dev: true + + /@babel/types@7.23.3: + resolution: {integrity: sha512-OZnvoH2l8PK5eUvEcUyCt/sXgr/h+UWpVuBbOljwcrAgUl6lpchoQ++PHGyQy1AtYnVA6CEq3y5xeEI10brpXw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/helper-string-parser': 7.22.5 + '@babel/helper-validator-identifier': 7.22.20 + to-fast-properties: 2.0.0 + dev: true + + /@esbuild/android-arm64@0.18.20: + resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm@0.18.20: + resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-x64@0.18.20: + resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-arm64@0.18.20: + resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-x64@0.18.20: + resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-arm64@0.18.20: + resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-x64@0.18.20: + resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm64@0.18.20: + resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm@0.18.20: + resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ia32@0.18.20: + resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-loong64@0.18.20: + resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-mips64el@0.18.20: + resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ppc64@0.18.20: + resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-riscv64@0.18.20: + resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-s390x@0.18.20: + resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-x64@0.18.20: + resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-x64@0.18.20: + resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-x64@0.18.20: + resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/sunos-x64@0.18.20: + resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-arm64@0.18.20: + resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-ia32@0.18.20: + resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-x64@0.18.20: + resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@jest/expect-utils@29.7.0: + resolution: {integrity: sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + jest-get-type: 29.6.3 + dev: true + + /@jest/schemas@29.6.3: + resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@sinclair/typebox': 0.27.8 + dev: true + + /@jest/types@29.6.3: + resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@jest/schemas': 29.6.3 + '@types/istanbul-lib-coverage': 2.0.6 + '@types/istanbul-reports': 3.0.4 + '@types/node': 20.9.0 + '@types/yargs': 17.0.31 + chalk: 4.1.2 + dev: true + + /@jridgewell/gen-mapping@0.3.3: + resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/set-array': 1.1.2 + '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/trace-mapping': 0.3.20 + dev: true + + /@jridgewell/resolve-uri@3.1.1: + resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} + engines: {node: '>=6.0.0'} + dev: true + + /@jridgewell/set-array@1.1.2: + resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} + engines: {node: '>=6.0.0'} + dev: true + + /@jridgewell/sourcemap-codec@1.4.15: + resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + dev: true + + /@jridgewell/trace-mapping@0.3.20: + resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==} + dependencies: + '@jridgewell/resolve-uri': 3.1.1 + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + + /@nodelib/fs.scandir@2.1.5: + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + dev: true + + /@nodelib/fs.stat@2.0.5: + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + dev: true + + /@nodelib/fs.walk@1.2.8: + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.15.0 + dev: true + + /@sinclair/typebox@0.27.8: + resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + dev: true + + /@socket.io/component-emitter@3.1.0: + resolution: {integrity: sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==} + dev: false + + /@swc/core-darwin-arm64@1.3.86: + resolution: {integrity: sha512-hMvSDms0sJJHNtRa3Vhmr9StWN1vmikbf5VE0IZUYGnF1/JZTkXU1h6CdNUY4Hr6i7uCZjH6BEhxFHX1JtKV4w==} + engines: {node: '>=10'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@swc/core-darwin-x64@1.3.86: + resolution: {integrity: sha512-Jro6HVH4uSOBM7tTDaQNKLNc8BJV7n+SO+Ft2HAZINyeKJS/8MfEYneG7Vmqg18gv00c6dz9AOCcyz+BR7BFkQ==} + engines: {node: '>=10'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-arm-gnueabihf@1.3.86: + resolution: {integrity: sha512-wYB9m0pzXJVSzedXSl4JwS3gKtvcPinpe9MbkddezpqL7OjyDP6pHHW9qIucsfgCrtMtbPC2nqulXLPtAAyIjw==} + engines: {node: '>=10'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-arm64-gnu@1.3.86: + resolution: {integrity: sha512-fR44IyK5cdCaO8cC++IEH0Jn03tWnunJnjzA99LxlE5TRInSIOvFm+g5OSUQZDAvEXmQ38sd31LO2HOoDS1Edw==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-arm64-musl@1.3.86: + resolution: {integrity: sha512-EUPfdbK4dUk/nkX3Vmv/47XH+DqHOa9JI0CTthvJ8/ZXei1MKDUsUc+tI1zMQX2uCuSkSWsEIEpCmA0tMwFhtw==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-x64-gnu@1.3.86: + resolution: {integrity: sha512-snVZZWv8XgNVaKrTxtO3rUN+BbbB6I8Fqwe8zM/DWGJ096J13r89doQ48x5ZyO+bW4D48eZIWP5pdfSW7oBE3w==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-linux-x64-musl@1.3.86: + resolution: {integrity: sha512-PnnksUJymEJkdnbV2orOSOSB441UqsxYbJge9zbr5UTRXUfWO3eFRV0iTBegjTlOQGbW6yN+YRSDkenTbmCI6g==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@swc/core-win32-arm64-msvc@1.3.86: + resolution: {integrity: sha512-XlGEGyHwLndm08VvgeAPGj40L+Hx575MQC+2fsyB1uSNUN+uf7fvke+wc7k50a92CaQe/8foLyIR5faayozEJA==} + engines: {node: '>=10'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@swc/core-win32-ia32-msvc@1.3.86: + resolution: {integrity: sha512-U1BhZa1x9yn+wZGTQmt1cYR79a0FzW/wL6Jas1Pn0bykKLxdRU4mCeZt2P+T3buLm8jr8LpPWiCrbvr658PzwA==} + engines: {node: '>=10'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@swc/core-win32-x64-msvc@1.3.86: + resolution: {integrity: sha512-wRoQUajqpE3wITHhZVj/6BPu/QwHriFHLHuJA+9y6PeGtUtTmntL42aBKXIFhfL767dYFtohyNg1uZ9eqbGyGQ==} + engines: {node: '>=10'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@swc/core@1.3.86: + resolution: {integrity: sha512-bEXUtm37bcmJ3q+geG7Zy4rJNUzpxalXQUrrqX1ZoGj3HRtzdeVZ0L/um3fG2j16qe61t8TX/OIZ2G6j6dkG/w==} + engines: {node: '>=10'} + requiresBuild: true + peerDependencies: + '@swc/helpers': ^0.5.0 + peerDependenciesMeta: + '@swc/helpers': + optional: true + dependencies: + '@swc/types': 0.1.5 + optionalDependencies: + '@swc/core-darwin-arm64': 1.3.86 + '@swc/core-darwin-x64': 1.3.86 + '@swc/core-linux-arm-gnueabihf': 1.3.86 + '@swc/core-linux-arm64-gnu': 1.3.86 + '@swc/core-linux-arm64-musl': 1.3.86 + '@swc/core-linux-x64-gnu': 1.3.86 + '@swc/core-linux-x64-musl': 1.3.86 + '@swc/core-win32-arm64-msvc': 1.3.86 + '@swc/core-win32-ia32-msvc': 1.3.86 + '@swc/core-win32-x64-msvc': 1.3.86 + dev: true + + /@swc/types@0.1.5: + resolution: {integrity: sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw==} + dev: true + + /@testing-library/dom@9.3.3: + resolution: {integrity: sha512-fB0R+fa3AUqbLHWyxXa2kGVtf1Fe1ZZFr0Zp6AIbIAzXb2mKbEXl+PCQNUOaq5lbTab5tfctfXRNsWXxa2f7Aw==} + engines: {node: '>=14'} + dependencies: + '@babel/code-frame': 7.22.13 + '@babel/runtime': 7.23.2 + '@types/aria-query': 5.0.4 + aria-query: 5.1.3 + chalk: 4.1.2 + dom-accessibility-api: 0.5.16 + lz-string: 1.5.0 + pretty-format: 27.5.1 + dev: true + + /@testing-library/jest-dom@5.17.0: + resolution: {integrity: sha512-ynmNeT7asXyH3aSVv4vvX4Rb+0qjOhdNHnO/3vuZNqPmhDpV/+rCSGwQ7bLcmU2cJ4dvoheIO85LQj0IbJHEtg==} + engines: {node: '>=8', npm: '>=6', yarn: '>=1'} + dependencies: + '@adobe/css-tools': 4.3.1 + '@babel/runtime': 7.23.2 + '@types/testing-library__jest-dom': 5.14.9 + aria-query: 5.3.0 + chalk: 3.0.0 + css.escape: 1.5.1 + dom-accessibility-api: 0.5.16 + lodash: 4.17.21 + redent: 3.0.0 + dev: true + + /@testing-library/react@14.0.0(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-S04gSNJbYE30TlIMLTzv6QCTzt9AqIF5y6s6SzVFILNcNvbV/jU96GeiTPillGQo+Ny64M/5PV7klNYYgv5Dfg==} + engines: {node: '>=14'} + peerDependencies: + react: ^18.0.0 + react-dom: ^18.0.0 + dependencies: + '@babel/runtime': 7.23.2 + '@testing-library/dom': 9.3.3 + '@types/react-dom': 18.2.15 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: true + + /@tootallnate/once@2.0.0: + resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} + engines: {node: '>= 10'} + dev: true + + /@types/aria-query@5.0.4: + resolution: {integrity: sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==} + dev: true + + /@types/chai-subset@1.3.5: + resolution: {integrity: sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A==} + dependencies: + '@types/chai': 4.3.10 + dev: true + + /@types/chai@4.3.10: + resolution: {integrity: sha512-of+ICnbqjmFCiixUnqRulbylyXQrPqIGf/B3Jax1wIF3DvSheysQxAWvqHhZiW3IQrycvokcLcFQlveGp+vyNg==} + dev: true + + /@types/istanbul-lib-coverage@2.0.6: + resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} + dev: true + + /@types/istanbul-lib-report@3.0.3: + resolution: {integrity: sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==} + dependencies: + '@types/istanbul-lib-coverage': 2.0.6 + dev: true + + /@types/istanbul-reports@3.0.4: + resolution: {integrity: sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==} + dependencies: + '@types/istanbul-lib-report': 3.0.3 + dev: true + + /@types/jest@29.5.8: + resolution: {integrity: sha512-fXEFTxMV2Co8ZF5aYFJv+YeA08RTYJfhtN5c9JSv/mFEMe+xxjufCb+PHL+bJcMs/ebPUsBu+UNTEz+ydXrR6g==} + dependencies: + expect: 29.7.0 + pretty-format: 29.7.0 + dev: true + + /@types/lodash@4.14.199: + resolution: {integrity: sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg==} + dev: true + + /@types/node@20.9.0: + resolution: {integrity: sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==} + dependencies: + undici-types: 5.26.5 + dev: true + + /@types/prop-types@15.7.10: + resolution: {integrity: sha512-mxSnDQxPqsZxmeShFH+uwQ4kO4gcJcGahjjMFeLbKE95IAZiiZyiEepGZjtXJ7hN/yfu0bu9xN2ajcU0JcxX6A==} + + /@types/react-dom@18.2.15: + resolution: {integrity: sha512-HWMdW+7r7MR5+PZqJF6YFNSCtjz1T0dsvo/f1BV6HkV+6erD/nA7wd9NM00KVG83zf2nJ7uATPO9ttdIPvi3gg==} + dependencies: + '@types/react': 18.2.0 + dev: true + + /@types/react@18.2.0: + resolution: {integrity: sha512-0FLj93y5USLHdnhIhABk83rm8XEGA7kH3cr+YUlvxoUGp1xNt/DINUMvqPxLyOQMzLmZe8i4RTHbvb8MC7NmrA==} + dependencies: + '@types/prop-types': 15.7.10 + '@types/scheduler': 0.16.6 + csstype: 3.1.2 + + /@types/scheduler@0.16.6: + resolution: {integrity: sha512-Vlktnchmkylvc9SnwwwozTv04L/e1NykF5vgoQ0XTmI8DD+wxfjQuHuvHS3p0r2jz2x2ghPs2h1FVeDirIteWA==} + + /@types/stack-utils@2.0.3: + resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} + dev: true + + /@types/testing-library__jest-dom@5.14.9: + resolution: {integrity: sha512-FSYhIjFlfOpGSRyVoMBMuS3ws5ehFQODymf3vlI7U1K8c7PHwWwFY7VREfmsuzHSOnoKs/9/Y983ayOs7eRzqw==} + dependencies: + '@types/jest': 29.5.8 + dev: true + + /@types/uuid@9.0.3: + resolution: {integrity: sha512-taHQQH/3ZyI3zP8M/puluDEIEvtQHVYcC6y3N8ijFtAd28+Ey/G4sg1u2gB01S8MwybLOKAp9/yCMu/uR5l3Ug==} + dev: true + + /@types/yargs-parser@21.0.3: + resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} + dev: true + + /@types/yargs@17.0.31: + resolution: {integrity: sha512-bocYSx4DI8TmdlvxqGpVNXOgCNR1Jj0gNPhhAY+iz1rgKDAaYrAYdFYnhDV1IFuiuVc9HkOwyDcFxaTElF3/wg==} + dependencies: + '@types/yargs-parser': 21.0.3 + dev: true + + /@vitejs/plugin-react-swc@3.3.2(vite@4.4.9): + resolution: {integrity: sha512-VJFWY5sfoZerQRvJrh518h3AcQt6f/yTuWn4/TRB+dqmYU0NX1qz7qM5Wfd+gOQqUzQW4gxKqKN3KpE/P3+zrA==} + peerDependencies: + vite: ^4 + dependencies: + '@swc/core': 1.3.86 + vite: 4.4.9(@types/node@20.9.0) + transitivePeerDependencies: + - '@swc/helpers' + dev: true + + /@vitejs/plugin-react@4.0.4(vite@4.4.9): + resolution: {integrity: sha512-7wU921ABnNYkETiMaZy7XqpueMnpu5VxvVps13MjmCo+utBdD79sZzrApHawHtVX66cCJQQTXFcjH0y9dSUK8g==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + vite: ^4.2.0 + dependencies: + '@babel/core': 7.23.3 + '@babel/plugin-transform-react-jsx-self': 7.23.3(@babel/core@7.23.3) + '@babel/plugin-transform-react-jsx-source': 7.23.3(@babel/core@7.23.3) + react-refresh: 0.14.0 + vite: 4.4.9(@types/node@20.9.0) + transitivePeerDependencies: + - supports-color + dev: true + + /@vitest/expect@0.34.4: + resolution: {integrity: sha512-XlMKX8HyYUqB8dsY8Xxrc64J2Qs9pKMt2Z8vFTL4mBWXJsg4yoALHzJfDWi8h5nkO4Zua4zjqtapQ/IluVkSnA==} + dependencies: + '@vitest/spy': 0.34.4 + '@vitest/utils': 0.34.4 + chai: 4.3.10 + dev: true + + /@vitest/runner@0.34.4: + resolution: {integrity: sha512-hwwdB1StERqUls8oV8YcpmTIpVeJMe4WgYuDongVzixl5hlYLT2G8afhcdADeDeqCaAmZcSgLTLtqkjPQF7x+w==} + dependencies: + '@vitest/utils': 0.34.4 + p-limit: 4.0.0 + pathe: 1.1.1 + dev: true + + /@vitest/snapshot@0.34.4: + resolution: {integrity: sha512-GCsh4coc3YUSL/o+BPUo7lHQbzpdttTxL6f4q0jRx2qVGoYz/cyTRDJHbnwks6TILi6560bVWoBpYC10PuTLHw==} + dependencies: + magic-string: 0.30.5 + pathe: 1.1.1 + pretty-format: 29.7.0 + dev: true + + /@vitest/spy@0.34.4: + resolution: {integrity: sha512-PNU+fd7DUPgA3Ya924b1qKuQkonAW6hL7YUjkON3wmBwSTIlhOSpy04SJ0NrRsEbrXgMMj6Morh04BMf8k+w0g==} + dependencies: + tinyspy: 2.2.0 + dev: true + + /@vitest/utils@0.34.4: + resolution: {integrity: sha512-yR2+5CHhp/K4ySY0Qtd+CAL9f5Yh1aXrKfAT42bq6CtlGPh92jIDDDSg7ydlRow1CP+dys4TrOrbELOyNInHSg==} + dependencies: + diff-sequences: 29.6.3 + loupe: 2.3.7 + pretty-format: 29.7.0 + dev: true + + /abab@2.0.6: + resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==} + dev: true + + /acorn-walk@8.3.0: + resolution: {integrity: sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==} + engines: {node: '>=0.4.0'} + dev: true + + /acorn@8.11.2: + resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: true + + /agent-base@6.0.2: + resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} + engines: {node: '>= 6.0.0'} + dependencies: + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: true + + /ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + dev: true + + /ansi-styles@3.2.1: + resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} + engines: {node: '>=4'} + dependencies: + color-convert: 1.9.3 + dev: true + + /ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + dependencies: + color-convert: 2.0.1 + dev: true + + /ansi-styles@5.2.0: + resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} + engines: {node: '>=10'} + dev: true + + /any-promise@1.3.0: + resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} + dev: true + + /anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + dev: true + + /aria-query@5.1.3: + resolution: {integrity: sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==} + dependencies: + deep-equal: 2.2.3 + dev: true + + /aria-query@5.3.0: + resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==} + dependencies: + dequal: 2.0.3 + dev: true + + /array-buffer-byte-length@1.0.0: + resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==} + dependencies: + call-bind: 1.0.5 + is-array-buffer: 3.0.2 + dev: true + + /array-union@2.1.0: + resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} + engines: {node: '>=8'} + dev: true + + /assertion-error@1.1.0: + resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + dev: true + + /asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + dev: true + + /available-typed-arrays@1.0.5: + resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} + engines: {node: '>= 0.4'} + dev: true + + /balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + dev: true + + /binary-extensions@2.2.0: + resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} + engines: {node: '>=8'} + dev: true + + /brace-expansion@1.1.11: + resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + dev: true + + /braces@3.0.2: + resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} + engines: {node: '>=8'} + dependencies: + fill-range: 7.0.1 + dev: true + + /browserslist@4.22.1: + resolution: {integrity: sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + dependencies: + caniuse-lite: 1.0.30001562 + electron-to-chromium: 1.4.583 + node-releases: 2.0.13 + update-browserslist-db: 1.0.13(browserslist@4.22.1) + dev: true + + /bundle-require@4.0.2(esbuild@0.18.20): + resolution: {integrity: sha512-jwzPOChofl67PSTW2SGubV9HBQAhhR2i6nskiOThauo9dzwDUgOWQScFVaJkjEfYX+UXiD+LEx8EblQMc2wIag==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + peerDependencies: + esbuild: '>=0.17' + dependencies: + esbuild: 0.18.20 + load-tsconfig: 0.2.5 + dev: true + + /cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + dev: true + + /call-bind@1.0.5: + resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} + dependencies: + function-bind: 1.1.2 + get-intrinsic: 1.2.2 + set-function-length: 1.1.1 + dev: true + + /caniuse-lite@1.0.30001562: + resolution: {integrity: sha512-kfte3Hym//51EdX4239i+Rmp20EsLIYGdPkERegTgU19hQWCRhsRFGKHTliUlsry53tv17K7n077Kqa0WJU4ng==} + dev: true + + /chai@4.3.10: + resolution: {integrity: sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==} + engines: {node: '>=4'} + dependencies: + assertion-error: 1.1.0 + check-error: 1.0.3 + deep-eql: 4.1.3 + get-func-name: 2.0.2 + loupe: 2.3.7 + pathval: 1.1.1 + type-detect: 4.0.8 + dev: true + + /chalk@2.4.2: + resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} + engines: {node: '>=4'} + dependencies: + ansi-styles: 3.2.1 + escape-string-regexp: 1.0.5 + supports-color: 5.5.0 + dev: true + + /chalk@3.0.0: + resolution: {integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==} + engines: {node: '>=8'} + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + dev: true + + /chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + dev: true + + /check-error@1.0.3: + resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} + dependencies: + get-func-name: 2.0.2 + dev: true + + /chokidar@3.5.3: + resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + dev: true + + /ci-info@3.9.0: + resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} + engines: {node: '>=8'} + dev: true + + /color-convert@1.9.3: + resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} + dependencies: + color-name: 1.1.3 + dev: true + + /color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + dependencies: + color-name: 1.1.4 + dev: true + + /color-name@1.1.3: + resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} + dev: true + + /color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + dev: true + + /combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + dependencies: + delayed-stream: 1.0.0 + dev: true + + /commander@4.1.1: + resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} + engines: {node: '>= 6'} + dev: true + + /concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + dev: true + + /convert-source-map@2.0.0: + resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + dev: true + + /cross-spawn@7.0.3: + resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + engines: {node: '>= 8'} + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + dev: true + + /css.escape@1.5.1: + resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==} + dev: true + + /cssstyle@3.0.0: + resolution: {integrity: sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==} + engines: {node: '>=14'} + dependencies: + rrweb-cssom: 0.6.0 + dev: true + + /csstype@3.1.2: + resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} + + /data-urls@4.0.0: + resolution: {integrity: sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==} + engines: {node: '>=14'} + dependencies: + abab: 2.0.6 + whatwg-mimetype: 3.0.0 + whatwg-url: 12.0.1 + dev: true + + /debug@4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + + /decimal.js@10.4.3: + resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==} + dev: true + + /deep-eql@4.1.3: + resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} + engines: {node: '>=6'} + dependencies: + type-detect: 4.0.8 + dev: true + + /deep-equal@2.2.3: + resolution: {integrity: sha512-ZIwpnevOurS8bpT4192sqAowWM76JDKSHYzMLty3BZGSswgq6pBaH3DhCSW5xVAZICZyKdOBPjwww5wfgT/6PA==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.0 + call-bind: 1.0.5 + es-get-iterator: 1.1.3 + get-intrinsic: 1.2.2 + is-arguments: 1.1.1 + is-array-buffer: 3.0.2 + is-date-object: 1.0.5 + is-regex: 1.1.4 + is-shared-array-buffer: 1.0.2 + isarray: 2.0.5 + object-is: 1.1.5 + object-keys: 1.1.1 + object.assign: 4.1.4 + regexp.prototype.flags: 1.5.1 + side-channel: 1.0.4 + which-boxed-primitive: 1.0.2 + which-collection: 1.0.1 + which-typed-array: 1.1.13 + dev: true + + /define-data-property@1.1.1: + resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.2 + gopd: 1.0.1 + has-property-descriptors: 1.0.1 + dev: true + + /define-properties@1.2.1: + resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.1 + has-property-descriptors: 1.0.1 + object-keys: 1.1.1 + dev: true + + /delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + dev: true + + /dequal@2.0.3: + resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} + engines: {node: '>=6'} + dev: true + + /diff-sequences@29.6.3: + resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dev: true + + /dir-glob@3.0.1: + resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} + engines: {node: '>=8'} + dependencies: + path-type: 4.0.0 + dev: true + + /dom-accessibility-api@0.5.16: + resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==} + dev: true + + /domexception@4.0.0: + resolution: {integrity: sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==} + engines: {node: '>=12'} + dependencies: + webidl-conversions: 7.0.0 + dev: true + + /electron-to-chromium@1.4.583: + resolution: {integrity: sha512-93y1gcONABZ7uqYe/JWDVQP/Pj/sQSunF0HVAPdlg/pfBnOyBMLlQUxWvkqcljJg1+W6cjvPuYD+r1Th9Tn8mA==} + dev: true + + /engine.io-client@6.5.3: + resolution: {integrity: sha512-9Z0qLB0NIisTRt1DZ/8U2k12RJn8yls/nXMZLn+/N8hANT3TcYjKFKcwbw5zFQiN4NTde3TSY9zb79e1ij6j9Q==} + dependencies: + '@socket.io/component-emitter': 3.1.0 + debug: 4.3.4 + engine.io-parser: 5.2.1 + ws: 8.11.0 + xmlhttprequest-ssl: 2.0.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + dev: false + + /engine.io-parser@5.2.1: + resolution: {integrity: sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==} + engines: {node: '>=10.0.0'} + dev: false + + /entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} + engines: {node: '>=0.12'} + dev: true + + /es-get-iterator@1.1.3: + resolution: {integrity: sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + has-symbols: 1.0.3 + is-arguments: 1.1.1 + is-map: 2.0.2 + is-set: 2.0.2 + is-string: 1.0.7 + isarray: 2.0.5 + stop-iteration-iterator: 1.0.0 + dev: true + + /esbuild@0.18.20: + resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/android-arm': 0.18.20 + '@esbuild/android-arm64': 0.18.20 + '@esbuild/android-x64': 0.18.20 + '@esbuild/darwin-arm64': 0.18.20 + '@esbuild/darwin-x64': 0.18.20 + '@esbuild/freebsd-arm64': 0.18.20 + '@esbuild/freebsd-x64': 0.18.20 + '@esbuild/linux-arm': 0.18.20 + '@esbuild/linux-arm64': 0.18.20 + '@esbuild/linux-ia32': 0.18.20 + '@esbuild/linux-loong64': 0.18.20 + '@esbuild/linux-mips64el': 0.18.20 + '@esbuild/linux-ppc64': 0.18.20 + '@esbuild/linux-riscv64': 0.18.20 + '@esbuild/linux-s390x': 0.18.20 + '@esbuild/linux-x64': 0.18.20 + '@esbuild/netbsd-x64': 0.18.20 + '@esbuild/openbsd-x64': 0.18.20 + '@esbuild/sunos-x64': 0.18.20 + '@esbuild/win32-arm64': 0.18.20 + '@esbuild/win32-ia32': 0.18.20 + '@esbuild/win32-x64': 0.18.20 + dev: true + + /escalade@3.1.1: + resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} + engines: {node: '>=6'} + dev: true + + /escape-string-regexp@1.0.5: + resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} + engines: {node: '>=0.8.0'} + dev: true + + /escape-string-regexp@2.0.0: + resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} + engines: {node: '>=8'} + dev: true + + /execa@5.1.1: + resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} + engines: {node: '>=10'} + dependencies: + cross-spawn: 7.0.3 + get-stream: 6.0.1 + human-signals: 2.1.0 + is-stream: 2.0.1 + merge-stream: 2.0.0 + npm-run-path: 4.0.1 + onetime: 5.1.2 + signal-exit: 3.0.7 + strip-final-newline: 2.0.0 + dev: true + + /expect@29.7.0: + resolution: {integrity: sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@jest/expect-utils': 29.7.0 + jest-get-type: 29.6.3 + jest-matcher-utils: 29.7.0 + jest-message-util: 29.7.0 + jest-util: 29.7.0 + dev: true + + /fast-glob@3.3.2: + resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} + engines: {node: '>=8.6.0'} + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.5 + dev: true + + /fastq@1.15.0: + resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} + dependencies: + reusify: 1.0.4 + dev: true + + /fill-range@7.0.1: + resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} + engines: {node: '>=8'} + dependencies: + to-regex-range: 5.0.1 + dev: true + + /for-each@0.3.3: + resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} + dependencies: + is-callable: 1.2.7 + dev: true + + /form-data@4.0.0: + resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} + engines: {node: '>= 6'} + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + mime-types: 2.1.35 + dev: true + + /fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + dev: true + + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + dev: true + + /functions-have-names@1.2.3: + resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} + dev: true + + /gensync@1.0.0-beta.2: + resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} + engines: {node: '>=6.9.0'} + dev: true + + /get-func-name@2.0.2: + resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} + dev: true + + /get-intrinsic@1.2.2: + resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==} + dependencies: + function-bind: 1.1.2 + has-proto: 1.0.1 + has-symbols: 1.0.3 + hasown: 2.0.0 + dev: true + + /get-stream@6.0.1: + resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} + engines: {node: '>=10'} + dev: true + + /glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + dependencies: + is-glob: 4.0.3 + dev: true + + /glob@7.1.6: + resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + dev: true + + /globals@11.12.0: + resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} + engines: {node: '>=4'} + dev: true + + /globby@11.1.0: + resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} + engines: {node: '>=10'} + dependencies: + array-union: 2.1.0 + dir-glob: 3.0.1 + fast-glob: 3.3.2 + ignore: 5.2.4 + merge2: 1.4.1 + slash: 3.0.0 + dev: true + + /globrex@0.1.2: + resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} + dev: true + + /gopd@1.0.1: + resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} + dependencies: + get-intrinsic: 1.2.2 + dev: true + + /graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + dev: true + + /hamt_plus@1.0.2: + resolution: {integrity: sha512-t2JXKaehnMb9paaYA7J0BX8QQAY8lwfQ9Gjf4pg/mk4krt+cmwmU652HOoWonf+7+EQV97ARPMhhVgU1ra2GhA==} + dev: false + + /has-bigints@1.0.2: + resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} + dev: true + + /has-flag@3.0.0: + resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} + engines: {node: '>=4'} + dev: true + + /has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + dev: true + + /has-property-descriptors@1.0.1: + resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} + dependencies: + get-intrinsic: 1.2.2 + dev: true + + /has-proto@1.0.1: + resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} + engines: {node: '>= 0.4'} + dev: true + + /has-symbols@1.0.3: + resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} + engines: {node: '>= 0.4'} + dev: true + + /has-tostringtag@1.0.0: + resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==} + engines: {node: '>= 0.4'} + dependencies: + has-symbols: 1.0.3 + dev: true + + /hasown@2.0.0: + resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} + engines: {node: '>= 0.4'} + dependencies: + function-bind: 1.1.2 + dev: true + + /html-encoding-sniffer@3.0.0: + resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==} + engines: {node: '>=12'} + dependencies: + whatwg-encoding: 2.0.0 + dev: true + + /http-proxy-agent@5.0.0: + resolution: {integrity: sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==} + engines: {node: '>= 6'} + dependencies: + '@tootallnate/once': 2.0.0 + agent-base: 6.0.2 + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: true + + /https-proxy-agent@5.0.1: + resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} + engines: {node: '>= 6'} + dependencies: + agent-base: 6.0.2 + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: true + + /human-signals@2.1.0: + resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} + engines: {node: '>=10.17.0'} + dev: true + + /iconv-lite@0.6.3: + resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} + engines: {node: '>=0.10.0'} + dependencies: + safer-buffer: 2.1.2 + dev: true + + /ignore@5.2.4: + resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} + engines: {node: '>= 4'} + dev: true + + /indent-string@4.0.0: + resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} + engines: {node: '>=8'} + dev: true + + /inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + dev: true + + /inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + dev: true + + /internal-slot@1.0.6: + resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.2 + hasown: 2.0.0 + side-channel: 1.0.4 + dev: true + + /is-arguments@1.1.1: + resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + has-tostringtag: 1.0.0 + dev: true + + /is-array-buffer@3.0.2: + resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + is-typed-array: 1.1.12 + dev: true + + /is-bigint@1.0.4: + resolution: {integrity: sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==} + dependencies: + has-bigints: 1.0.2 + dev: true + + /is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + dependencies: + binary-extensions: 2.2.0 + dev: true + + /is-boolean-object@1.1.2: + resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + has-tostringtag: 1.0.0 + dev: true + + /is-callable@1.2.7: + resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} + engines: {node: '>= 0.4'} + dev: true + + /is-date-object@1.0.5: + resolution: {integrity: sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==} + engines: {node: '>= 0.4'} + dependencies: + has-tostringtag: 1.0.0 + dev: true + + /is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + dev: true + + /is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + dependencies: + is-extglob: 2.1.1 + dev: true + + /is-map@2.0.2: + resolution: {integrity: sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==} + dev: true + + /is-number-object@1.0.7: + resolution: {integrity: sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==} + engines: {node: '>= 0.4'} + dependencies: + has-tostringtag: 1.0.0 + dev: true + + /is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + dev: true + + /is-potential-custom-element-name@1.0.1: + resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} + dev: true + + /is-regex@1.1.4: + resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + has-tostringtag: 1.0.0 + dev: true + + /is-set@2.0.2: + resolution: {integrity: sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==} + dev: true + + /is-shared-array-buffer@1.0.2: + resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} + dependencies: + call-bind: 1.0.5 + dev: true + + /is-stream@2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} + dev: true + + /is-string@1.0.7: + resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} + engines: {node: '>= 0.4'} + dependencies: + has-tostringtag: 1.0.0 + dev: true + + /is-symbol@1.0.4: + resolution: {integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==} + engines: {node: '>= 0.4'} + dependencies: + has-symbols: 1.0.3 + dev: true + + /is-typed-array@1.1.12: + resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} + engines: {node: '>= 0.4'} + dependencies: + which-typed-array: 1.1.13 + dev: true + + /is-weakmap@2.0.1: + resolution: {integrity: sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==} + dev: true + + /is-weakset@2.0.2: + resolution: {integrity: sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + dev: true + + /isarray@2.0.5: + resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} + dev: true + + /isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + dev: true + + /jest-diff@29.7.0: + resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + chalk: 4.1.2 + diff-sequences: 29.6.3 + jest-get-type: 29.6.3 + pretty-format: 29.7.0 + dev: true + + /jest-get-type@29.6.3: + resolution: {integrity: sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dev: true + + /jest-matcher-utils@29.7.0: + resolution: {integrity: sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + chalk: 4.1.2 + jest-diff: 29.7.0 + jest-get-type: 29.6.3 + pretty-format: 29.7.0 + dev: true + + /jest-message-util@29.7.0: + resolution: {integrity: sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@babel/code-frame': 7.22.13 + '@jest/types': 29.6.3 + '@types/stack-utils': 2.0.3 + chalk: 4.1.2 + graceful-fs: 4.2.11 + micromatch: 4.0.5 + pretty-format: 29.7.0 + slash: 3.0.0 + stack-utils: 2.0.6 + dev: true + + /jest-util@29.7.0: + resolution: {integrity: sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@jest/types': 29.6.3 + '@types/node': 20.9.0 + chalk: 4.1.2 + ci-info: 3.9.0 + graceful-fs: 4.2.11 + picomatch: 2.3.1 + dev: true + + /joycon@3.1.1: + resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} + engines: {node: '>=10'} + dev: true + + /js-tokens@4.0.0: + resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + + /jsdom@22.1.0: + resolution: {integrity: sha512-/9AVW7xNbsBv6GfWho4TTNjEo9fe6Zhf9O7s0Fhhr3u+awPwAJMKwAMXnkk5vBxflqLW9hTHX/0cs+P3gW+cQw==} + engines: {node: '>=16'} + peerDependencies: + canvas: ^2.5.0 + peerDependenciesMeta: + canvas: + optional: true + dependencies: + abab: 2.0.6 + cssstyle: 3.0.0 + data-urls: 4.0.0 + decimal.js: 10.4.3 + domexception: 4.0.0 + form-data: 4.0.0 + html-encoding-sniffer: 3.0.0 + http-proxy-agent: 5.0.0 + https-proxy-agent: 5.0.1 + is-potential-custom-element-name: 1.0.1 + nwsapi: 2.2.7 + parse5: 7.1.2 + rrweb-cssom: 0.6.0 + saxes: 6.0.0 + symbol-tree: 3.2.4 + tough-cookie: 4.1.3 + w3c-xmlserializer: 4.0.0 + webidl-conversions: 7.0.0 + whatwg-encoding: 2.0.0 + whatwg-mimetype: 3.0.0 + whatwg-url: 12.0.1 + ws: 8.14.2 + xml-name-validator: 4.0.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + dev: true + + /jsesc@2.5.2: + resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} + engines: {node: '>=4'} + hasBin: true + dev: true + + /json5@2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} + engines: {node: '>=6'} + hasBin: true + dev: true + + /jsonc-parser@3.2.0: + resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==} + dev: true + + /lilconfig@2.1.0: + resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} + engines: {node: '>=10'} + dev: true + + /lines-and-columns@1.2.4: + resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + dev: true + + /load-tsconfig@0.2.5: + resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + + /local-pkg@0.4.3: + resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==} + engines: {node: '>=14'} + dev: true + + /lodash.sortby@4.7.0: + resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==} + dev: true + + /lodash@4.17.21: + resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + + /loose-envify@1.4.0: + resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} + hasBin: true + dependencies: + js-tokens: 4.0.0 + + /loupe@2.3.7: + resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} + dependencies: + get-func-name: 2.0.2 + dev: true + + /lru-cache@5.1.1: + resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} + dependencies: + yallist: 3.1.1 + dev: true + + /lz-string@1.5.0: + resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} + hasBin: true + dev: true + + /magic-string@0.30.5: + resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==} + engines: {node: '>=12'} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + + /merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + dev: true + + /merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + dev: true + + /micromatch@4.0.5: + resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} + engines: {node: '>=8.6'} + dependencies: + braces: 3.0.2 + picomatch: 2.3.1 + dev: true + + /mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + dev: true + + /mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + dependencies: + mime-db: 1.52.0 + dev: true + + /mimic-fn@2.1.0: + resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} + engines: {node: '>=6'} + dev: true + + /min-indent@1.0.1: + resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==} + engines: {node: '>=4'} + dev: true + + /minimatch@3.1.2: + resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + dependencies: + brace-expansion: 1.1.11 + dev: true + + /mlly@1.4.2: + resolution: {integrity: sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==} + dependencies: + acorn: 8.11.2 + pathe: 1.1.1 + pkg-types: 1.0.3 + ufo: 1.3.1 + dev: true + + /ms@2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + + /mz@2.7.0: + resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} + dependencies: + any-promise: 1.3.0 + object-assign: 4.1.1 + thenify-all: 1.6.0 + dev: true + + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + dev: true + + /node-releases@2.0.13: + resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==} + dev: true + + /normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + dev: true + + /npm-run-path@4.0.1: + resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} + engines: {node: '>=8'} + dependencies: + path-key: 3.1.1 + dev: true + + /nwsapi@2.2.7: + resolution: {integrity: sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==} + dev: true + + /object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + dev: true + + /object-inspect@1.13.1: + resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} + dev: true + + /object-is@1.1.5: + resolution: {integrity: sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + dev: true + + /object-keys@1.1.1: + resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} + engines: {node: '>= 0.4'} + dev: true + + /object.assign@4.1.4: + resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + has-symbols: 1.0.3 + object-keys: 1.1.1 + dev: true + + /once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + dependencies: + wrappy: 1.0.2 + dev: true + + /onetime@5.1.2: + resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} + engines: {node: '>=6'} + dependencies: + mimic-fn: 2.1.0 + dev: true + + /p-limit@4.0.0: + resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + yocto-queue: 1.0.0 + dev: true + + /parse5@7.1.2: + resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==} + dependencies: + entities: 4.5.0 + dev: true + + /path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + dev: true + + /path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + dev: true + + /path-type@4.0.0: + resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} + engines: {node: '>=8'} + dev: true + + /pathe@1.1.1: + resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==} + dev: true + + /pathval@1.1.1: + resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + dev: true + + /picocolors@1.0.0: + resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} + dev: true + + /picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + dev: true + + /pirates@4.0.6: + resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} + engines: {node: '>= 6'} + dev: true + + /pkg-types@1.0.3: + resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} + dependencies: + jsonc-parser: 3.2.0 + mlly: 1.4.2 + pathe: 1.1.1 + dev: true + + /postcss-load-config@4.0.1: + resolution: {integrity: sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA==} + engines: {node: '>= 14'} + peerDependencies: + postcss: '>=8.0.9' + ts-node: '>=9.0.0' + peerDependenciesMeta: + postcss: + optional: true + ts-node: + optional: true + dependencies: + lilconfig: 2.1.0 + yaml: 2.3.4 + dev: true + + /postcss@8.4.31: + resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.0 + source-map-js: 1.0.2 + dev: true + + /pretty-format@27.5.1: + resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==} + engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + dependencies: + ansi-regex: 5.0.1 + ansi-styles: 5.2.0 + react-is: 17.0.2 + dev: true + + /pretty-format@29.7.0: + resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@jest/schemas': 29.6.3 + ansi-styles: 5.2.0 + react-is: 18.2.0 + dev: true + + /psl@1.9.0: + resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} + dev: true + + /punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + dev: true + + /querystringify@2.2.0: + resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} + dev: true + + /queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + dev: true + + /react-dom@18.2.0(react@18.2.0): + resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==} + peerDependencies: + react: ^18.2.0 + dependencies: + loose-envify: 1.4.0 + react: 18.2.0 + scheduler: 0.23.0 + + /react-is@17.0.2: + resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} + dev: true + + /react-is@18.2.0: + resolution: {integrity: sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==} + dev: true + + /react-refresh@0.14.0: + resolution: {integrity: sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==} + engines: {node: '>=0.10.0'} + dev: true + + /react@18.2.0: + resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==} + engines: {node: '>=0.10.0'} + dependencies: + loose-envify: 1.4.0 + + /readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + dependencies: + picomatch: 2.3.1 + dev: true + + /recoil@0.7.7(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-8Og5KPQW9LwC577Vc7Ug2P0vQshkv1y3zG3tSSkWMqkWSwHmE+by06L8JtnGocjW6gcCvfwB3YtrJG6/tWivNQ==} + peerDependencies: + react: '>=16.13.1' + react-dom: '*' + react-native: '*' + peerDependenciesMeta: + react-dom: + optional: true + react-native: + optional: true + dependencies: + hamt_plus: 1.0.2 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: false + + /redent@3.0.0: + resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==} + engines: {node: '>=8'} + dependencies: + indent-string: 4.0.0 + strip-indent: 3.0.0 + dev: true + + /regenerator-runtime@0.14.0: + resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==} + dev: true + + /regexp.prototype.flags@1.5.1: + resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + set-function-name: 2.0.1 + dev: true + + /requires-port@1.0.0: + resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} + dev: true + + /resolve-from@5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} + dev: true + + /reusify@1.0.4: + resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + dev: true + + /rollup@3.29.4: + resolution: {integrity: sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==} + engines: {node: '>=14.18.0', npm: '>=8.0.0'} + hasBin: true + optionalDependencies: + fsevents: 2.3.3 + dev: true + + /rrweb-cssom@0.6.0: + resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==} + dev: true + + /run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + dependencies: + queue-microtask: 1.2.3 + dev: true + + /safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + dev: true + + /saxes@6.0.0: + resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} + engines: {node: '>=v12.22.7'} + dependencies: + xmlchars: 2.2.0 + dev: true + + /scheduler@0.23.0: + resolution: {integrity: sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==} + dependencies: + loose-envify: 1.4.0 + + /semver@6.3.1: + resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} + hasBin: true + dev: true + + /set-function-length@1.1.1: + resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.1 + get-intrinsic: 1.2.2 + gopd: 1.0.1 + has-property-descriptors: 1.0.1 + dev: true + + /set-function-name@2.0.1: + resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.1 + functions-have-names: 1.2.3 + has-property-descriptors: 1.0.1 + dev: true + + /shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + dependencies: + shebang-regex: 3.0.0 + dev: true + + /shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + dev: true + + /side-channel@1.0.4: + resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + object-inspect: 1.13.1 + dev: true + + /siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + dev: true + + /signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + dev: true + + /slash@3.0.0: + resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} + engines: {node: '>=8'} + dev: true + + /socket.io-client@4.7.2: + resolution: {integrity: sha512-vtA0uD4ibrYD793SOIAwlo8cj6haOeMHrGvwPxJsxH7CeIksqJ+3Zc06RvWTIFgiSqx4A3sOnTXpfAEE2Zyz6w==} + engines: {node: '>=10.0.0'} + dependencies: + '@socket.io/component-emitter': 3.1.0 + debug: 4.3.4 + engine.io-client: 6.5.3 + socket.io-parser: 4.2.4 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + dev: false + + /socket.io-parser@4.2.4: + resolution: {integrity: sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==} + engines: {node: '>=10.0.0'} + dependencies: + '@socket.io/component-emitter': 3.1.0 + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: false + + /source-map-js@1.0.2: + resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} + engines: {node: '>=0.10.0'} + dev: true + + /source-map@0.8.0-beta.0: + resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} + engines: {node: '>= 8'} + dependencies: + whatwg-url: 7.1.0 + dev: true + + /stack-utils@2.0.6: + resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} + engines: {node: '>=10'} + dependencies: + escape-string-regexp: 2.0.0 + dev: true + + /stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + dev: true + + /std-env@3.5.0: + resolution: {integrity: sha512-JGUEaALvL0Mf6JCfYnJOTcobY+Nc7sG/TemDRBqCA0wEr4DER7zDchaaixTlmOxAjG1uRJmX82EQcxwTQTkqVA==} + dev: true + + /stop-iteration-iterator@1.0.0: + resolution: {integrity: sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==} + engines: {node: '>= 0.4'} + dependencies: + internal-slot: 1.0.6 + dev: true + + /strip-final-newline@2.0.0: + resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} + engines: {node: '>=6'} + dev: true + + /strip-indent@3.0.0: + resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==} + engines: {node: '>=8'} + dependencies: + min-indent: 1.0.1 + dev: true + + /strip-literal@1.3.0: + resolution: {integrity: sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==} + dependencies: + acorn: 8.11.2 + dev: true + + /sucrase@3.34.0: + resolution: {integrity: sha512-70/LQEZ07TEcxiU2dz51FKaE6hCTWC6vr7FOk3Gr0U60C3shtAN+H+BFr9XlYe5xqf3RA8nrc+VIwzCfnxuXJw==} + engines: {node: '>=8'} + hasBin: true + dependencies: + '@jridgewell/gen-mapping': 0.3.3 + commander: 4.1.1 + glob: 7.1.6 + lines-and-columns: 1.2.4 + mz: 2.7.0 + pirates: 4.0.6 + ts-interface-checker: 0.1.13 + dev: true + + /supports-color@5.5.0: + resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} + engines: {node: '>=4'} + dependencies: + has-flag: 3.0.0 + dev: true + + /supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + dependencies: + has-flag: 4.0.0 + dev: true + + /symbol-tree@3.2.4: + resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} + dev: true + + /thenify-all@1.6.0: + resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} + engines: {node: '>=0.8'} + dependencies: + thenify: 3.3.1 + dev: true + + /thenify@3.3.1: + resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + dependencies: + any-promise: 1.3.0 + dev: true + + /tinybench@2.5.1: + resolution: {integrity: sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==} + dev: true + + /tinypool@0.7.0: + resolution: {integrity: sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==} + engines: {node: '>=14.0.0'} + dev: true + + /tinyspy@2.2.0: + resolution: {integrity: sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg==} + engines: {node: '>=14.0.0'} + dev: true + + /to-fast-properties@2.0.0: + resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} + engines: {node: '>=4'} + dev: true + + /to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + dependencies: + is-number: 7.0.0 + dev: true + + /tough-cookie@4.1.3: + resolution: {integrity: sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==} + engines: {node: '>=6'} + dependencies: + psl: 1.9.0 + punycode: 2.3.1 + universalify: 0.2.0 + url-parse: 1.5.10 + dev: true + + /tr46@1.0.1: + resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==} + dependencies: + punycode: 2.3.1 + dev: true + + /tr46@4.1.1: + resolution: {integrity: sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==} + engines: {node: '>=14'} + dependencies: + punycode: 2.3.1 + dev: true + + /tree-kill@1.2.2: + resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} + hasBin: true + dev: true + + /ts-interface-checker@0.1.13: + resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} + dev: true + + /tsconfck@2.1.2(typescript@5.2.2): + resolution: {integrity: sha512-ghqN1b0puy3MhhviwO2kGF8SeMDNhEbnKxjK7h6+fvY9JAxqvXi8y5NAHSQv687OVboS2uZIByzGd45/YxrRHg==} + engines: {node: ^14.13.1 || ^16 || >=18} + hasBin: true + peerDependencies: + typescript: ^4.3.5 || ^5.0.0 + peerDependenciesMeta: + typescript: + optional: true + dependencies: + typescript: 5.2.2 + dev: true + + /tslib@2.6.2: + resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + dev: true + + /tsup@7.2.0(@swc/core@1.3.86)(typescript@5.2.2): + resolution: {integrity: sha512-vDHlczXbgUvY3rWvqFEbSqmC1L7woozbzngMqTtL2PGBODTtWlRwGDDawhvWzr5c1QjKe4OAKqJGfE1xeXUvtQ==} + engines: {node: '>=16.14'} + hasBin: true + peerDependencies: + '@swc/core': ^1 + postcss: ^8.4.12 + typescript: '>=4.1.0' + peerDependenciesMeta: + '@swc/core': + optional: true + postcss: + optional: true + typescript: + optional: true + dependencies: + '@swc/core': 1.3.86 + bundle-require: 4.0.2(esbuild@0.18.20) + cac: 6.7.14 + chokidar: 3.5.3 + debug: 4.3.4 + esbuild: 0.18.20 + execa: 5.1.1 + globby: 11.1.0 + joycon: 3.1.1 + postcss-load-config: 4.0.1 + resolve-from: 5.0.0 + rollup: 3.29.4 + source-map: 0.8.0-beta.0 + sucrase: 3.34.0 + tree-kill: 1.2.2 + typescript: 5.2.2 + transitivePeerDependencies: + - supports-color + - ts-node + dev: true + + /type-detect@4.0.8: + resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} + engines: {node: '>=4'} + dev: true + + /typescript@5.2.2: + resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + + /ufo@1.3.1: + resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==} + dev: true + + /undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + dev: true + + /universalify@0.2.0: + resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} + engines: {node: '>= 4.0.0'} + dev: true + + /update-browserslist-db@1.0.13(browserslist@4.22.1): + resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + dependencies: + browserslist: 4.22.1 + escalade: 3.1.1 + picocolors: 1.0.0 + dev: true + + /url-parse@1.5.10: + resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} + dependencies: + querystringify: 2.2.0 + requires-port: 1.0.0 + dev: true + + /uuid@9.0.0: + resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==} + hasBin: true + dev: false + + /vite-node@0.34.4(@types/node@20.9.0): + resolution: {integrity: sha512-ho8HtiLc+nsmbwZMw8SlghESEE3KxJNp04F/jPUCLVvaURwt0d+r9LxEqCX5hvrrOQ0GSyxbYr5ZfRYhQ0yVKQ==} + engines: {node: '>=v14.18.0'} + hasBin: true + dependencies: + cac: 6.7.14 + debug: 4.3.4 + mlly: 1.4.2 + pathe: 1.1.1 + picocolors: 1.0.0 + vite: 4.4.9(@types/node@20.9.0) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + dev: true + + /vite-tsconfig-paths@4.2.0(typescript@5.2.2)(vite@4.4.9): + resolution: {integrity: sha512-jGpus0eUy5qbbMVGiTxCL1iB9ZGN6Bd37VGLJU39kTDD6ZfULTTb1bcc5IeTWqWJKiWV5YihCaibeASPiGi8kw==} + peerDependencies: + vite: '*' + peerDependenciesMeta: + vite: + optional: true + dependencies: + debug: 4.3.4 + globrex: 0.1.2 + tsconfck: 2.1.2(typescript@5.2.2) + vite: 4.4.9(@types/node@20.9.0) + transitivePeerDependencies: + - supports-color + - typescript + dev: true + + /vite@4.4.9(@types/node@20.9.0): + resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==} + engines: {node: ^14.18.0 || >=16.0.0} + hasBin: true + peerDependencies: + '@types/node': '>= 14' + less: '*' + lightningcss: ^1.21.0 + sass: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + dependencies: + '@types/node': 20.9.0 + esbuild: 0.18.20 + postcss: 8.4.31 + rollup: 3.29.4 + optionalDependencies: + fsevents: 2.3.3 + dev: true + + /vitest@0.34.4(jsdom@22.1.0): + resolution: {integrity: sha512-SE/laOsB6995QlbSE6BtkpXDeVNLJc1u2LHRG/OpnN4RsRzM3GQm4nm3PQCK5OBtrsUqnhzLdnT7se3aeNGdlw==} + engines: {node: '>=v14.18.0'} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@vitest/browser': '*' + '@vitest/ui': '*' + happy-dom: '*' + jsdom: '*' + playwright: '*' + safaridriver: '*' + webdriverio: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + playwright: + optional: true + safaridriver: + optional: true + webdriverio: + optional: true + dependencies: + '@types/chai': 4.3.10 + '@types/chai-subset': 1.3.5 + '@types/node': 20.9.0 + '@vitest/expect': 0.34.4 + '@vitest/runner': 0.34.4 + '@vitest/snapshot': 0.34.4 + '@vitest/spy': 0.34.4 + '@vitest/utils': 0.34.4 + acorn: 8.11.2 + acorn-walk: 8.3.0 + cac: 6.7.14 + chai: 4.3.10 + debug: 4.3.4 + jsdom: 22.1.0 + local-pkg: 0.4.3 + magic-string: 0.30.5 + pathe: 1.1.1 + picocolors: 1.0.0 + std-env: 3.5.0 + strip-literal: 1.3.0 + tinybench: 2.5.1 + tinypool: 0.7.0 + vite: 4.4.9(@types/node@20.9.0) + vite-node: 0.34.4(@types/node@20.9.0) + why-is-node-running: 2.2.2 + transitivePeerDependencies: + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + dev: true + + /w3c-xmlserializer@4.0.0: + resolution: {integrity: sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==} + engines: {node: '>=14'} + dependencies: + xml-name-validator: 4.0.0 + dev: true + + /webidl-conversions@4.0.2: + resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} + dev: true + + /webidl-conversions@7.0.0: + resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} + engines: {node: '>=12'} + dev: true + + /whatwg-encoding@2.0.0: + resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==} + engines: {node: '>=12'} + dependencies: + iconv-lite: 0.6.3 + dev: true + + /whatwg-mimetype@3.0.0: + resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} + engines: {node: '>=12'} + dev: true + + /whatwg-url@12.0.1: + resolution: {integrity: sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==} + engines: {node: '>=14'} + dependencies: + tr46: 4.1.1 + webidl-conversions: 7.0.0 + dev: true + + /whatwg-url@7.1.0: + resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} + dependencies: + lodash.sortby: 4.7.0 + tr46: 1.0.1 + webidl-conversions: 4.0.2 + dev: true + + /which-boxed-primitive@1.0.2: + resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} + dependencies: + is-bigint: 1.0.4 + is-boolean-object: 1.1.2 + is-number-object: 1.0.7 + is-string: 1.0.7 + is-symbol: 1.0.4 + dev: true + + /which-collection@1.0.1: + resolution: {integrity: sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==} + dependencies: + is-map: 2.0.2 + is-set: 2.0.2 + is-weakmap: 2.0.1 + is-weakset: 2.0.2 + dev: true + + /which-typed-array@1.1.13: + resolution: {integrity: sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.5 + call-bind: 1.0.5 + for-each: 0.3.3 + gopd: 1.0.1 + has-tostringtag: 1.0.0 + dev: true + + /which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + dependencies: + isexe: 2.0.0 + dev: true + + /why-is-node-running@2.2.2: + resolution: {integrity: sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==} + engines: {node: '>=8'} + hasBin: true + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + dev: true + + /wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + dev: true + + /ws@8.11.0: + resolution: {integrity: sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dev: false + + /ws@8.14.2: + resolution: {integrity: sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dev: true + + /xml-name-validator@4.0.0: + resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==} + engines: {node: '>=12'} + dev: true + + /xmlchars@2.2.0: + resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} + dev: true + + /xmlhttprequest-ssl@2.0.0: + resolution: {integrity: sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==} + engines: {node: '>=0.4.0'} + dev: false + + /yallist@3.1.1: + resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + dev: true + + /yaml@2.3.4: + resolution: {integrity: sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==} + engines: {node: '>= 14'} + dev: true + + /yocto-queue@1.0.0: + resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} + engines: {node: '>=12.20'} + dev: true diff --git a/libs/react-client/src/index.ts b/libs/react-client/src/index.ts new file mode 100644 index 0000000000..98c48e46ed --- /dev/null +++ b/libs/react-client/src/index.ts @@ -0,0 +1,7 @@ +export * from './useChatData'; +export * from './useChatInteract'; +export * from './useChatMessages'; +export * from './useChatSession'; +export * from './types'; +export * from './state'; +export * from './utils/message'; diff --git a/libs/components/hooks/useChat/state.ts b/libs/react-client/src/state.ts similarity index 92% rename from libs/components/hooks/useChat/state.ts rename to libs/react-client/src/state.ts index 1b14e35205..b9064a2477 100644 --- a/libs/components/hooks/useChat/state.ts +++ b/libs/react-client/src/state.ts @@ -1,6 +1,7 @@ import { DefaultValue, atom, selector } from 'recoil'; import { Socket } from 'socket.io-client'; -import { TFormInput } from 'src/inputs'; +import { v4 as uuidv4 } from 'uuid'; + import { IAction, IAsk, @@ -8,8 +9,7 @@ import { IMessage, IMessageElement, ITasklistElement -} from 'src/types'; -import { v4 as uuidv4 } from 'uuid'; +} from './types'; export interface ISession { socket: Socket; @@ -70,7 +70,7 @@ export const askUserState = atom({ default: undefined }); -export const chatSettingsInputsState = atom({ +export const chatSettingsInputsState = atom({ key: 'ChatSettings', default: [] }); @@ -80,7 +80,7 @@ export const chatSettingsDefaultValueSelector = selector({ get: ({ get }) => { const chatSettings = get(chatSettingsInputsState); return chatSettings.reduce( - (form: { [key: string]: any }, input: TFormInput) => ( + (form: { [key: string]: any }, input: any) => ( (form[input.id] = input.initial), form ), {} diff --git a/libs/components/src/types/action.ts b/libs/react-client/src/types/action.ts similarity index 100% rename from libs/components/src/types/action.ts rename to libs/react-client/src/types/action.ts diff --git a/libs/components/src/types/conversation.ts b/libs/react-client/src/types/conversation.ts similarity index 100% rename from libs/components/src/types/conversation.ts rename to libs/react-client/src/types/conversation.ts diff --git a/libs/components/src/types/element.ts b/libs/react-client/src/types/element.ts similarity index 100% rename from libs/components/src/types/element.ts rename to libs/react-client/src/types/element.ts diff --git a/libs/components/src/types/file.ts b/libs/react-client/src/types/file.ts similarity index 100% rename from libs/components/src/types/file.ts rename to libs/react-client/src/types/file.ts diff --git a/libs/react-client/src/types/index.ts b/libs/react-client/src/types/index.ts new file mode 100644 index 0000000000..f5a83a7cd2 --- /dev/null +++ b/libs/react-client/src/types/index.ts @@ -0,0 +1,6 @@ +export * from './action'; +export * from './element'; +export * from './file'; +export * from './message'; +export * from './user'; +export * from './conversation'; diff --git a/libs/components/src/types/message.ts b/libs/react-client/src/types/message.ts similarity index 82% rename from libs/components/src/types/message.ts rename to libs/react-client/src/types/message.ts index f9ddae80d0..f9987ee795 100644 --- a/libs/components/src/types/message.ts +++ b/libs/react-client/src/types/message.ts @@ -1,5 +1,4 @@ import { IFileElement, IMessageElement } from './element'; -import { IFunction } from './playground'; interface IBaseTemplate { template?: string; @@ -15,6 +14,20 @@ export interface IPromptMessage extends IBaseTemplate { name?: string; } +export interface IFunction { + name: string; + description: string; + parameters: { + required: string[]; + properties: Record; + }; +} + +export interface ITool { + type: string; + function: IFunction; +} + export interface IPrompt extends IBaseTemplate { provider: string; id?: string; diff --git a/libs/components/src/types/user.ts b/libs/react-client/src/types/user.ts similarity index 100% rename from libs/components/src/types/user.ts rename to libs/react-client/src/types/user.ts diff --git a/libs/components/hooks/useChat/useChatData.ts b/libs/react-client/src/useChatData.ts similarity index 100% rename from libs/components/hooks/useChat/useChatData.ts rename to libs/react-client/src/useChatData.ts diff --git a/libs/components/hooks/useChat/useChatInteract.ts b/libs/react-client/src/useChatInteract.ts similarity index 97% rename from libs/components/hooks/useChat/useChatInteract.ts rename to libs/react-client/src/useChatInteract.ts index 8dfb05ddf6..eebd537dfe 100644 --- a/libs/components/hooks/useChat/useChatInteract.ts +++ b/libs/react-client/src/useChatInteract.ts @@ -1,8 +1,5 @@ import { useCallback } from 'react'; import { useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil'; -import { IAction, IFileElement, IMessage } from 'src/types'; -import { addMessage } from 'utils/message'; - import { actionState, askUserState, @@ -18,7 +15,9 @@ import { sessionState, tasklistState, tokenCountState -} from './state'; +} from 'src/state'; +import { IAction, IFileElement, IMessage } from 'src/types'; +import { addMessage } from 'src/utils/message'; const useChatInteract = () => { const session = useRecoilValue(sessionState); diff --git a/libs/components/hooks/useChat/useChatMessages.ts b/libs/react-client/src/useChatMessages.ts similarity index 100% rename from libs/components/hooks/useChat/useChatMessages.ts rename to libs/react-client/src/useChatMessages.ts diff --git a/libs/components/hooks/useChat/useChatSession.ts b/libs/react-client/src/useChatSession.ts similarity index 98% rename from libs/components/hooks/useChat/useChatSession.ts rename to libs/react-client/src/useChatSession.ts index d75d1f5b59..e08676dc00 100644 --- a/libs/components/hooks/useChat/useChatSession.ts +++ b/libs/react-client/src/useChatSession.ts @@ -7,23 +7,6 @@ import { useSetRecoilState } from 'recoil'; import io from 'socket.io-client'; -import { TFormInput } from 'src/inputs'; -import { - IAction, - IAvatarElement, - IConversation, - IElement, - IMessage, - IMessageElement, - ITasklistElement -} from 'src/types'; -import { - addMessage, - deleteMessageById, - updateMessageById, - updateMessageContentById -} from 'utils/message'; - import { actionState, askUserState, @@ -40,7 +23,23 @@ import { sessionState, tasklistState, tokenCountState -} from './state'; +} from 'src/state'; +import { + IAction, + IAvatarElement, + IConversation, + IElement, + IMessage, + IMessageElement, + ITasklistElement +} from 'src/types'; +import { + addMessage, + deleteMessageById, + updateMessageById, + updateMessageContentById +} from 'src/utils/message'; + import { IMessageUpdate, IToken } from './useChatData'; const useChatSession = () => { @@ -184,7 +183,7 @@ const useChatSession = () => { setAskUser(undefined); }); - socket.on('chat_settings', (inputs: TFormInput[]) => { + socket.on('chat_settings', (inputs: any) => { setChatSettingsInputs(inputs); resetChatSettingsValue(); }); diff --git a/libs/components/utils/message.ts b/libs/react-client/src/utils/message.ts similarity index 98% rename from libs/components/utils/message.ts rename to libs/react-client/src/utils/message.ts index a214ebac4c..775d3bbbc0 100644 --- a/libs/components/utils/message.ts +++ b/libs/react-client/src/utils/message.ts @@ -1,7 +1,6 @@ import isEqual from 'lodash/isEqual'; -import { IMessageElement } from 'src/types/element'; -import { IMessage } from 'src/types/message'; +import { IMessage, IMessageElement } from '../types'; const nestMessages = (messages: IMessage[]): IMessage[] => { let nestedMessages: IMessage[] = []; diff --git a/libs/react-client/tsconfig.json b/libs/react-client/tsconfig.json new file mode 100644 index 0000000000..8bc832ec05 --- /dev/null +++ b/libs/react-client/tsconfig.json @@ -0,0 +1,38 @@ +{ + "compilerOptions": { + // THIS MUST BE AT ROOT, if you set baseurl in sub-package it breaks intellisense jump to + "baseUrl": ".", + "rootDir": ".", + "outDir": "dist", + "importHelpers": true, + "allowJs": false, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "declaration": true, + "downlevelIteration": true, + "strict": true, + "esModuleInterop": true, + "jsx": "react-jsx", + "module": "system", + "moduleResolution": "node", + "noEmitOnError": false, + "noImplicitAny": false, + "noImplicitReturns": false, + "noUnusedLocals": false, + "noUnusedParameters": false, + "preserveConstEnums": true, + "removeComments": true, + "skipLibCheck": true, + "sourceMap": false, + "strictNullChecks": true, + "target": "es5", + "types": ["node", "react"], + "lib": ["DOM", "DOM.Iterable", "ESNext"], + "paths": { + "src/*": ["./src/*"] + } + }, + "exclude": ["**/test", "**/dist", "**/types", "**/__tests__"], + "include": ["./src"], + "types": ["@testing-library/jest-dom", "node"] +} diff --git a/libs/components/.gitignore b/libs/react-components/.gitignore similarity index 100% rename from libs/components/.gitignore rename to libs/react-components/.gitignore diff --git a/libs/components/README.md b/libs/react-components/README.md similarity index 100% rename from libs/components/README.md rename to libs/react-components/README.md diff --git a/libs/components/contexts/MessageContext.tsx b/libs/react-components/contexts/MessageContext.tsx similarity index 100% rename from libs/components/contexts/MessageContext.tsx rename to libs/react-components/contexts/MessageContext.tsx diff --git a/libs/components/contexts/PlaygroundContext.tsx b/libs/react-components/contexts/PlaygroundContext.tsx similarity index 100% rename from libs/components/contexts/PlaygroundContext.tsx rename to libs/react-components/contexts/PlaygroundContext.tsx diff --git a/libs/react-components/hooks/index.ts b/libs/react-components/hooks/index.ts new file mode 100644 index 0000000000..b941bded0a --- /dev/null +++ b/libs/react-components/hooks/index.ts @@ -0,0 +1,4 @@ +export { useApi } from './useApi'; +export { useColors } from './useColors'; +export { useIsDarkMode } from './useIsDarkMode'; +export { useUpload } from './useUpload'; diff --git a/libs/components/hooks/useApi.tsx b/libs/react-components/hooks/useApi.tsx similarity index 100% rename from libs/components/hooks/useApi.tsx rename to libs/react-components/hooks/useApi.tsx diff --git a/libs/components/hooks/useColors.tsx b/libs/react-components/hooks/useColors.tsx similarity index 100% rename from libs/components/hooks/useColors.tsx rename to libs/react-components/hooks/useColors.tsx diff --git a/libs/components/hooks/useIsDarkMode.tsx b/libs/react-components/hooks/useIsDarkMode.tsx similarity index 100% rename from libs/components/hooks/useIsDarkMode.tsx rename to libs/react-components/hooks/useIsDarkMode.tsx diff --git a/libs/components/hooks/useUpload.tsx b/libs/react-components/hooks/useUpload.tsx similarity index 97% rename from libs/components/hooks/useUpload.tsx rename to libs/react-components/hooks/useUpload.tsx index 3f60dbe89b..56a14e225c 100644 --- a/libs/components/hooks/useUpload.tsx +++ b/libs/react-components/hooks/useUpload.tsx @@ -6,7 +6,7 @@ import { useDropzone } from 'react-dropzone'; -import { FileSpec, IFileResponse } from 'src/types/file'; +import { FileSpec, IFileResponse } from '@chainlit/react-client'; interface useUploadProps { onError?: (error: string) => void; diff --git a/libs/components/package.json b/libs/react-components/package.json similarity index 86% rename from libs/components/package.json rename to libs/react-components/package.json index ffc0e3f640..b139f43ca6 100644 --- a/libs/components/package.json +++ b/libs/react-components/package.json @@ -1,10 +1,10 @@ { - "name": "@chainlit/components", - "description": "Reusable components of the Chainlit UI.", - "version": "0.1.1", + "name": "@chainlit/react-components", + "description": "Reusable react components of the Chainlit UI.", + "version": "0.0.1", "scripts": { - "build": "tsup src/index.ts --clean --format esm,cjs --dts --external react --legacy-output --minify --sourcemap --treeshake", - "build:watch": "tsup src/index.ts --watch --clean --format esm,cjs --dts --external react --legacy-output --minify --sourcemap --treeshake", + "build": "tsup src/index.ts --clean --format esm,cjs --dts --external react --external recoil --legacy-output --minify --sourcemap --treeshake", + "build:watch": "tsup src/index.ts --watch --clean --format esm,cjs --dts --external react --external recoil --legacy-output --minify --sourcemap --treeshake", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "format": "prettier **/*.{ts,tsx} --write --loglevel error", "test": "vitest run", @@ -58,10 +58,10 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "recoil": "^0.7.7", - "socket.io-client": "^4.7.2", "uuid": "^9.0.0" }, "dependencies": { + "@chainlit/react-client": "workspace:^", "draft-js": "^0.11.7", "formik": "^2.4.3", "highlight.js": "^11.9.0", diff --git a/libs/components/pnpm-lock.yaml b/libs/react-components/pnpm-lock.yaml similarity index 97% rename from libs/components/pnpm-lock.yaml rename to libs/react-components/pnpm-lock.yaml index 1a98a6bb1b..5223a2264f 100644 --- a/libs/components/pnpm-lock.yaml +++ b/libs/react-components/pnpm-lock.yaml @@ -5,6 +5,9 @@ settings: excludeLinksFromLockfile: false dependencies: + '@chainlit/react-client': + specifier: workspace:^ + version: link:../react-client '@emotion/react': specifier: ^11.11.1 version: 11.11.1(@types/react@18.2.0)(react@18.2.0) @@ -77,9 +80,6 @@ dependencies: remark-math: specifier: ^6.0.0 version: 6.0.0 - socket.io-client: - specifier: ^4.7.2 - version: 4.7.2 swr: specifier: ^2.2.2 version: 2.2.2(react@18.2.0) @@ -845,8 +845,8 @@ packages: dependencies: '@babel/runtime': 7.23.2 '@emotion/is-prop-valid': 1.2.1 - '@mui/types': 7.2.8(@types/react@18.2.0) - '@mui/utils': 5.14.17(@types/react@18.2.0)(react@18.2.0) + '@mui/types': 7.2.9(@types/react@18.2.0) + '@mui/utils': 5.14.18(@types/react@18.2.0)(react@18.2.0) '@popperjs/core': 2.11.8 '@types/react': 18.2.0 clsx: 1.2.1 @@ -869,8 +869,8 @@ packages: dependencies: '@babel/runtime': 7.23.2 '@floating-ui/react-dom': 2.0.4(react-dom@18.2.0)(react@18.2.0) - '@mui/types': 7.2.8(@types/react@18.2.0) - '@mui/utils': 5.14.17(@types/react@18.2.0)(react@18.2.0) + '@mui/types': 7.2.9(@types/react@18.2.0) + '@mui/utils': 5.14.18(@types/react@18.2.0)(react@18.2.0) '@popperjs/core': 2.11.8 '@types/react': 18.2.0 clsx: 2.0.0 @@ -879,8 +879,8 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: false - /@mui/core-downloads-tracker@5.14.17: - resolution: {integrity: sha512-eE0uxrpJAEL2ZXkeGLKg8HQDafsiXY+6eNpP4lcv3yIjFfGbU6Hj9/P7Adt8jpU+6JIhmxvILGj2r27pX+zdrQ==} + /@mui/core-downloads-tracker@5.14.18: + resolution: {integrity: sha512-yFpF35fEVDV81nVktu0BE9qn2dD/chs7PsQhlyaV3EnTeZi9RZBuvoEfRym1/jmhJ2tcfeWXiRuHG942mQXJJQ==} dev: false /@mui/icons-material@5.14.9(@mui/material@5.14.10)(@types/react@18.2.0)(react@18.2.0): @@ -923,9 +923,9 @@ packages: '@emotion/styled': 11.11.0(@emotion/react@11.11.1)(@types/react@18.2.0)(react@18.2.0) '@mui/base': 5.0.0-alpha.120(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) '@mui/material': 5.14.10(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) - '@mui/system': 5.14.17(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react@18.2.0) - '@mui/types': 7.2.8(@types/react@18.2.0) - '@mui/utils': 5.14.17(@types/react@18.2.0)(react@18.2.0) + '@mui/system': 5.14.18(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react@18.2.0) + '@mui/types': 7.2.9(@types/react@18.2.0) + '@mui/utils': 5.14.18(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 clsx: 1.2.1 prop-types: 15.8.1 @@ -955,10 +955,10 @@ packages: '@emotion/react': 11.11.1(@types/react@18.2.0)(react@18.2.0) '@emotion/styled': 11.11.0(@emotion/react@11.11.1)(@types/react@18.2.0)(react@18.2.0) '@mui/base': 5.0.0-beta.16(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) - '@mui/core-downloads-tracker': 5.14.17 - '@mui/system': 5.14.17(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react@18.2.0) - '@mui/types': 7.2.8(@types/react@18.2.0) - '@mui/utils': 5.14.17(@types/react@18.2.0)(react@18.2.0) + '@mui/core-downloads-tracker': 5.14.18 + '@mui/system': 5.14.18(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react@18.2.0) + '@mui/types': 7.2.9(@types/react@18.2.0) + '@mui/utils': 5.14.18(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 '@types/react-transition-group': 4.4.9 clsx: 2.0.0 @@ -970,8 +970,8 @@ packages: react-transition-group: 4.4.5(react-dom@18.2.0)(react@18.2.0) dev: false - /@mui/private-theming@5.14.17(@types/react@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-u4zxsCm9xmQrlhVPug+Ccrtsjv7o2+rehvrgHoh0siSguvVgVQq5O3Hh10+tp/KWQo2JR4/nCEwquSXgITS1+g==} + /@mui/private-theming@5.14.18(@types/react@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-WSgjqRlzfHU+2Rou3HlR2Gqfr4rZRsvFgataYO3qQ0/m6gShJN+lhVEvwEiJ9QYyVzMDvNpXZAcqp8Y2Vl+PAw==} engines: {node: '>=12.0.0'} peerDependencies: '@types/react': ^17.0.0 || ^18.0.0 @@ -981,14 +981,14 @@ packages: optional: true dependencies: '@babel/runtime': 7.23.2 - '@mui/utils': 5.14.17(@types/react@18.2.0)(react@18.2.0) + '@mui/utils': 5.14.18(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 prop-types: 15.8.1 react: 18.2.0 dev: false - /@mui/styled-engine@5.14.17(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(react@18.2.0): - resolution: {integrity: sha512-AqpVjBEA7wnBvKPW168bNlqB6EN7HxTjLOY7oi275AzD/b1C7V0wqELy6NWoJb2yya5sRf7ENf4iNi3+T5cOgw==} + /@mui/styled-engine@5.14.18(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(react@18.2.0): + resolution: {integrity: sha512-pW8bpmF9uCB5FV2IPk6mfbQCjPI5vGI09NOLhtGXPeph/4xIfC3JdIX0TILU0WcTs3aFQqo6s2+1SFgIB9rCXA==} engines: {node: '>=12.0.0'} peerDependencies: '@emotion/react': ^11.4.1 @@ -1009,8 +1009,8 @@ packages: react: 18.2.0 dev: false - /@mui/system@5.14.17(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-Ccz3XlbCqka6DnbHfpL3o3TfOeWQPR+ewvNAgm8gnS9M0yVMmzzmY6z0w/C1eebb+7ZP7IoLUj9vojg/GBaTPg==} + /@mui/system@5.14.18(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-hSQQdb3KF72X4EN2hMEiv8EYJZSflfdd1TRaGPoR7CIAG347OxCslpBUwWngYobaxgKvq6xTrlIl+diaactVww==} engines: {node: '>=12.0.0'} peerDependencies: '@emotion/react': ^11.5.0 @@ -1028,10 +1028,10 @@ packages: '@babel/runtime': 7.23.2 '@emotion/react': 11.11.1(@types/react@18.2.0)(react@18.2.0) '@emotion/styled': 11.11.0(@emotion/react@11.11.1)(@types/react@18.2.0)(react@18.2.0) - '@mui/private-theming': 5.14.17(@types/react@18.2.0)(react@18.2.0) - '@mui/styled-engine': 5.14.17(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(react@18.2.0) - '@mui/types': 7.2.8(@types/react@18.2.0) - '@mui/utils': 5.14.17(@types/react@18.2.0)(react@18.2.0) + '@mui/private-theming': 5.14.18(@types/react@18.2.0)(react@18.2.0) + '@mui/styled-engine': 5.14.18(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(react@18.2.0) + '@mui/types': 7.2.9(@types/react@18.2.0) + '@mui/utils': 5.14.18(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 clsx: 2.0.0 csstype: 3.1.2 @@ -1039,8 +1039,8 @@ packages: react: 18.2.0 dev: false - /@mui/types@7.2.8(@types/react@18.2.0): - resolution: {integrity: sha512-9u0ji+xspl96WPqvrYJF/iO+1tQ1L5GTaDOeG3vCR893yy7VcWwRNiVMmPdPNpMDqx0WV1wtEW9OMwK9acWJzQ==} + /@mui/types@7.2.9(@types/react@18.2.0): + resolution: {integrity: sha512-k1lN/PolaRZfNsRdAqXtcR71sTnv3z/VCCGPxU8HfdftDkzi335MdJ6scZxvofMAd/K/9EbzCZTFBmlNpQVdCg==} peerDependencies: '@types/react': ^17.0.0 || ^18.0.0 peerDependenciesMeta: @@ -1050,8 +1050,8 @@ packages: '@types/react': 18.2.0 dev: false - /@mui/utils@5.14.17(@types/react@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-yxnWgSS4J6DMFPw2Dof85yBkG02VTbEiqsikymMsnZnXDurtVGTIhlNuV24GTmFTuJMzEyTTU9UF+O7zaL8LEQ==} + /@mui/utils@5.14.18(@types/react@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-HZDRsJtEZ7WMSnrHV9uwScGze4wM/Y+u6pDVo+grUjt5yXzn+wI8QX/JwTHh9YSw/WpnUL80mJJjgCnWj2VrzQ==} engines: {node: '>=12.0.0'} peerDependencies: '@types/react': ^17.0.0 || ^18.0.0 @@ -1137,10 +1137,6 @@ packages: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true - /@socket.io/component-emitter@3.1.0: - resolution: {integrity: sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==} - dev: false - /@swc/core-darwin-arm64@1.3.86: resolution: {integrity: sha512-hMvSDms0sJJHNtRa3Vhmr9StWN1vmikbf5VE0IZUYGnF1/JZTkXU1h6CdNUY4Hr6i7uCZjH6BEhxFHX1JtKV4w==} engines: {node: '>=10'} @@ -1757,8 +1753,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001561 - electron-to-chromium: 1.4.581 + caniuse-lite: 1.0.30001562 + electron-to-chromium: 1.4.583 node-releases: 2.0.13 update-browserslist-db: 1.0.13(browserslist@4.22.1) dev: true @@ -1795,8 +1791,8 @@ packages: engines: {node: '>=6'} dev: false - /caniuse-lite@1.0.30001561: - resolution: {integrity: sha512-NTt0DNoKe958Q0BE0j0c1V9jbUzhBxHIEJy7asmGrpE0yG63KTV7PLHPnK2E1O9RsQrQ081I3NLuXGS6zht3cw==} + /caniuse-lite@1.0.30001562: + resolution: {integrity: sha512-kfte3Hym//51EdX4239i+Rmp20EsLIYGdPkERegTgU19hQWCRhsRFGKHTliUlsry53tv17K7n077Kqa0WJU4ng==} dev: true /canvas-fit@1.5.0: @@ -2402,8 +2398,8 @@ packages: resolution: {integrity: sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==} dev: false - /electron-to-chromium@1.4.581: - resolution: {integrity: sha512-6uhqWBIapTJUxgPTCHH9sqdbxIMPt7oXl0VcAL1kOtlU6aECdcMncCrX5Z7sHQ/invtrC9jUQUef7+HhO8vVFw==} + /electron-to-chromium@1.4.583: + resolution: {integrity: sha512-93y1gcONABZ7uqYe/JWDVQP/Pj/sQSunF0HVAPdlg/pfBnOyBMLlQUxWvkqcljJg1+W6cjvPuYD+r1Th9Tn8mA==} dev: true /element-size@1.1.1: @@ -2422,25 +2418,6 @@ packages: once: 1.4.0 dev: false - /engine.io-client@6.5.3: - resolution: {integrity: sha512-9Z0qLB0NIisTRt1DZ/8U2k12RJn8yls/nXMZLn+/N8hANT3TcYjKFKcwbw5zFQiN4NTde3TSY9zb79e1ij6j9Q==} - dependencies: - '@socket.io/component-emitter': 3.1.0 - debug: 4.3.4 - engine.io-parser: 5.2.1 - ws: 8.11.0 - xmlhttprequest-ssl: 2.0.0 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - dev: false - - /engine.io-parser@5.2.1: - resolution: {integrity: sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==} - engines: {node: '>=10.0.0'} - dev: false - /entities@4.5.0: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} @@ -5202,30 +5179,6 @@ packages: engines: {node: '>=8'} dev: true - /socket.io-client@4.7.2: - resolution: {integrity: sha512-vtA0uD4ibrYD793SOIAwlo8cj6haOeMHrGvwPxJsxH7CeIksqJ+3Zc06RvWTIFgiSqx4A3sOnTXpfAEE2Zyz6w==} - engines: {node: '>=10.0.0'} - dependencies: - '@socket.io/component-emitter': 3.1.0 - debug: 4.3.4 - engine.io-client: 6.5.3 - socket.io-parser: 4.2.4 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - dev: false - - /socket.io-parser@4.2.4: - resolution: {integrity: sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==} - engines: {node: '>=10.0.0'} - dependencies: - '@socket.io/component-emitter': 3.1.0 - debug: 4.3.4 - transitivePeerDependencies: - - supports-color - dev: false - /source-map-js@1.0.2: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} @@ -5275,8 +5228,8 @@ packages: escodegen: 1.14.3 dev: false - /std-env@3.4.3: - resolution: {integrity: sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==} + /std-env@3.5.0: + resolution: {integrity: sha512-JGUEaALvL0Mf6JCfYnJOTcobY+Nc7sG/TemDRBqCA0wEr4DER7zDchaaixTlmOxAjG1uRJmX82EQcxwTQTkqVA==} dev: true /stop-iteration-iterator@1.0.0: @@ -5929,7 +5882,7 @@ packages: magic-string: 0.30.5 pathe: 1.1.1 picocolors: 1.0.0 - std-env: 3.4.3 + std-env: 3.5.0 strip-literal: 1.3.0 tinybench: 2.5.1 tinypool: 0.7.0 @@ -6084,19 +6037,6 @@ packages: /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - /ws@8.11.0: - resolution: {integrity: sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - dev: false - /ws@8.14.2: resolution: {integrity: sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==} engines: {node: '>=10.0.0'} @@ -6119,11 +6059,6 @@ packages: resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} dev: true - /xmlhttprequest-ssl@2.0.0: - resolution: {integrity: sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==} - engines: {node: '>=0.4.0'} - dev: false - /xtend@2.2.0: resolution: {integrity: sha512-SLt5uylT+4aoXxXuwtQp5ZnMMzhDb1Xkg4pEqc00WUJCQifPfV9Ub1VrNhp9kXkrjZD2I2Hl8WnjP37jzZLPZw==} engines: {node: '>=0.4'} diff --git a/libs/components/src/Attachments.tsx b/libs/react-components/src/Attachments.tsx similarity index 94% rename from libs/components/src/Attachments.tsx rename to libs/react-components/src/Attachments.tsx index e4a96562f9..0ed64962b6 100644 --- a/libs/components/src/Attachments.tsx +++ b/libs/react-components/src/Attachments.tsx @@ -2,8 +2,9 @@ import React from 'react'; import Stack from '@mui/material/Stack'; +import { IFileElement } from '@chainlit/react-client'; + import { FileElement } from './elements'; -import { IFileElement } from './types'; interface AttachmentsProps { fileElements: IFileElement[]; diff --git a/libs/components/src/ClipboardCopy.tsx b/libs/react-components/src/ClipboardCopy.tsx similarity index 100% rename from libs/components/src/ClipboardCopy.tsx rename to libs/react-components/src/ClipboardCopy.tsx diff --git a/libs/components/src/Code.tsx b/libs/react-components/src/Code.tsx similarity index 100% rename from libs/components/src/Code.tsx rename to libs/react-components/src/Code.tsx diff --git a/libs/components/src/Collapse.tsx b/libs/react-components/src/Collapse.tsx similarity index 100% rename from libs/components/src/Collapse.tsx rename to libs/react-components/src/Collapse.tsx diff --git a/libs/components/src/Dialog.tsx b/libs/react-components/src/Dialog.tsx similarity index 100% rename from libs/components/src/Dialog.tsx rename to libs/react-components/src/Dialog.tsx diff --git a/libs/components/src/ErrorBoundary.tsx b/libs/react-components/src/ErrorBoundary.tsx similarity index 100% rename from libs/components/src/ErrorBoundary.tsx rename to libs/react-components/src/ErrorBoundary.tsx diff --git a/libs/components/src/InlineCode.tsx b/libs/react-components/src/InlineCode.tsx similarity index 100% rename from libs/components/src/InlineCode.tsx rename to libs/react-components/src/InlineCode.tsx diff --git a/libs/components/src/Markdown.tsx b/libs/react-components/src/Markdown.tsx similarity index 98% rename from libs/components/src/Markdown.tsx rename to libs/react-components/src/Markdown.tsx index 946eaed69c..7bf34c94a2 100644 --- a/libs/components/src/Markdown.tsx +++ b/libs/react-components/src/Markdown.tsx @@ -14,10 +14,11 @@ import TableContainer from '@mui/material/TableContainer'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; +import { IMessageElement } from '@chainlit/react-client'; + import { ElementRef } from 'src/messages/components/ElementRef'; import { InlineCode } from './InlineCode'; -import { IMessageElement } from './types'; interface Props { refElements?: IMessageElement[]; diff --git a/libs/components/src/NotificationCount.tsx b/libs/react-components/src/NotificationCount.tsx similarity index 100% rename from libs/components/src/NotificationCount.tsx rename to libs/react-components/src/NotificationCount.tsx diff --git a/libs/components/src/auth/Auth0.tsx b/libs/react-components/src/auth/Auth0.tsx similarity index 100% rename from libs/components/src/auth/Auth0.tsx rename to libs/react-components/src/auth/Auth0.tsx diff --git a/libs/components/src/auth/AuthForgotPassword.tsx b/libs/react-components/src/auth/AuthForgotPassword.tsx similarity index 99% rename from libs/components/src/auth/AuthForgotPassword.tsx rename to libs/react-components/src/auth/AuthForgotPassword.tsx index cc6724b5ea..40e2374f99 100644 --- a/libs/components/src/auth/AuthForgotPassword.tsx +++ b/libs/react-components/src/auth/AuthForgotPassword.tsx @@ -113,7 +113,6 @@ const AuthForgotPassword = ({ )} - Go Back diff --git a/libs/components/src/auth/AuthLogin.tsx b/libs/react-components/src/auth/AuthLogin.tsx similarity index 100% rename from libs/components/src/auth/AuthLogin.tsx rename to libs/react-components/src/auth/AuthLogin.tsx diff --git a/libs/components/src/auth/AuthResetPassword.tsx b/libs/react-components/src/auth/AuthResetPassword.tsx similarity index 100% rename from libs/components/src/auth/AuthResetPassword.tsx rename to libs/react-components/src/auth/AuthResetPassword.tsx diff --git a/libs/components/src/auth/AuthTemplate.tsx b/libs/react-components/src/auth/AuthTemplate.tsx similarity index 100% rename from libs/components/src/auth/AuthTemplate.tsx rename to libs/react-components/src/auth/AuthTemplate.tsx diff --git a/libs/components/src/auth/AuthVerifyEmail.tsx b/libs/react-components/src/auth/AuthVerifyEmail.tsx similarity index 100% rename from libs/components/src/auth/AuthVerifyEmail.tsx rename to libs/react-components/src/auth/AuthVerifyEmail.tsx diff --git a/libs/components/src/auth/Descope.tsx b/libs/react-components/src/auth/Descope.tsx similarity index 100% rename from libs/components/src/auth/Descope.tsx rename to libs/react-components/src/auth/Descope.tsx diff --git a/libs/components/src/auth/Okta.tsx b/libs/react-components/src/auth/Okta.tsx similarity index 100% rename from libs/components/src/auth/Okta.tsx rename to libs/react-components/src/auth/Okta.tsx diff --git a/libs/components/src/auth/ProviderButton.tsx b/libs/react-components/src/auth/ProviderButton.tsx similarity index 100% rename from libs/components/src/auth/ProviderButton.tsx rename to libs/react-components/src/auth/ProviderButton.tsx index b8b7751a1a..a907048745 100644 --- a/libs/components/src/auth/ProviderButton.tsx +++ b/libs/react-components/src/auth/ProviderButton.tsx @@ -6,8 +6,8 @@ import Microsoft from '@mui/icons-material/Microsoft'; import Button from '@mui/material/Button'; import { Auth0 } from './Auth0'; -import { Okta } from './Okta'; import { Descope } from './Descope'; +import { Okta } from './Okta'; function capitalizeFirstLetter(string: string) { return string.charAt(0).toUpperCase() + string.slice(1); diff --git a/libs/components/src/auth/index.ts b/libs/react-components/src/auth/index.ts similarity index 100% rename from libs/components/src/auth/index.ts rename to libs/react-components/src/auth/index.ts diff --git a/libs/components/src/buttons/AccentButton.tsx b/libs/react-components/src/buttons/AccentButton.tsx similarity index 100% rename from libs/components/src/buttons/AccentButton.tsx rename to libs/react-components/src/buttons/AccentButton.tsx diff --git a/libs/components/src/buttons/GreyButton.tsx b/libs/react-components/src/buttons/GreyButton.tsx similarity index 100% rename from libs/components/src/buttons/GreyButton.tsx rename to libs/react-components/src/buttons/GreyButton.tsx diff --git a/libs/components/src/buttons/RegularButton.tsx b/libs/react-components/src/buttons/RegularButton.tsx similarity index 100% rename from libs/components/src/buttons/RegularButton.tsx rename to libs/react-components/src/buttons/RegularButton.tsx diff --git a/libs/components/src/buttons/Toggle.tsx b/libs/react-components/src/buttons/Toggle.tsx similarity index 100% rename from libs/components/src/buttons/Toggle.tsx rename to libs/react-components/src/buttons/Toggle.tsx diff --git a/libs/components/src/buttons/index.ts b/libs/react-components/src/buttons/index.ts similarity index 100% rename from libs/components/src/buttons/index.ts rename to libs/react-components/src/buttons/index.ts diff --git a/libs/components/src/elements/Audio.tsx b/libs/react-components/src/elements/Audio.tsx similarity index 93% rename from libs/components/src/elements/Audio.tsx rename to libs/react-components/src/elements/Audio.tsx index 795a22127c..a0f7f15840 100644 --- a/libs/components/src/elements/Audio.tsx +++ b/libs/react-components/src/elements/Audio.tsx @@ -3,7 +3,7 @@ import { grey } from 'theme/palette'; import Box from '@mui/material/Box'; import useTheme from '@mui/material/styles/useTheme'; -import { IAudioElement } from 'src/types/element'; +import { IAudioElement } from '@chainlit/react-client'; const AudioElement = ({ element }: { element: IAudioElement }) => { const theme = useTheme(); diff --git a/libs/components/src/elements/Avatar.tsx b/libs/react-components/src/elements/Avatar.tsx similarity index 89% rename from libs/components/src/elements/Avatar.tsx rename to libs/react-components/src/elements/Avatar.tsx index 752087e472..89181268b7 100644 --- a/libs/components/src/elements/Avatar.tsx +++ b/libs/react-components/src/elements/Avatar.tsx @@ -1,8 +1,8 @@ -import { IAvatarElement } from 'src/types'; - import Avatar from '@mui/material/Avatar'; import Tooltip from '@mui/material/Tooltip'; +import { IAvatarElement } from '@chainlit/react-client'; + interface Props { element: IAvatarElement; author: string; diff --git a/libs/components/src/elements/Element.tsx b/libs/react-components/src/elements/Element.tsx similarity index 94% rename from libs/components/src/elements/Element.tsx rename to libs/react-components/src/elements/Element.tsx index a97d35d8d1..ca6c8a5259 100644 --- a/libs/components/src/elements/Element.tsx +++ b/libs/react-components/src/elements/Element.tsx @@ -1,4 +1,4 @@ -import { IMessageElement } from 'src/types/element'; +import { IMessageElement } from '@chainlit/react-client'; import { AudioElement } from './Audio'; import { FileElement } from './File'; diff --git a/libs/components/src/elements/ElementSideView.tsx b/libs/react-components/src/elements/ElementSideView.tsx similarity index 98% rename from libs/components/src/elements/ElementSideView.tsx rename to libs/react-components/src/elements/ElementSideView.tsx index 9006000819..8d6a4ad2aa 100644 --- a/libs/components/src/elements/ElementSideView.tsx +++ b/libs/react-components/src/elements/ElementSideView.tsx @@ -12,7 +12,7 @@ import Typography from '@mui/material/Typography'; import styled from '@mui/material/styles/styled'; import useMediaQuery from '@mui/material/useMediaQuery'; -import { IMessageElement } from 'src/types/element'; +import { IMessageElement } from '@chainlit/react-client'; import 'react-resizable/css/styles.css'; diff --git a/libs/components/src/elements/ElementView.tsx b/libs/react-components/src/elements/ElementView.tsx similarity index 95% rename from libs/components/src/elements/ElementView.tsx rename to libs/react-components/src/elements/ElementView.tsx index 8fb78a7fdb..040c69b7dd 100644 --- a/libs/components/src/elements/ElementView.tsx +++ b/libs/react-components/src/elements/ElementView.tsx @@ -4,7 +4,7 @@ import IconButton from '@mui/material/IconButton'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { IMessageElement } from 'src/types/element'; +import { IMessageElement } from '@chainlit/react-client'; import { Element } from './Element'; diff --git a/libs/components/src/elements/File.tsx b/libs/react-components/src/elements/File.tsx similarity index 98% rename from libs/components/src/elements/File.tsx rename to libs/react-components/src/elements/File.tsx index 401e1dc895..ae3f3d544d 100644 --- a/libs/components/src/elements/File.tsx +++ b/libs/react-components/src/elements/File.tsx @@ -8,7 +8,7 @@ import Link from '@mui/material/Link'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { IFileElement } from 'src/types/element'; +import { IFileElement } from '@chainlit/react-client'; const FileElement = ({ element, diff --git a/libs/components/src/elements/Frame.tsx b/libs/react-components/src/elements/Frame.tsx similarity index 100% rename from libs/components/src/elements/Frame.tsx rename to libs/react-components/src/elements/Frame.tsx diff --git a/libs/components/src/elements/Image.tsx b/libs/react-components/src/elements/Image.tsx similarity index 95% rename from libs/components/src/elements/Image.tsx rename to libs/react-components/src/elements/Image.tsx index 9366bce034..d101bc62b8 100644 --- a/libs/components/src/elements/Image.tsx +++ b/libs/react-components/src/elements/Image.tsx @@ -1,4 +1,4 @@ -import { IImageElement } from 'src/types/element'; +import { IImageElement } from '@chainlit/react-client'; import { FrameElement } from './Frame'; diff --git a/libs/components/src/elements/InlinedAudioList.tsx b/libs/react-components/src/elements/InlinedAudioList.tsx similarity index 89% rename from libs/components/src/elements/InlinedAudioList.tsx rename to libs/react-components/src/elements/InlinedAudioList.tsx index 056660a1a6..f222498976 100644 --- a/libs/components/src/elements/InlinedAudioList.tsx +++ b/libs/react-components/src/elements/InlinedAudioList.tsx @@ -1,7 +1,7 @@ import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; -import { IAudioElement } from 'src/types/element'; +import { IAudioElement } from '@chainlit/react-client'; import { AudioElement } from './Audio'; diff --git a/libs/components/src/elements/InlinedElements.tsx b/libs/react-components/src/elements/InlinedElements.tsx similarity index 96% rename from libs/components/src/elements/InlinedElements.tsx rename to libs/react-components/src/elements/InlinedElements.tsx index 751444895a..89bc59daae 100644 --- a/libs/components/src/elements/InlinedElements.tsx +++ b/libs/react-components/src/elements/InlinedElements.tsx @@ -1,6 +1,6 @@ import Stack from '@mui/material/Stack'; -import { ElementType, IMessageElement } from '../types/element'; +import { ElementType, IMessageElement } from '@chainlit/react-client'; import { InlinedAudioList } from './InlinedAudioList'; import { InlinedFileList } from './InlinedFileList'; diff --git a/libs/components/src/elements/InlinedFileList.tsx b/libs/react-components/src/elements/InlinedFileList.tsx similarity index 88% rename from libs/components/src/elements/InlinedFileList.tsx rename to libs/react-components/src/elements/InlinedFileList.tsx index bfc02d3983..38003aad3d 100644 --- a/libs/components/src/elements/InlinedFileList.tsx +++ b/libs/react-components/src/elements/InlinedFileList.tsx @@ -1,6 +1,6 @@ import Stack from '@mui/material/Stack'; -import { IFileElement } from 'src/types/element'; +import { IFileElement } from '@chainlit/react-client'; import { FileElement } from './File'; diff --git a/libs/components/src/elements/InlinedImageList.tsx b/libs/react-components/src/elements/InlinedImageList.tsx similarity index 84% rename from libs/components/src/elements/InlinedImageList.tsx rename to libs/react-components/src/elements/InlinedImageList.tsx index aa08dbb95a..b8b1346c55 100644 --- a/libs/components/src/elements/InlinedImageList.tsx +++ b/libs/react-components/src/elements/InlinedImageList.tsx @@ -1,4 +1,4 @@ -import { IImageElement } from 'src/types/element'; +import { IImageElement } from '@chainlit/react-client'; import { ImageElement } from './Image'; import { ListWithSize } from './ListWithSize'; diff --git a/libs/components/src/elements/InlinedPDFList.tsx b/libs/react-components/src/elements/InlinedPDFList.tsx similarity index 89% rename from libs/components/src/elements/InlinedPDFList.tsx rename to libs/react-components/src/elements/InlinedPDFList.tsx index 9b8442d9e4..c0927a0418 100644 --- a/libs/components/src/elements/InlinedPDFList.tsx +++ b/libs/react-components/src/elements/InlinedPDFList.tsx @@ -1,6 +1,6 @@ import Stack from '@mui/material/Stack'; -import { IPdfElement } from 'src/types/element'; +import { IPdfElement } from '@chainlit/react-client'; import { PDFElement } from './PDF'; diff --git a/libs/components/src/elements/InlinedPlotlyList.tsx b/libs/react-components/src/elements/InlinedPlotlyList.tsx similarity index 89% rename from libs/components/src/elements/InlinedPlotlyList.tsx rename to libs/react-components/src/elements/InlinedPlotlyList.tsx index c31207e8a6..51e85550ec 100644 --- a/libs/components/src/elements/InlinedPlotlyList.tsx +++ b/libs/react-components/src/elements/InlinedPlotlyList.tsx @@ -1,6 +1,6 @@ import Stack from '@mui/material/Stack'; -import { IPlotlyElement } from 'src/types/element'; +import { IPlotlyElement } from '@chainlit/react-client'; import { PlotlyElement } from './Plotly'; diff --git a/libs/components/src/elements/InlinedTextList.tsx b/libs/react-components/src/elements/InlinedTextList.tsx similarity index 90% rename from libs/components/src/elements/InlinedTextList.tsx rename to libs/react-components/src/elements/InlinedTextList.tsx index d046f1f8fd..86134cea00 100644 --- a/libs/components/src/elements/InlinedTextList.tsx +++ b/libs/react-components/src/elements/InlinedTextList.tsx @@ -2,7 +2,7 @@ import Alert from '@mui/material/Alert'; import AlertTitle from '@mui/material/AlertTitle'; import Stack from '@mui/material/Stack'; -import { ITextElement } from 'src/types/element'; +import { ITextElement } from '@chainlit/react-client'; import { TextElement } from './Text'; diff --git a/libs/components/src/elements/InlinedVideoList.tsx b/libs/react-components/src/elements/InlinedVideoList.tsx similarity index 84% rename from libs/components/src/elements/InlinedVideoList.tsx rename to libs/react-components/src/elements/InlinedVideoList.tsx index 842db63763..3fec6f0c0a 100644 --- a/libs/components/src/elements/InlinedVideoList.tsx +++ b/libs/react-components/src/elements/InlinedVideoList.tsx @@ -1,4 +1,4 @@ -import { IVideoElement } from 'src/types/element'; +import { IVideoElement } from '@chainlit/react-client'; import { ListWithSize } from './ListWithSize'; import { VideoElement } from './Video'; diff --git a/libs/components/src/elements/ListWithSize.tsx b/libs/react-components/src/elements/ListWithSize.tsx similarity index 94% rename from libs/components/src/elements/ListWithSize.tsx rename to libs/react-components/src/elements/ListWithSize.tsx index ab0e1f1c93..794b20567b 100644 --- a/libs/components/src/elements/ListWithSize.tsx +++ b/libs/react-components/src/elements/ListWithSize.tsx @@ -1,7 +1,7 @@ import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; -import { IImageElement, IVideoElement } from 'src/types/element'; +import { IImageElement, IVideoElement } from '@chainlit/react-client'; const sizeToUnit = (element: IImageElement | IVideoElement) => { switch (element.size) { diff --git a/libs/components/src/elements/PDF.tsx b/libs/react-components/src/elements/PDF.tsx similarity index 90% rename from libs/components/src/elements/PDF.tsx rename to libs/react-components/src/elements/PDF.tsx index e0e63f75bd..40c16a05bb 100644 --- a/libs/components/src/elements/PDF.tsx +++ b/libs/react-components/src/elements/PDF.tsx @@ -1,4 +1,4 @@ -import { IPdfElement } from 'src/types/element'; +import { IPdfElement } from '@chainlit/react-client'; interface Props { element: IPdfElement; diff --git a/libs/components/src/elements/Plotly.tsx b/libs/react-components/src/elements/Plotly.tsx similarity index 95% rename from libs/components/src/elements/Plotly.tsx rename to libs/react-components/src/elements/Plotly.tsx index bf8b07b6d5..f648a091f1 100644 --- a/libs/components/src/elements/Plotly.tsx +++ b/libs/react-components/src/elements/Plotly.tsx @@ -1,9 +1,9 @@ import { Suspense, lazy } from 'react'; import { ErrorBoundary } from 'src/ErrorBoundary'; -import { useApi } from 'hooks/index'; +import { IPlotlyElement } from '@chainlit/react-client'; -import { IPlotlyElement } from 'src/types/element'; +import { useApi } from 'hooks/index'; const Plot = lazy(() => import('react-plotly.js')); diff --git a/libs/components/src/elements/Text.tsx b/libs/react-components/src/elements/Text.tsx similarity index 92% rename from libs/components/src/elements/Text.tsx rename to libs/react-components/src/elements/Text.tsx index 21b7260e31..bcef2d96f9 100644 --- a/libs/components/src/elements/Text.tsx +++ b/libs/react-components/src/elements/Text.tsx @@ -1,8 +1,8 @@ import { Markdown } from 'src/Markdown'; -import { useApi } from 'hooks/index'; +import { ITextElement } from '@chainlit/react-client'; -import { ITextElement } from 'src/types/element'; +import { useApi } from 'hooks/index'; interface Props { element: ITextElement; diff --git a/libs/components/src/elements/Video.tsx b/libs/react-components/src/elements/Video.tsx similarity index 87% rename from libs/components/src/elements/Video.tsx rename to libs/react-components/src/elements/Video.tsx index fa1d146d09..38558e8698 100644 --- a/libs/components/src/elements/Video.tsx +++ b/libs/react-components/src/elements/Video.tsx @@ -1,4 +1,4 @@ -import { IVideoElement } from 'src/types/element'; +import { IVideoElement } from '@chainlit/react-client'; const VideoElement = ({ element }: { element: IVideoElement }) => { if (!element.url && !element.content) { diff --git a/libs/components/src/elements/index.ts b/libs/react-components/src/elements/index.ts similarity index 100% rename from libs/components/src/elements/index.ts rename to libs/react-components/src/elements/index.ts diff --git a/libs/components/src/index.ts b/libs/react-components/src/index.ts similarity index 92% rename from libs/components/src/index.ts rename to libs/react-components/src/index.ts index 98838e1b98..b63363e5ed 100644 --- a/libs/components/src/index.ts +++ b/libs/react-components/src/index.ts @@ -14,5 +14,4 @@ export { Code } from './Code'; export { Markdown } from './Markdown'; export { Collapse } from './Collapse'; export { ErrorBoundary } from './ErrorBoundary'; -export { nestMessages } from 'utils/message'; export { NotificationCount } from './NotificationCount'; diff --git a/libs/components/src/inputs/FormInput.tsx b/libs/react-components/src/inputs/FormInput.tsx similarity index 100% rename from libs/components/src/inputs/FormInput.tsx rename to libs/react-components/src/inputs/FormInput.tsx diff --git a/libs/components/src/inputs/InputLabel.tsx b/libs/react-components/src/inputs/InputLabel.tsx similarity index 100% rename from libs/components/src/inputs/InputLabel.tsx rename to libs/react-components/src/inputs/InputLabel.tsx diff --git a/libs/components/src/inputs/InputStateHandler.tsx b/libs/react-components/src/inputs/InputStateHandler.tsx similarity index 100% rename from libs/components/src/inputs/InputStateHandler.tsx rename to libs/react-components/src/inputs/InputStateHandler.tsx diff --git a/libs/components/src/inputs/SliderInput.tsx b/libs/react-components/src/inputs/SliderInput.tsx similarity index 100% rename from libs/components/src/inputs/SliderInput.tsx rename to libs/react-components/src/inputs/SliderInput.tsx diff --git a/libs/components/src/inputs/SwitchInput.tsx b/libs/react-components/src/inputs/SwitchInput.tsx similarity index 100% rename from libs/components/src/inputs/SwitchInput.tsx rename to libs/react-components/src/inputs/SwitchInput.tsx diff --git a/libs/components/src/inputs/TagsInput.tsx b/libs/react-components/src/inputs/TagsInput.tsx similarity index 100% rename from libs/components/src/inputs/TagsInput.tsx rename to libs/react-components/src/inputs/TagsInput.tsx diff --git a/libs/components/src/inputs/TextInput.tsx b/libs/react-components/src/inputs/TextInput.tsx similarity index 100% rename from libs/components/src/inputs/TextInput.tsx rename to libs/react-components/src/inputs/TextInput.tsx diff --git a/libs/components/src/inputs/index.ts b/libs/react-components/src/inputs/index.ts similarity index 100% rename from libs/components/src/inputs/index.ts rename to libs/react-components/src/inputs/index.ts diff --git a/libs/components/src/inputs/selects/MenuItem.tsx b/libs/react-components/src/inputs/selects/MenuItem.tsx similarity index 100% rename from libs/components/src/inputs/selects/MenuItem.tsx rename to libs/react-components/src/inputs/selects/MenuItem.tsx diff --git a/libs/components/src/inputs/selects/SelectCategoryInput.tsx b/libs/react-components/src/inputs/selects/SelectCategoryInput.tsx similarity index 100% rename from libs/components/src/inputs/selects/SelectCategoryInput.tsx rename to libs/react-components/src/inputs/selects/SelectCategoryInput.tsx diff --git a/libs/components/src/inputs/selects/SelectInput.tsx b/libs/react-components/src/inputs/selects/SelectInput.tsx similarity index 100% rename from libs/components/src/inputs/selects/SelectInput.tsx rename to libs/react-components/src/inputs/selects/SelectInput.tsx diff --git a/libs/components/src/messages/Message.tsx b/libs/react-components/src/messages/Message.tsx similarity index 96% rename from libs/components/src/messages/Message.tsx rename to libs/react-components/src/messages/Message.tsx index 2f9ae709bb..58d797f8c2 100644 --- a/libs/components/src/messages/Message.tsx +++ b/libs/react-components/src/messages/Message.tsx @@ -5,16 +5,14 @@ import { memo, useContext, useEffect, useState } from 'react'; import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; +import { IAction, IMessage, IMessageElement } from '@chainlit/react-client'; + import { AskUploadButton } from './components/AskUploadButton'; import { AUTHOR_BOX_WIDTH, Author } from './components/Author'; import { DetailsButton } from './components/DetailsButton'; import { MessageActions } from './components/MessageActions'; import { MessageContent } from './components/MessageContent'; -import { IAction } from 'src/types/action'; -import { IMessageElement } from 'src/types/element'; -import { IMessage } from 'src/types/message'; - import { Messages } from './Messages'; interface Props { diff --git a/libs/components/src/messages/MessageContainer.tsx b/libs/react-components/src/messages/MessageContainer.tsx similarity index 92% rename from libs/components/src/messages/MessageContainer.tsx rename to libs/react-components/src/messages/MessageContainer.tsx index 536f851b58..2efa39a9be 100644 --- a/libs/components/src/messages/MessageContainer.tsx +++ b/libs/react-components/src/messages/MessageContainer.tsx @@ -3,9 +3,8 @@ import { memo, useEffect, useRef } from 'react'; import Box from '@mui/material/Box'; -import { IAction } from 'src/types/action'; -import { IMessageElement } from 'src/types/element'; -import { IMessage } from 'src/types/message'; +import { IAction, IMessage, IMessageElement } from '@chainlit/react-client'; + import { IMessageContext } from 'src/types/messageContext'; import { Messages } from './Messages'; diff --git a/libs/components/src/messages/Messages.tsx b/libs/react-components/src/messages/Messages.tsx similarity index 91% rename from libs/components/src/messages/Messages.tsx rename to libs/react-components/src/messages/Messages.tsx index 39b90b2a8a..4d58bb5dfa 100644 --- a/libs/components/src/messages/Messages.tsx +++ b/libs/react-components/src/messages/Messages.tsx @@ -1,10 +1,12 @@ import { MessageContext } from 'contexts/MessageContext'; import { memo, useContext } from 'react'; -import { isLastMessage } from 'utils/message'; -import { IAction } from 'src/types/action'; -import { IMessageElement } from 'src/types/element'; -import { IMessage } from 'src/types/message'; +import { + IAction, + IMessage, + IMessageElement, + isLastMessage +} from '@chainlit/react-client'; import { Message } from './Message'; diff --git a/libs/components/src/messages/components/ActionButton.tsx b/libs/react-components/src/messages/components/ActionButton.tsx similarity index 95% rename from libs/components/src/messages/components/ActionButton.tsx rename to libs/react-components/src/messages/components/ActionButton.tsx index 77a550da40..0a347693cc 100644 --- a/libs/components/src/messages/components/ActionButton.tsx +++ b/libs/react-components/src/messages/components/ActionButton.tsx @@ -4,7 +4,7 @@ import { useContext } from 'react'; import Button from '@mui/material/Button'; import Tooltip from '@mui/material/Tooltip'; -import { IAction } from 'src/types/action'; +import { IAction } from '@chainlit/react-client'; interface ActionProps { action: IAction; diff --git a/libs/components/src/messages/components/ActionDrawerButton.tsx b/libs/react-components/src/messages/components/ActionDrawerButton.tsx similarity index 97% rename from libs/components/src/messages/components/ActionDrawerButton.tsx rename to libs/react-components/src/messages/components/ActionDrawerButton.tsx index 2c557eaa67..92cfb32416 100644 --- a/libs/components/src/messages/components/ActionDrawerButton.tsx +++ b/libs/react-components/src/messages/components/ActionDrawerButton.tsx @@ -6,7 +6,7 @@ import Menu from '@mui/material/Menu'; import Stack from '@mui/material/Stack'; import Tooltip from '@mui/material/Tooltip'; -import { IAction } from 'src/types/action'; +import { IAction } from '@chainlit/react-client'; import { ActionButton } from './ActionButton'; diff --git a/libs/components/src/messages/components/AskUploadButton.tsx b/libs/react-components/src/messages/components/AskUploadButton.tsx similarity index 97% rename from libs/components/src/messages/components/AskUploadButton.tsx rename to libs/react-components/src/messages/components/AskUploadButton.tsx index 4cc411ed35..70e699b827 100644 --- a/libs/components/src/messages/components/AskUploadButton.tsx +++ b/libs/react-components/src/messages/components/AskUploadButton.tsx @@ -6,9 +6,9 @@ import LoadingButton from '@mui/lab/LoadingButton'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { useUpload } from 'hooks/useUpload'; +import { IAsk, IFileResponse } from '@chainlit/react-client'; -import { IAsk, IFileResponse } from 'src/types/file'; +import { useUpload } from 'hooks/useUpload'; const AskUploadChildButton = ({ askUser, diff --git a/libs/components/src/messages/components/Author.tsx b/libs/react-components/src/messages/components/Author.tsx similarity index 97% rename from libs/components/src/messages/components/Author.tsx rename to libs/react-components/src/messages/components/Author.tsx index 22aa0786e1..38b44da6a7 100644 --- a/libs/components/src/messages/components/Author.tsx +++ b/libs/react-components/src/messages/components/Author.tsx @@ -6,9 +6,9 @@ import Box from '@mui/material/Box'; import Tooltip from '@mui/material/Tooltip'; import Typography from '@mui/material/Typography'; -import { useColorForName } from 'hooks/useColors'; +import { IMessage } from '@chainlit/react-client'; -import { IMessage } from 'src/types/message'; +import { useColorForName } from 'hooks/useColors'; import { MessageTime } from './MessageTime'; diff --git a/libs/components/src/messages/components/DetailsButton.tsx b/libs/react-components/src/messages/components/DetailsButton.tsx similarity index 97% rename from libs/components/src/messages/components/DetailsButton.tsx rename to libs/react-components/src/messages/components/DetailsButton.tsx index 7faa3e7651..01fc99ba46 100644 --- a/libs/components/src/messages/components/DetailsButton.tsx +++ b/libs/react-components/src/messages/components/DetailsButton.tsx @@ -6,7 +6,7 @@ import ExpandLess from '@mui/icons-material/ExpandLess'; import ExpandMore from '@mui/icons-material/ExpandMore'; import CircularProgress from '@mui/material/CircularProgress'; -import { IMessage } from 'src/types/message'; +import { IMessage } from '@chainlit/react-client'; interface Props { message: IMessage; diff --git a/libs/components/src/messages/components/ElementRef.tsx b/libs/react-components/src/messages/components/ElementRef.tsx similarity index 91% rename from libs/components/src/messages/components/ElementRef.tsx rename to libs/react-components/src/messages/components/ElementRef.tsx index 78f0252096..a0322025ad 100644 --- a/libs/components/src/messages/components/ElementRef.tsx +++ b/libs/react-components/src/messages/components/ElementRef.tsx @@ -3,7 +3,7 @@ import { useContext } from 'react'; import Link from '@mui/material/Link'; -import { IMessageElement } from 'src/types/element'; +import { IMessageElement } from '@chainlit/react-client'; interface Props { element: IMessageElement; diff --git a/libs/components/src/messages/components/FeedbackButtons.tsx b/libs/react-components/src/messages/components/FeedbackButtons.tsx similarity index 91% rename from libs/components/src/messages/components/FeedbackButtons.tsx rename to libs/react-components/src/messages/components/FeedbackButtons.tsx index 4aa5e59e7e..cae6257533 100644 --- a/libs/components/src/messages/components/FeedbackButtons.tsx +++ b/libs/react-components/src/messages/components/FeedbackButtons.tsx @@ -1,11 +1,9 @@ import { MessageContext } from 'contexts/MessageContext'; import { useContext, useState } from 'react'; import { useMemo } from 'react'; -import { useSetRecoilState } from 'recoil'; import Dialog from 'src/Dialog'; import { AccentButton } from 'src/buttons/AccentButton'; import { TextInput } from 'src/inputs'; -import { updateMessageById } from 'utils/message'; import StickyNote2Outlined from '@mui/icons-material/StickyNote2Outlined'; import ThumbDownAlt from '@mui/icons-material/ThumbDownAlt'; @@ -17,9 +15,7 @@ import ButtonGroup from '@mui/material/ButtonGroup'; import Stack from '@mui/material/Stack'; import Tooltip from '@mui/material/Tooltip'; -import { messagesState } from 'hooks/useChat/state'; - -import { IMessage } from 'src/types/message'; +import { IMessage } from '@chainlit/react-client'; const ICON_SIZE = '16px'; @@ -38,23 +34,14 @@ const FeedbackButtons = ({ message }: Props) => { const DownIcon = feedback === -1 ? ThumbDownAlt : ThumbDownAltOutlined; const UpIcon = feedback === 1 ? ThumbUpAlt : ThumbUpAltOutlined; - const setMessages = useSetRecoilState(messagesState); - const handleFeedbackChanged = (feedback: number, comment?: string) => { onFeedbackUpdated && onFeedbackUpdated( - message.id, + message, feedback, () => { setFeedback(feedback); setComment(comment); - setMessages((prev) => - updateMessageById(prev, message.id, { - ...message, - humanFeedback: feedback, - humanFeedbackComment: comment - }) - ); }, comment ); diff --git a/libs/components/src/messages/components/MessageActions.tsx b/libs/react-components/src/messages/components/MessageActions.tsx similarity index 93% rename from libs/components/src/messages/components/MessageActions.tsx rename to libs/react-components/src/messages/components/MessageActions.tsx index 23432dc724..b0634e99de 100644 --- a/libs/components/src/messages/components/MessageActions.tsx +++ b/libs/react-components/src/messages/components/MessageActions.tsx @@ -1,8 +1,7 @@ import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; -import { IAction } from 'src/types/action'; -import { IMessage } from 'src/types/message'; +import { IAction, IMessage } from '@chainlit/react-client'; import { ActionButton } from './ActionButton'; import { ActionDrawerButton } from './ActionDrawerButton'; diff --git a/libs/components/src/messages/components/MessageButtons.tsx b/libs/react-components/src/messages/components/MessageButtons.tsx similarity index 95% rename from libs/components/src/messages/components/MessageButtons.tsx rename to libs/react-components/src/messages/components/MessageButtons.tsx index f7c3d47c93..f4bb70598a 100644 --- a/libs/components/src/messages/components/MessageButtons.tsx +++ b/libs/react-components/src/messages/components/MessageButtons.tsx @@ -3,7 +3,7 @@ import { useContext } from 'react'; import Stack from '@mui/material/Stack'; -import { IMessage } from 'src/types/message'; +import { IMessage } from '@chainlit/react-client'; import { FeedbackButtons } from './FeedbackButtons'; import { PlaygroundButton } from './PlaygroundButton'; diff --git a/libs/components/src/messages/components/MessageContent.tsx b/libs/react-components/src/messages/components/MessageContent.tsx similarity index 95% rename from libs/components/src/messages/components/MessageContent.tsx rename to libs/react-components/src/messages/components/MessageContent.tsx index 422a8a3cc2..e9840f411d 100644 --- a/libs/components/src/messages/components/MessageContent.tsx +++ b/libs/react-components/src/messages/components/MessageContent.tsx @@ -3,13 +3,12 @@ import { Collapse } from 'src/Collapse'; import { Markdown } from 'src/Markdown'; import { InlinedElements } from 'src/elements/InlinedElements'; import { exportToFile } from 'utils/exportToFile'; -import { prepareContent } from 'utils/message'; import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { IMessageContent } from 'src/types/message'; +import { IMessageContent, prepareContent } from '@chainlit/react-client'; import { MessageButtons } from './MessageButtons'; diff --git a/libs/components/src/messages/components/MessageTime.tsx b/libs/react-components/src/messages/components/MessageTime.tsx similarity index 100% rename from libs/components/src/messages/components/MessageTime.tsx rename to libs/react-components/src/messages/components/MessageTime.tsx diff --git a/libs/components/src/messages/components/PlaygroundButton.tsx b/libs/react-components/src/messages/components/PlaygroundButton.tsx similarity index 93% rename from libs/components/src/messages/components/PlaygroundButton.tsx rename to libs/react-components/src/messages/components/PlaygroundButton.tsx index c392744731..0cca176502 100644 --- a/libs/components/src/messages/components/PlaygroundButton.tsx +++ b/libs/react-components/src/messages/components/PlaygroundButton.tsx @@ -5,7 +5,7 @@ import BugReport from '@mui/icons-material/BugReport'; import IconButton from '@mui/material/IconButton'; import Tooltip from '@mui/material/Tooltip'; -import { IMessage } from 'src/types/message'; +import { IMessage } from '@chainlit/react-client'; interface Props { message: IMessage; diff --git a/libs/components/src/messages/index.ts b/libs/react-components/src/messages/index.ts similarity index 100% rename from libs/components/src/messages/index.ts rename to libs/react-components/src/messages/index.ts diff --git a/libs/components/src/playground/actionBar.tsx b/libs/react-components/src/playground/actionBar.tsx similarity index 100% rename from libs/components/src/playground/actionBar.tsx rename to libs/react-components/src/playground/actionBar.tsx diff --git a/libs/components/src/playground/basic.tsx b/libs/react-components/src/playground/basic.tsx similarity index 97% rename from libs/components/src/playground/basic.tsx rename to libs/react-components/src/playground/basic.tsx index 316770afa2..ab55e4b382 100644 --- a/libs/components/src/playground/basic.tsx +++ b/libs/react-components/src/playground/basic.tsx @@ -5,7 +5,7 @@ import { useContext } from 'react'; import Alert from '@mui/material/Alert'; import Stack from '@mui/material/Stack'; -import { IPrompt } from 'src/types/message'; +import { IPrompt } from '@chainlit/react-client'; import Completion from './editor/completion'; import FormattedEditor from './editor/formatted'; diff --git a/libs/components/src/playground/chat.tsx b/libs/react-components/src/playground/chat.tsx similarity index 98% rename from libs/components/src/playground/chat.tsx rename to libs/react-components/src/playground/chat.tsx index ca42783488..eee7d6c100 100644 --- a/libs/components/src/playground/chat.tsx +++ b/libs/react-components/src/playground/chat.tsx @@ -9,7 +9,7 @@ import Button from '@mui/material/Button'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { IPrompt } from 'src/types/message'; +import { IPrompt } from '@chainlit/react-client'; import Completion from './editor/completion'; import PromptMessage from './editor/promptMessage'; diff --git a/libs/components/src/playground/editor/EditorWrapper.tsx b/libs/react-components/src/playground/editor/EditorWrapper.tsx similarity index 87% rename from libs/components/src/playground/editor/EditorWrapper.tsx rename to libs/react-components/src/playground/editor/EditorWrapper.tsx index 2431f6f1f6..c4232aaae2 100644 --- a/libs/components/src/playground/editor/EditorWrapper.tsx +++ b/libs/react-components/src/playground/editor/EditorWrapper.tsx @@ -2,16 +2,16 @@ import merge from 'lodash/merge'; import { ClipboardCopy } from 'src/ClipboardCopy'; import { grey } from 'theme'; -import Box from '@mui/material/Box'; -import Stack from '@mui/material/Stack'; +import Box, { BoxProps } from '@mui/material/Box'; +import Stack, { StackProps } from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { SxProps, Theme, useTheme } from '@mui/material/styles'; +import { useTheme } from '@mui/material/styles'; interface Props { className?: string; clipboardValue?: string; - sx?: SxProps; - sxChildren?: SxProps; + sx?: StackProps['sx']; + sxChildren?: BoxProps['sx']; title?: string; } diff --git a/libs/components/src/playground/editor/MessageWrapper.tsx b/libs/react-components/src/playground/editor/MessageWrapper.tsx similarity index 98% rename from libs/components/src/playground/editor/MessageWrapper.tsx rename to libs/react-components/src/playground/editor/MessageWrapper.tsx index 516c496c30..95b89f6c6a 100644 --- a/libs/components/src/playground/editor/MessageWrapper.tsx +++ b/libs/react-components/src/playground/editor/MessageWrapper.tsx @@ -1,7 +1,6 @@ import { PlaygroundContext } from 'contexts/PlaygroundContext'; import React, { useContext, useState } from 'react'; import { SelectInput } from 'src/inputs'; -import { IPromptMessage, PromptMessageRole } from 'src/types'; import RemoveCircleOutlineOutlined from '@mui/icons-material/RemoveCircleOutlineOutlined'; import Box from '@mui/material/Box'; @@ -10,6 +9,8 @@ import { SelectChangeEvent } from '@mui/material/Select'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; +import { IPromptMessage, PromptMessageRole } from '@chainlit/react-client'; + const roles = ['Assistant', 'System', 'User']; interface MessageWrapperProps { diff --git a/libs/components/src/playground/editor/completion.tsx b/libs/react-components/src/playground/editor/completion.tsx similarity index 100% rename from libs/components/src/playground/editor/completion.tsx rename to libs/react-components/src/playground/editor/completion.tsx diff --git a/libs/components/src/playground/editor/formatted.tsx b/libs/react-components/src/playground/editor/formatted.tsx similarity index 99% rename from libs/components/src/playground/editor/formatted.tsx rename to libs/react-components/src/playground/editor/formatted.tsx index 3a6b48193c..8646c00a67 100644 --- a/libs/components/src/playground/editor/formatted.tsx +++ b/libs/react-components/src/playground/editor/formatted.tsx @@ -17,9 +17,10 @@ import { escape, validateVariablePlaceholder } from 'src/playground/helpers/format'; -import { IPrompt } from 'src/types'; import { useIsFirstRender } from 'usehooks-ts'; +import { IPrompt } from '@chainlit/react-client'; + import { useColors } from 'hooks/useColors'; import 'draft-js/dist/Draft.css'; diff --git a/libs/components/src/playground/editor/functionModal.tsx b/libs/react-components/src/playground/editor/functionModal.tsx similarity index 100% rename from libs/components/src/playground/editor/functionModal.tsx rename to libs/react-components/src/playground/editor/functionModal.tsx diff --git a/libs/components/src/playground/editor/promptMessage.tsx b/libs/react-components/src/playground/editor/promptMessage.tsx similarity index 96% rename from libs/components/src/playground/editor/promptMessage.tsx rename to libs/react-components/src/playground/editor/promptMessage.tsx index e6e1b10938..eb510d8b60 100644 --- a/libs/components/src/playground/editor/promptMessage.tsx +++ b/libs/react-components/src/playground/editor/promptMessage.tsx @@ -3,7 +3,8 @@ import { EditorState } from 'draft-js'; import Alert from '@mui/material/Alert'; import { useTheme } from '@mui/material/styles'; -import { IPrompt, IPromptMessage } from 'src/types/message'; +import { IPrompt, IPromptMessage } from '@chainlit/react-client'; + import { PromptMode } from 'src/types/playground'; import MessageWrapper from './MessageWrapper'; diff --git a/libs/components/src/playground/editor/template/index.tsx b/libs/react-components/src/playground/editor/template/index.tsx similarity index 98% rename from libs/components/src/playground/editor/template/index.tsx rename to libs/react-components/src/playground/editor/template/index.tsx index c0779e5822..4d028fcd28 100644 --- a/libs/components/src/playground/editor/template/index.tsx +++ b/libs/react-components/src/playground/editor/template/index.tsx @@ -12,9 +12,10 @@ import { buildTemplatePlaceholdersRegexp, validateVariablePlaceholder } from 'src/playground/helpers/format'; -import { IPrompt } from 'src/types'; import { useIsFirstRender } from 'usehooks-ts'; +import { IPrompt } from '@chainlit/react-client'; + import Variable from './variable'; const findVariable = ( diff --git a/libs/components/src/playground/editor/template/variable.tsx b/libs/react-components/src/playground/editor/template/variable.tsx similarity index 100% rename from libs/components/src/playground/editor/template/variable.tsx rename to libs/react-components/src/playground/editor/template/variable.tsx diff --git a/libs/components/src/playground/editor/variableModal.tsx b/libs/react-components/src/playground/editor/variableModal.tsx similarity index 100% rename from libs/components/src/playground/editor/variableModal.tsx rename to libs/react-components/src/playground/editor/variableModal.tsx diff --git a/libs/components/src/playground/functionInput.tsx b/libs/react-components/src/playground/functionInput.tsx similarity index 100% rename from libs/components/src/playground/functionInput.tsx rename to libs/react-components/src/playground/functionInput.tsx diff --git a/libs/components/src/playground/header.tsx b/libs/react-components/src/playground/header.tsx similarity index 100% rename from libs/components/src/playground/header.tsx rename to libs/react-components/src/playground/header.tsx diff --git a/libs/components/src/playground/helpers/format.ts b/libs/react-components/src/playground/helpers/format.ts similarity index 100% rename from libs/components/src/playground/helpers/format.ts rename to libs/react-components/src/playground/helpers/format.ts diff --git a/libs/components/src/playground/helpers/provider.ts b/libs/react-components/src/playground/helpers/provider.ts similarity index 100% rename from libs/components/src/playground/helpers/provider.ts rename to libs/react-components/src/playground/helpers/provider.ts diff --git a/libs/components/src/playground/index.tsx b/libs/react-components/src/playground/index.tsx similarity index 100% rename from libs/components/src/playground/index.tsx rename to libs/react-components/src/playground/index.tsx diff --git a/libs/components/src/playground/modeToggle.tsx b/libs/react-components/src/playground/modeToggle.tsx similarity index 100% rename from libs/components/src/playground/modeToggle.tsx rename to libs/react-components/src/playground/modeToggle.tsx diff --git a/libs/components/src/playground/modelSettings.tsx b/libs/react-components/src/playground/modelSettings.tsx similarity index 99% rename from libs/components/src/playground/modelSettings.tsx rename to libs/react-components/src/playground/modelSettings.tsx index a52c1908f3..6d1e434006 100644 --- a/libs/components/src/playground/modelSettings.tsx +++ b/libs/react-components/src/playground/modelSettings.tsx @@ -16,7 +16,8 @@ import { SelectChangeEvent } from '@mui/material/Select'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { ILLMSettings } from 'src/types/message'; +import { ILLMSettings } from '@chainlit/react-client'; + import { ILLMProvider } from 'src/types/playground'; type Schema = { diff --git a/libs/components/src/playground/submitButton.tsx b/libs/react-components/src/playground/submitButton.tsx similarity index 100% rename from libs/components/src/playground/submitButton.tsx rename to libs/react-components/src/playground/submitButton.tsx diff --git a/libs/components/src/playground/variableInput.tsx b/libs/react-components/src/playground/variableInput.tsx similarity index 100% rename from libs/components/src/playground/variableInput.tsx rename to libs/react-components/src/playground/variableInput.tsx diff --git a/libs/components/src/types/Input.ts b/libs/react-components/src/types/Input.ts similarity index 100% rename from libs/components/src/types/Input.ts rename to libs/react-components/src/types/Input.ts diff --git a/libs/components/src/types/NotificationCount.tsx b/libs/react-components/src/types/NotificationCount.tsx similarity index 100% rename from libs/components/src/types/NotificationCount.tsx rename to libs/react-components/src/types/NotificationCount.tsx diff --git a/libs/components/src/types/index.ts b/libs/react-components/src/types/index.ts similarity index 50% rename from libs/components/src/types/index.ts rename to libs/react-components/src/types/index.ts index 052cdfb705..0508b0e87c 100644 --- a/libs/components/src/types/index.ts +++ b/libs/react-components/src/types/index.ts @@ -1,10 +1,4 @@ -export * from './action'; -export * from './element'; -export * from './file'; export * from './Input'; -export * from './message'; -export * from './user'; -export * from './conversation'; export * from './messageContext'; export * from './NotificationCount'; export * from './playground'; diff --git a/libs/components/src/types/messageContext.ts b/libs/react-components/src/types/messageContext.ts similarity index 78% rename from libs/components/src/types/messageContext.ts rename to libs/react-components/src/types/messageContext.ts index f0bbb3318a..5bdeb26663 100644 --- a/libs/components/src/types/messageContext.ts +++ b/libs/react-components/src/types/messageContext.ts @@ -1,6 +1,9 @@ -import { IAvatarElement, IMessageElement } from './element'; -import { IAsk } from './file'; -import { IMessage } from './message'; +import { + IAsk, + IAvatarElement, + IMessage, + IMessageElement +} from '@chainlit/react-client'; interface IMessageContext { askUser?: IAsk; @@ -15,7 +18,7 @@ interface IMessageContext { onPlaygroundButtonClick?: (message: IMessage) => void; onElementRefClick?: (element: IMessageElement) => void; onFeedbackUpdated?: ( - messageId: string, + message: IMessage, feedback: number, onSuccess: () => void, feedbackComment?: string diff --git a/libs/components/src/types/playground.ts b/libs/react-components/src/types/playground.ts similarity index 66% rename from libs/components/src/types/playground.ts rename to libs/react-components/src/types/playground.ts index 68cc04f496..903c71af30 100644 --- a/libs/components/src/types/playground.ts +++ b/libs/react-components/src/types/playground.ts @@ -1,6 +1,6 @@ import { TFormInput } from 'src/inputs'; -import { IPrompt } from 'src/types/message'; +import { IPrompt } from '@chainlit/react-client'; export interface ILLMProvider { id: string; @@ -23,20 +23,6 @@ export interface ILLMProviderSettings { }; } -export interface IFunction { - name: string; - description: string; - parameters: { - required: string[]; - properties: Record; - }; -} - -export interface ITool { - type: string; - function: IFunction; -} - export type PromptMode = 'Template' | 'Formatted'; export interface IPlayground { diff --git a/libs/components/src/types/playgroundContext.ts b/libs/react-components/src/types/playgroundContext.ts similarity index 94% rename from libs/components/src/types/playgroundContext.ts rename to libs/react-components/src/types/playgroundContext.ts index 7c61790a49..831d860d1b 100644 --- a/libs/components/src/types/playgroundContext.ts +++ b/libs/react-components/src/types/playgroundContext.ts @@ -1,6 +1,6 @@ -import { IPlayground, PromptMode } from 'src/types/playground'; +import { IPrompt } from '@chainlit/react-client'; -import { IPrompt } from './message'; +import { IPlayground, PromptMode } from 'src/types/playground'; interface IPlaygroundContext { variableName?: string; diff --git a/libs/components/tests/content.spec.tsx b/libs/react-components/tests/content.spec.tsx similarity index 98% rename from libs/components/tests/content.spec.tsx rename to libs/react-components/tests/content.spec.tsx index 028e0ce54f..e92ca5acc2 100644 --- a/libs/components/tests/content.spec.tsx +++ b/libs/react-components/tests/content.spec.tsx @@ -1,9 +1,9 @@ import { render } from '@testing-library/react'; import { expect, it } from 'vitest'; -import { MessageContent } from 'src/messages/components/MessageContent'; +import { ITextElement } from '@chainlit/react-client'; -import { ITextElement } from 'src/types/element'; +import { MessageContent } from 'src/messages/components/MessageContent'; it('renders the message content', () => { const { getByText } = render( diff --git a/libs/components/tests/message.spec.tsx b/libs/react-components/tests/message.spec.tsx similarity index 100% rename from libs/components/tests/message.spec.tsx rename to libs/react-components/tests/message.spec.tsx diff --git a/libs/components/tests/setup-tests.ts b/libs/react-components/tests/setup-tests.ts similarity index 100% rename from libs/components/tests/setup-tests.ts rename to libs/react-components/tests/setup-tests.ts diff --git a/libs/components/theme/index.ts b/libs/react-components/theme/index.ts similarity index 100% rename from libs/components/theme/index.ts rename to libs/react-components/theme/index.ts diff --git a/libs/components/theme/palette.ts b/libs/react-components/theme/palette.ts similarity index 100% rename from libs/components/theme/palette.ts rename to libs/react-components/theme/palette.ts diff --git a/libs/components/theme/theme.tsx b/libs/react-components/theme/theme.tsx similarity index 100% rename from libs/components/theme/theme.tsx rename to libs/react-components/theme/theme.tsx diff --git a/libs/components/tsconfig.json b/libs/react-components/tsconfig.json similarity index 100% rename from libs/components/tsconfig.json rename to libs/react-components/tsconfig.json diff --git a/libs/components/utils/exportToFile.ts b/libs/react-components/utils/exportToFile.ts similarity index 100% rename from libs/components/utils/exportToFile.ts rename to libs/react-components/utils/exportToFile.ts diff --git a/libs/components/utils/omit.ts b/libs/react-components/utils/omit.ts similarity index 100% rename from libs/components/utils/omit.ts rename to libs/react-components/utils/omit.ts diff --git a/libs/components/vitest.config.ts b/libs/react-components/vitest.config.ts similarity index 64% rename from libs/components/vitest.config.ts rename to libs/react-components/vitest.config.ts index b213df74e7..3f0a2df366 100644 --- a/libs/components/vitest.config.ts +++ b/libs/react-components/vitest.config.ts @@ -1,5 +1,6 @@ /// import react from '@vitejs/plugin-react-swc'; +import path from 'path'; import { defineConfig } from 'vite'; import tsconfigPaths from 'vite-tsconfig-paths'; @@ -8,6 +9,11 @@ export default defineConfig({ test: { environment: 'jsdom', setupFiles: './tests/setup-tests.ts', - include: ['**/*.{test,spec}.?(c|m)[jt]s?(x)'] + include: ['./**/*.{test,spec}.?(c|m)[jt]s?(x)'] + }, + resolve: { + alias: { + recoil: path.resolve(__dirname, './node_modules/recoil') + } } }); diff --git a/libs/sdk/package.json b/libs/sdk/package.json deleted file mode 100644 index b3329dc98b..0000000000 --- a/libs/sdk/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@chainlit/sdk", - "version": "0.0.1", - "description": "Chainlit typescript SDK", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "build": "tsc" - }, - "keywords": [ - "llm", - "ai", - "chain of thought", - "evaluation", - "dataset" - ], - "author": "Chainlit", - "license": "Apache-2.0", - "dependencies": { - "graphql-request": "^6.1.0", - "uuid": "^9.0.0" - }, - "devDependencies": { - "@types/uuid": "^9.0.3", - "ts-node": "^10.9.1", - "typescript": "^5.2.2" - } -} diff --git a/libs/sdk/pnpm-lock.yaml b/libs/sdk/pnpm-lock.yaml deleted file mode 100644 index 7adeb5ac21..0000000000 --- a/libs/sdk/pnpm-lock.yaml +++ /dev/null @@ -1,212 +0,0 @@ -lockfileVersion: '6.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -dependencies: - graphql-request: - specifier: ^6.1.0 - version: 6.1.0(graphql@16.8.0) - uuid: - specifier: ^9.0.0 - version: 9.0.1 - -devDependencies: - '@types/uuid': - specifier: ^9.0.3 - version: 9.0.4 - ts-node: - specifier: ^10.9.1 - version: 10.9.1(@types/node@20.6.2)(typescript@5.2.2) - typescript: - specifier: ^5.2.2 - version: 5.2.2 - -packages: - - /@cspotcode/source-map-support@0.8.1: - resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} - engines: {node: '>=12'} - dependencies: - '@jridgewell/trace-mapping': 0.3.9 - dev: true - - /@graphql-typed-document-node/core@3.2.0(graphql@16.8.0): - resolution: {integrity: sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==} - peerDependencies: - graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 - dependencies: - graphql: 16.8.0 - dev: false - - /@jridgewell/resolve-uri@3.1.1: - resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} - engines: {node: '>=6.0.0'} - dev: true - - /@jridgewell/sourcemap-codec@1.4.15: - resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} - dev: true - - /@jridgewell/trace-mapping@0.3.9: - resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - dependencies: - '@jridgewell/resolve-uri': 3.1.1 - '@jridgewell/sourcemap-codec': 1.4.15 - dev: true - - /@tsconfig/node10@1.0.9: - resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} - dev: true - - /@tsconfig/node12@1.0.11: - resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} - dev: true - - /@tsconfig/node14@1.0.3: - resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} - dev: true - - /@tsconfig/node16@1.0.4: - resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - dev: true - - /@types/node@20.6.2: - resolution: {integrity: sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw==} - dev: true - - /@types/uuid@9.0.4: - resolution: {integrity: sha512-zAuJWQflfx6dYJM62vna+Sn5aeSWhh3OB+wfUEACNcqUSc0AGc5JKl+ycL1vrH7frGTXhJchYjE1Hak8L819dA==} - dev: true - - /acorn-walk@8.2.0: - resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==} - engines: {node: '>=0.4.0'} - dev: true - - /acorn@8.10.0: - resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} - engines: {node: '>=0.4.0'} - hasBin: true - dev: true - - /arg@4.1.3: - resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - dev: true - - /create-require@1.1.1: - resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} - dev: true - - /cross-fetch@3.1.8: - resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==} - dependencies: - node-fetch: 2.7.0 - transitivePeerDependencies: - - encoding - dev: false - - /diff@4.0.2: - resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} - engines: {node: '>=0.3.1'} - dev: true - - /graphql-request@6.1.0(graphql@16.8.0): - resolution: {integrity: sha512-p+XPfS4q7aIpKVcgmnZKhMNqhltk20hfXtkaIkTfjjmiKMJ5xrt5c743cL03y/K7y1rg3WrIC49xGiEQ4mxdNw==} - peerDependencies: - graphql: 14 - 16 - dependencies: - '@graphql-typed-document-node/core': 3.2.0(graphql@16.8.0) - cross-fetch: 3.1.8 - graphql: 16.8.0 - transitivePeerDependencies: - - encoding - dev: false - - /graphql@16.8.0: - resolution: {integrity: sha512-0oKGaR+y3qcS5mCu1vb7KG+a89vjn06C7Ihq/dDl3jA+A8B3TKomvi3CiEcVLJQGalbu8F52LxkOym7U5sSfbg==} - engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} - dev: false - - /make-error@1.3.6: - resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - dev: true - - /node-fetch@2.7.0: - resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} - engines: {node: 4.x || >=6.0.0} - peerDependencies: - encoding: ^0.1.0 - peerDependenciesMeta: - encoding: - optional: true - dependencies: - whatwg-url: 5.0.0 - dev: false - - /tr46@0.0.3: - resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - dev: false - - /ts-node@10.9.1(@types/node@20.6.2)(typescript@5.2.2): - resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} - hasBin: true - peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' - peerDependenciesMeta: - '@swc/core': - optional: true - '@swc/wasm': - optional: true - dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.9 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.4 - '@types/node': 20.6.2 - acorn: 8.10.0 - acorn-walk: 8.2.0 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 5.2.2 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - dev: true - - /typescript@5.2.2: - resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} - engines: {node: '>=14.17'} - hasBin: true - dev: true - - /uuid@9.0.1: - resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==} - hasBin: true - dev: false - - /v8-compile-cache-lib@3.0.1: - resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} - dev: true - - /webidl-conversions@3.0.1: - resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} - dev: false - - /whatwg-url@5.0.0: - resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} - dependencies: - tr46: 0.0.3 - webidl-conversions: 3.0.1 - dev: false - - /yn@3.1.1: - resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} - engines: {node: '>=6'} - dev: true diff --git a/libs/sdk/src/index.ts b/libs/sdk/src/index.ts deleted file mode 100644 index 153f69c46a..0000000000 --- a/libs/sdk/src/index.ts +++ /dev/null @@ -1,531 +0,0 @@ -import { GraphQLClient } from 'graphql-request'; -import { v4 as uuidv4 } from 'uuid'; - -export type ElementType = - | 'image' - | 'avatar' - | 'text' - | 'pdf' - | 'tasklist' - | 'audio' - | 'video' - | 'file'; -export type ElementDisplay = 'inline' | 'side' | 'page'; -export type ElementSize = 'small' | 'medium' | 'large'; - -export type Role = 'USER' | 'ADMIN' | 'OWNER' | 'ANONYMOUS'; -export type Provider = - | 'credentials' - | 'header' - | 'github' - | 'google' - | 'azure-ad' - | 'okta' - | 'auth0' - | 'descope'; - -export interface IAppUser { - username: string; - role?: Role; - tags?: string[]; - image?: string; - provider?: Provider; -} - -export interface IPersistedAppUser extends IAppUser { - id: string; - createdAt: number; -} - -export interface IMessage { - conversationId?: string; - id: string; - createdAt?: number; - content: string; - author: string; - prompt?: any; - language?: string; - parentId?: string; - indent?: number; - authorIsUser?: boolean; - waitForAnswer?: boolean; - isError?: boolean; - humanFeedback?: number; - disableHumanFeedback?: boolean; -} - -export interface IElement { - id: string; - conversationId?: string; - type: ElementType; - url: string; - objectKey?: string; - name: string; - display: ElementDisplay; - size?: ElementSize; - language?: string; - forIds?: string[]; -} - -export interface IConversation { - id?: string; - createdAt?: number; - appUser?: IAppUser; - messages: IMessage[]; - elements?: IElement[]; -} - -export interface IPageInfo { - hasNextPage: boolean; - endCursor?: string; -} - -export interface IPaginatedResponse { - pageInfo: IPageInfo; - data: T[]; -} - -export interface IPagination { - first: number; - cursor?: string; -} - -export interface IConversationFilter { - feedback?: -1 | 0 | 1; - username?: string; - search?: string; -} - -class ChainlitGraphQLClient { - private graphqlClient: GraphQLClient; - public headers: Record; - - constructor(apiKey: string, chainlitServer: string) { - if (!apiKey) { - throw new Error( - 'Cannot instantiate Cloud Client without CHAINLIT_API_KEY' - ); - } - - this.headers = { - 'content-type': 'application/json', - 'x-api-key': apiKey - }; - - const graphqlEndpoint = `${chainlitServer}/api/graphql`; - this.graphqlClient = new GraphQLClient(graphqlEndpoint, { - headers: this.headers - }); - } - - async query( - query: string, - variables: Record = {} - ): Promise { - return this.graphqlClient.request(query, variables); - } - - async mutation( - mutation: string, - variables: Record = {} - ): Promise { - return this.graphqlClient.request(mutation, variables); - } -} - -export class ChainlitCloudClient extends ChainlitGraphQLClient { - chainlitServer: string; - constructor(apiKey: string, chainlitServer = 'https://cloud.chainlit.io') { - // Remove trailing slash - chainlitServer = chainlitServer.endsWith('/') - ? chainlitServer.slice(0, -1) - : chainlitServer; - super(apiKey, chainlitServer); - this.chainlitServer = chainlitServer; - } - - async createAppUser(appUser: IAppUser): Promise { - const mutation = ` - mutation ($username: String!, $role: Role!, $tags: [String!], $provider: String, $image: String) { - createAppUser(username: $username, role: $role, tags: $tags, provider: $provider, image: $image) { - id, - username, - role, - tags, - provider, - image, - createdAt - } - } - `; - const res = await this.mutation(mutation, appUser); - return res.createAppUser; - } - - async updateAppUser(appUser: IAppUser): Promise { - const mutation = ` - mutation ($username: String!, $role: Role!, $tags: [String!], $provider: String, $image: String) { - updateAppUser(username: $username, role: $role, tags: $tags, provider: $provider, image: $image) { - id, - username, - role, - tags, - provider, - image, - createdAt - } - } - `; - const res = await this.mutation(mutation, appUser); - return res.updateAppUser; - } - - async getAppUser(username: string): Promise { - const query = ` - query ($username: String!) { - getAppUser(username: $username) { - id, - username, - role, - tags, - provider, - image, - createdAt - } - } - `; - const variables = { username: username }; - const res = await this.query(query, variables); - return res.getAppUser; - } - - async deleteAppUser(username: string): Promise { - const mutation = ` - mutation ($username: String!) { - deleteAppUser(username: $username) { - id, - } - } - `; - const variables = { username: username }; - await this.mutation(mutation, variables); - return true; - } - - async createConversation( - appUserId?: string, - tags?: string[] - ): Promise { - const mutation = ` - mutation ($appUserId: String, $tags: [String!]) { - createConversation (appUserId: $appUserId, tags: $tags) { - id - } - } - `; - const variables: Record = {}; - if (appUserId) { - variables['appUserId'] = appUserId; - } - if (tags) { - variables['tags'] = tags; - } - const res = await this.mutation(mutation, variables); - return res.createConversation.id; - } - - async deleteConversation(conversationId: string): Promise { - const mutation = ` - mutation ($id: ID!) { - deleteConversation(id: $id) { - id - } - } - `; - const variables = { id: conversationId }; - await this.mutation(mutation, variables); - return true; - } - - async getConversationAuthor(conversationId: string): Promise { - const query = ` - query ($id: ID!) { - conversation(id: $id) { - appUser { - username - } - } - } - `; - const variables = { id: conversationId }; - const res = await this.query(query, variables); - const appUser = res.conversation.appUser; - if (appUser) { - return appUser.username; - } else { - return null; - } - } - - async getConversation(conversationId: string): Promise { - const query = ` - query ($id: ID!) { - conversation(id: $id) { - id - createdAt - tags - messages { - id - isError - parentId - indent - author - content - waitForAnswer - humanFeedback - humanFeedbackComment - disableHumanFeedback - language - prompt - authorIsUser - createdAt - } - elements { - id - conversationId - type - name - url - display - language - size - forIds - } - } - } - `; - const variables = { id: conversationId }; - const res = await this.query(query, variables); - return res.conversation; - } - - async getConversations( - pagination: IPagination, - filter?: IConversationFilter - ): Promise> { - const query = ` - query ( - $first: Int - $cursor: String - $withFeedback: Int - $username: String - $search: String - ) { - conversations( - first: $first - cursor: $cursor - withFeedback: $withFeedback - username: $username - search: $search - ) { - pageInfo { - endCursor - hasNextPage - } - edges { - cursor - node { - id - createdAt - appUser { - username - } - messages { - content - } - } - } - } - } - `; - const variables = { - first: pagination.first, - cursor: pagination.cursor, - withFeedback: filter?.feedback, - username: filter?.username, - search: filter?.search - }; - const res = await this.query(query, variables); - const conversations = res.conversations.edges.map((edge: any) => edge.node); - const pageInfo = res.conversations.pageInfo; - return { - pageInfo: { - hasNextPage: pageInfo.hasNextPage, - endCursor: pageInfo.endCursor - }, - data: conversations - }; - } - - async setHumanFeedback( - messageId: string, - feedback: number, - feedbackComment?: string - ): Promise { - const mutation = ` - mutation ($messageId: ID!, $humanFeedback: Int!, $humanFeedbackComment: String) { - setHumanFeedback(messageId: $messageId, humanFeedback: $humanFeedback, humanFeedbackComment: $humanFeedbackComment) { - id - humanFeedback - humanFeedbackComment - } - } - `; - const variables = { - messageId: messageId, - humanFeedback: feedback, - humanFeedbackComment: feedbackComment - }; - - await this.mutation(mutation, variables); - return true; - } - - async getMessage(): Promise { - throw new Error('Not implemented'); - } - - async createMessage(variables: IMessage): Promise { - const mutation = ` - mutation ($id: ID!, $conversationId: ID!, $author: String!, $content: String!, $language: String, $prompt: Json, $isError: Boolean, $parentId: String, $indent: Int, $authorIsUser: Boolean, $disableHumanFeedback: Boolean, $waitForAnswer: Boolean, $createdAt: StringOrFloat) { - createMessage(id: $id, conversationId: $conversationId, author: $author, content: $content, language: $language, prompt: $prompt, isError: $isError, parentId: $parentId, indent: $indent, authorIsUser: $authorIsUser, disableHumanFeedback: $disableHumanFeedback, waitForAnswer: $waitForAnswer, createdAt: $createdAt) { - id - } - } - `; - const res = await this.mutation(mutation, variables); - return res.createMessage.id; - } - - async updateMessage( - messageId: string, - variables: IMessage - ): Promise { - const mutation = ` - mutation ($messageId: ID!, $author: String!, $content: String!, $parentId: String, $language: String, $prompt: Json, $disableHumanFeedback: Boolean) { - updateMessage(messageId: $messageId, author: $author, content: $content, parentId: $parentId, language: $language, prompt: $prompt, disableHumanFeedback: $disableHumanFeedback) { - id - } - } - `; - await this.mutation(mutation, { - messageId: messageId, - ...variables - }); - return true; - } - - async deleteMessage(messageId: string): Promise { - const mutation = ` - mutation ($messageId: ID!) { - deleteMessage(messageId: $messageId) { - id - } - } - `; - await this.mutation(mutation, { messageId: messageId }); - return true; - } - - async getElement( - conversationId: string, - elementId: string - ): Promise { - const query = ` - query ($conversationId: ID!, $id: ID!) { - element(conversationId: $conversationId, id: $id) { - id - conversationId - type - name - url - display - language - size - forIds - } - } - `; - const variables = { conversationId: conversationId, id: elementId }; - const res = await this.query(query, variables); - return res.element; - } - - async createElement(variables: IElement): Promise { - const mutation = ` - mutation ($conversationId: ID!, $type: String!, $name: String!, $display: String!, $forIds: [String!]!, $url: String, $objectKey: String, $size: String, $language: String) { - createElement(conversationId: $conversationId, type: $type, url: $url, objectKey: $objectKey, name: $name, display: $display, size: $size, language: $language, forIds: $forIds) { - id, - type, - url, - objectKey, - name, - display, - size, - language, - forIds - } - } - `; - const res = await this.mutation(mutation, variables); - return res.createElement; - } - - async updateElement(variables: IElement): Promise { - const mutation = ` - mutation ($conversationId: ID!, $id: ID!, $forIds: [String!]!) { - updateElement(conversationId: $conversationId, id: $id, forIds: $forIds) { - id, - } - } - `; - const res = await this.mutation(mutation, variables); - return res.updateElement; - } - - async uploadElement(content: Blob, mime: string, conversationId?: string) { - const id = uuidv4(); - const body = { fileName: id, contentType: mime, conversationId }; - const path = '/api/upload/file'; - const response = await fetch(`${this.chainlitServer}${path}`, { - method: 'POST', - headers: this.headers, - body: JSON.stringify(body) - }); - if (!response.ok) { - const reason = await response.text(); - throw new Error(`Failed to sign upload url: ${reason}`); - } - const jsonRes = await response.json(); - const uploadDetails = jsonRes.post; - const objectKey: string = uploadDetails.fields.key; - const signedUrl: string = jsonRes.signedUrl; - const formData = new FormData(); - for (const [fieldName, fieldValue] of Object.entries( - uploadDetails.fields - )) { - formData.append(fieldName, fieldValue as string); - } - formData.append('file', content, 'multipart/form-data'); - const uploadResponse = await fetch(uploadDetails.url, { - method: 'POST', - body: formData - }); - if (!uploadResponse.ok) { - const reason = await uploadResponse.text(); - throw new Error(`Failed to upload file: ${reason}`); - } - // const url = `${uploadDetails.url}/${objectKey}`; - return { object_key: objectKey, url: signedUrl }; - } -} diff --git a/libs/sdk/tsconfig.json b/libs/sdk/tsconfig.json deleted file mode 100644 index 85a3db60be..0000000000 --- a/libs/sdk/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "target": "es2022", - "useDefineForClassFields": true, - "lib": ["ESNext", "DOM", "DOM.Iterable"], - "module": "CommonJS", - "skipLibCheck": true, - - /* Bundler mode */ - "moduleResolution": "node", - "esModuleInterop": true, - "outDir": "dist", - "allowSyntheticDefaultImports": true, - "resolveJsonModule": true, - "isolatedModules": true, - "declaration": true, - - /* Linting */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "paths": { - "src/*": ["./src/*"] - } - }, - "include": ["src"], - "types": ["node"] -} diff --git a/package.json b/package.json index 88437cd24d..b4f28df59d 100644 --- a/package.json +++ b/package.json @@ -19,16 +19,16 @@ "scripts": { "preinstall": "npx only-allow pnpm", "test": "pnpm exec ts-node ./cypress/support/e2e.ts", - "test:components": "cd libs/components && pnpm test", + "test:react-components": "cd libs/react-components && pnpm test", "prepare": "husky install", "lintUi": "cd frontend && pnpm run lint", "formatUi": "cd frontend && pnpm run format", - "lint:components": "cd libs/components && pnpm run lint", - "format:components": "cd libs/components && pnpm run format", + "lint:react-components": "cd libs/react-components && pnpm run lint", + "format:react-components": "cd libs/react-components && pnpm run format", "lintPython": "cd backend && poetry run mypy chainlit/", "formatPython": "black `git ls-files | grep '.py$'` && isort --profile=black .", - "buildUi": "cd libs/components && pnpm run build && cd ../../frontend && pnpm run build", - "build:components": "cd libs/components && pnpm build", + "buildUi": "cd libs/react-client && pnpm run build && cd ../react-components && pnpm run build && cd ../../frontend && pnpm run build", + "build:components": "cd libs/react-components && pnpm build", "build": "pnpm run buildUi && (mkdir -p backend/chainlit/frontend && cp -R frontend/dist backend/chainlit/frontend) && (cd backend && poetry build)" } } diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 684274baa0..22a611c8d9 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,4 @@ packages: - 'frontend/' - - 'libs/components/' + - 'libs/react-components/' + - 'libs/react-client/' From ae8b8fa50db75b38a4b45c4a352b9f8cc87d9ded Mon Sep 17 00:00:00 2001 From: Willy Douhard Date: Wed, 15 Nov 2023 14:34:35 +0100 Subject: [PATCH 3/5] fix ci --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b4f28df59d..1845478357 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "lintPython": "cd backend && poetry run mypy chainlit/", "formatPython": "black `git ls-files | grep '.py$'` && isort --profile=black .", "buildUi": "cd libs/react-client && pnpm run build && cd ../react-components && pnpm run build && cd ../../frontend && pnpm run build", - "build:components": "cd libs/react-components && pnpm build", + "build:react-components": "cd libs/react-components && pnpm build", "build": "pnpm run buildUi && (mkdir -p backend/chainlit/frontend && cp -R frontend/dist backend/chainlit/frontend) && (cd backend && poetry build)" } } From da1be8760ddb6237288049bebdcd533b4039dfb0 Mon Sep 17 00:00:00 2001 From: Willy Douhard Date: Thu, 16 Nov 2023 14:53:33 +0100 Subject: [PATCH 4/5] move api into client and remove client dependency from components --- frontend/package.json | 3 - frontend/pnpm-lock.yaml | 102 +------- frontend/src/App.tsx | 3 +- frontend/src/AppWrapper.tsx | 6 +- frontend/src/api/auth.ts | 7 + frontend/src/api/chainlitApi.ts | 99 ------- frontend/src/api/index.ts | 23 ++ frontend/src/api/index.tsx | 89 ------- .../atoms/buttons/userButton/avatar.tsx | 4 +- .../atoms/buttons/userButton/menu.tsx | 3 +- frontend/src/components/atoms/logo.tsx | 4 +- .../organisms/chat/Messages/container.tsx | 6 +- .../organisms/chat/history/index.tsx | 3 +- .../src/components/organisms/chat/index.tsx | 7 +- .../organisms/chat/inputBox/index.tsx | 3 +- .../sidebar/ConversationsHistoryList.tsx | 15 +- .../sidebar/DeleteConversationButton.tsx | 7 +- .../conversationsHistory/sidebar/index.tsx | 14 +- frontend/src/components/organisms/header.tsx | 3 +- .../components/organisms/playground/index.tsx | 8 +- frontend/src/hooks/localChatHistory.ts | 2 +- frontend/src/hooks/useApi.tsx | 22 -- frontend/src/hooks/useLLMProviders.ts | 5 +- frontend/src/pages/AuthCallback.tsx | 2 +- frontend/src/pages/Conversation.tsx | 12 +- frontend/src/pages/Element.tsx | 5 +- frontend/src/pages/Login.tsx | 35 +-- frontend/src/pages/Page.tsx | 3 +- frontend/src/state/chatHistory.ts | 2 +- frontend/src/state/conversations.ts | 43 +--- frontend/src/state/user.ts | 17 -- frontend/src/types/chat.ts | 2 +- frontend/vite.config.ts | 8 +- libs/react-client/package.json | 2 + libs/react-client/pnpm-lock.yaml | 44 +++- libs/react-client/src/api/hooks/api.ts | 30 +++ .../react-client/src/api}/hooks/auth.ts | 31 +-- libs/react-client/src/api/index.tsx | 242 ++++++++++++++++++ libs/react-client/src/index.ts | 3 + libs/react-client/src/state.ts | 58 ++++- .../react-client}/src/types/chatHistory.ts | 4 +- libs/react-client/src/types/index.ts | 1 + libs/react-client/src/useChatSession.ts | 2 +- .../react-client/src/utils/group.ts | 2 +- libs/react-client/src/utils/message.ts | 93 +------ .../react-client/src/utils/token.ts | 0 libs/react-client/tsconfig.json | 4 +- libs/react-components/hooks/index.ts | 1 - .../hooks/{useApi.tsx => useFetch.tsx} | 8 +- libs/react-components/hooks/useUpload.tsx | 2 +- libs/react-components/package.json | 1 - libs/react-components/pnpm-lock.yaml | 15 +- libs/react-components/src/Attachments.tsx | 2 +- libs/react-components/src/Markdown.tsx | 4 +- libs/react-components/src/elements/Audio.tsx | 2 +- libs/react-components/src/elements/Avatar.tsx | 2 +- .../react-components/src/elements/Element.tsx | 2 +- .../src/elements/ElementSideView.tsx | 2 +- .../src/elements/ElementView.tsx | 2 +- libs/react-components/src/elements/File.tsx | 2 +- libs/react-components/src/elements/Image.tsx | 2 +- .../src/elements/InlinedAudioList.tsx | 2 +- .../src/elements/InlinedElements.tsx | 2 +- .../src/elements/InlinedFileList.tsx | 2 +- .../src/elements/InlinedImageList.tsx | 2 +- .../src/elements/InlinedPDFList.tsx | 2 +- .../src/elements/InlinedPlotlyList.tsx | 2 +- .../src/elements/InlinedTextList.tsx | 2 +- .../src/elements/InlinedVideoList.tsx | 2 +- .../src/elements/ListWithSize.tsx | 2 +- libs/react-components/src/elements/PDF.tsx | 2 +- libs/react-components/src/elements/Plotly.tsx | 6 +- libs/react-components/src/elements/Text.tsx | 6 +- libs/react-components/src/elements/Video.tsx | 2 +- .../react-components/src/messages/Message.tsx | 4 +- .../src/messages/MessageContainer.tsx | 3 +- .../src/messages/Messages.tsx | 8 +- .../src/messages/components/ActionButton.tsx | 2 +- .../components/ActionDrawerButton.tsx | 2 +- .../messages/components/AskUploadButton.tsx | 4 +- .../src/messages/components/Author.tsx | 4 +- .../src/messages/components/DetailsButton.tsx | 2 +- .../src/messages/components/ElementRef.tsx | 2 +- .../messages/components/FeedbackButtons.tsx | 2 +- .../messages/components/MessageActions.tsx | 2 +- .../messages/components/MessageButtons.tsx | 2 +- .../messages/components/MessageContent.tsx | 3 +- .../messages/components/PlaygroundButton.tsx | 2 +- .../react-components/src/playground/basic.tsx | 2 +- libs/react-components/src/playground/chat.tsx | 2 +- .../src/playground/editor/MessageWrapper.tsx | 2 +- .../src/playground/editor/formatted.tsx | 4 +- .../src/playground/editor/promptMessage.tsx | 3 +- .../src/playground/editor/template/index.tsx | 2 +- .../src/playground/modelSettings.tsx | 3 +- .../src/types/messageContext.ts | 4 +- libs/react-components/src/types/playground.ts | 2 +- .../src/types/playgroundContext.ts | 3 +- libs/react-components/tests/content.spec.tsx | 4 +- libs/react-components/tsconfig.json | 1 + libs/react-components/utils/message.ts | 106 ++++++++ package.json | 2 +- 102 files changed, 677 insertions(+), 669 deletions(-) create mode 100644 frontend/src/api/auth.ts delete mode 100644 frontend/src/api/chainlitApi.ts create mode 100644 frontend/src/api/index.ts delete mode 100644 frontend/src/api/index.tsx delete mode 100644 frontend/src/hooks/useApi.tsx create mode 100644 libs/react-client/src/api/hooks/api.ts rename {frontend/src => libs/react-client/src/api}/hooks/auth.ts (73%) create mode 100644 libs/react-client/src/api/index.tsx rename {frontend => libs/react-client}/src/types/chatHistory.ts (62%) rename frontend/src/helpers/groupeByDate.ts => libs/react-client/src/utils/group.ts (95%) rename frontend/src/helpers/localStorageToken.ts => libs/react-client/src/utils/token.ts (100%) rename libs/react-components/hooks/{useApi.tsx => useFetch.tsx} (71%) create mode 100644 libs/react-components/utils/message.ts diff --git a/frontend/package.json b/frontend/package.json index b36a3037e8..722f2a3579 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -20,7 +20,6 @@ "@mui/lab": "^5.0.0-alpha.122", "@mui/material": "^5.14.10", "formik": "^2.4.3", - "jwt-decode": "^3.1.2", "lodash": "^4.17.21", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -30,8 +29,6 @@ "react-speech-recognition": "^3.10.0", "recoil": "^0.7.7", "regenerator-runtime": "^0.14.0", - "socket.io-client": "^4.7.2", - "swr": "^2.2.2", "usehooks-ts": "^2.9.1", "uuid": "^9.0.0", "yup": "^1.2.0" diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index 1e03e54686..ce9f8c6c1f 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -29,9 +29,6 @@ dependencies: formik: specifier: ^2.4.3 version: 2.4.3(react@18.2.0) - jwt-decode: - specifier: ^3.1.2 - version: 3.1.2 lodash: specifier: ^4.17.21 version: 4.17.21 @@ -59,12 +56,6 @@ dependencies: regenerator-runtime: specifier: ^0.14.0 version: 0.14.0 - socket.io-client: - specifier: ^4.7.2 - version: 4.7.2 - swr: - specifier: ^2.2.2 - version: 2.2.2(react@18.2.0) usehooks-ts: specifier: ^2.9.1 version: 2.9.1(react-dom@18.2.0)(react@18.2.0) @@ -743,10 +734,6 @@ packages: engines: {node: '>=14.0.0'} dev: false - /@socket.io/component-emitter@3.1.0: - resolution: {integrity: sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==} - dev: false - /@swc/core-darwin-arm64@1.3.96: resolution: {integrity: sha512-8hzgXYVd85hfPh6mJ9yrG26rhgzCmcLO0h1TIl8U31hwmTbfZLzRitFQ/kqMJNbIBCwmNH1RU2QcJnL3d7f69A==} engines: {node: '>=10'} @@ -956,10 +943,6 @@ packages: supports-color: 5.5.0 dev: false - /client-only@0.0.1: - resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==} - dev: false - /clsx@1.2.1: resolution: {integrity: sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==} engines: {node: '>=6'} @@ -1008,6 +991,7 @@ packages: optional: true dependencies: ms: 2.1.2 + dev: true /deepmerge@2.2.1: resolution: {integrity: sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA==} @@ -1021,25 +1005,6 @@ packages: csstype: 3.1.2 dev: false - /engine.io-client@6.5.3: - resolution: {integrity: sha512-9Z0qLB0NIisTRt1DZ/8U2k12RJn8yls/nXMZLn+/N8hANT3TcYjKFKcwbw5zFQiN4NTde3TSY9zb79e1ij6j9Q==} - dependencies: - '@socket.io/component-emitter': 3.1.0 - debug: 4.3.4 - engine.io-parser: 5.2.1 - ws: 8.11.0 - xmlhttprequest-ssl: 2.0.0 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - dev: false - - /engine.io-parser@5.2.1: - resolution: {integrity: sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==} - engines: {node: '>=10.0.0'} - dev: false - /error-ex@1.3.2: resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} dependencies: @@ -1177,10 +1142,6 @@ packages: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} dev: false - /jwt-decode@3.1.2: - resolution: {integrity: sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==} - dev: false - /lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} dev: false @@ -1202,6 +1163,7 @@ packages: /ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + dev: true /nanoid@3.3.7: resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} @@ -1412,30 +1374,6 @@ packages: loose-envify: 1.4.0 dev: false - /socket.io-client@4.7.2: - resolution: {integrity: sha512-vtA0uD4ibrYD793SOIAwlo8cj6haOeMHrGvwPxJsxH7CeIksqJ+3Zc06RvWTIFgiSqx4A3sOnTXpfAEE2Zyz6w==} - engines: {node: '>=10.0.0'} - dependencies: - '@socket.io/component-emitter': 3.1.0 - debug: 4.3.4 - engine.io-client: 6.5.3 - socket.io-parser: 4.2.4 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - dev: false - - /socket.io-parser@4.2.4: - resolution: {integrity: sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==} - engines: {node: '>=10.0.0'} - dependencies: - '@socket.io/component-emitter': 3.1.0 - debug: 4.3.4 - transitivePeerDependencies: - - supports-color - dev: false - /source-map-js@1.0.2: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} @@ -1462,16 +1400,6 @@ packages: engines: {node: '>= 0.4'} dev: false - /swr@2.2.2(react@18.2.0): - resolution: {integrity: sha512-CbR41AoMD4TQBQw9ic3GTXspgfM9Y8Mdhb5Ob4uIKXhWqnRLItwA5fpGvB7SmSw3+zEjb0PdhiEumtUvYoQ+bQ==} - peerDependencies: - react: ^16.11.0 || ^17.0.0 || ^18.0.0 - dependencies: - client-only: 0.0.1 - react: 18.2.0 - use-sync-external-store: 1.2.0(react@18.2.0) - dev: false - /tiny-case@1.0.3: resolution: {integrity: sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==} dev: false @@ -1517,14 +1445,6 @@ packages: hasBin: true dev: true - /use-sync-external-store@1.2.0(react@18.2.0): - resolution: {integrity: sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==} - peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - dependencies: - react: 18.2.0 - dev: false - /usehooks-ts@2.9.1(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-2FAuSIGHlY+apM9FVlj8/oNhd+1y+Uwv5QNkMQz1oSfdHk4PXo1qoCw9I5M7j0vpH8CSWFJwXbVPeYDjLCx9PA==} engines: {node: '>=16.15.0', npm: '>=8'} @@ -1594,24 +1514,6 @@ packages: fsevents: 2.3.3 dev: true - /ws@8.11.0: - resolution: {integrity: sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - dev: false - - /xmlhttprequest-ssl@2.0.0: - resolution: {integrity: sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==} - engines: {node: '>=0.4.0'} - dev: false - /yaml@1.10.2: resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} engines: {node: '>= 6'} diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 9aa7208efa..e93623a243 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,4 +1,5 @@ import { wsEndpoint } from 'api'; +import { useAuth } from 'api/auth'; import { useEffect } from 'react'; import { Toaster } from 'react-hot-toast'; import { RouterProvider } from 'react-router-dom'; @@ -16,8 +17,6 @@ import SettingsModal from 'components/molecules/settingsModal'; import ChatSettingsModal from 'components/organisms/chat/settings'; import PromptPlayground from 'components/organisms/playground'; -import { useAuth } from 'hooks/auth'; - import { projectSettingsState } from 'state/project'; import { settingsState } from 'state/settings'; import { userEnvState } from 'state/user'; diff --git a/frontend/src/AppWrapper.tsx b/frontend/src/AppWrapper.tsx index 462875ee5b..f8c83b3841 100644 --- a/frontend/src/AppWrapper.tsx +++ b/frontend/src/AppWrapper.tsx @@ -1,9 +1,10 @@ import App from 'App'; +import { apiClient } from 'api'; +import { useAuth } from 'api/auth'; import { useEffect } from 'react'; import { useRecoilState, useSetRecoilState } from 'recoil'; -import { useAuth } from 'hooks/auth'; -import { useApi } from 'hooks/useApi'; +import { useApi } from '@chainlit/react-client'; import { IProjectSettings, projectSettingsState } from 'state/project'; import { settingsState } from 'state/settings'; @@ -15,6 +16,7 @@ export default function AppWrapper() { const { isAuthenticated, isReady } = useAuth(); const { data } = useApi( + apiClient, projectSettings === undefined && isAuthenticated ? '/project/settings' : null diff --git a/frontend/src/api/auth.ts b/frontend/src/api/auth.ts new file mode 100644 index 0000000000..dbbf4e531b --- /dev/null +++ b/frontend/src/api/auth.ts @@ -0,0 +1,7 @@ +import { apiClient } from 'api'; + +import { useAuth as _useAuth } from '@chainlit/react-client'; + +export function useAuth() { + return _useAuth(apiClient); +} diff --git a/frontend/src/api/chainlitApi.ts b/frontend/src/api/chainlitApi.ts deleted file mode 100644 index ede025a7d4..0000000000 --- a/frontend/src/api/chainlitApi.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { IConversation, IPrompt } from '@chainlit/react-client'; - -import { - IPageInfo, - IPagination -} from 'components/organisms/conversationsHistory/sidebar/ConversationsHistoryList'; - -import { IConversationsFilters } from 'state/conversations'; - -import { api } from '.'; - -const ChainlitAPI = { - getCompletion: async ( - prompt: IPrompt, - userEnv = {}, - controller: AbortController, - accessToken?: string, - tokenCb?: (done: boolean, token: string) => void - ) => { - const response = await api.post( - `/completion`, - { prompt, userEnv }, - accessToken, - controller.signal - ); - - const reader = response?.body?.getReader(); - - const stream = new ReadableStream({ - start(controller) { - function push() { - reader! - .read() - .then(({ done, value }) => { - if (done) { - controller.close(); - tokenCb && tokenCb(done, ''); - return; - } - const string = new TextDecoder('utf-8').decode(value); - tokenCb && tokenCb(done, string); - controller.enqueue(value); - push(); - }) - .catch((err) => { - controller.close(); - tokenCb && tokenCb(true, ''); - console.error(err); - }); - } - push(); - } - }); - - return stream; - }, - - setHumanFeedback: async ( - messageId: string, - feedback: number, - feedbackComment?: string, - accessToken?: string - ) => { - await api.put( - `/message/feedback`, - { messageId, feedback, feedbackComment }, - accessToken - ); - }, - - getConversations: async ( - pagination: IPagination, - filter: IConversationsFilters, - accessToken?: string - ): Promise<{ - pageInfo: IPageInfo; - data: IConversation[]; - }> => { - const res = await api.post( - `/project/conversations`, - { pagination, filter }, - accessToken - ); - - return res?.json(); - }, - - deleteConversation: async (conversationId: string, accessToken?: string) => { - const res = await api.delete( - `/project/conversation`, - { conversationId }, - accessToken - ); - - return res?.json(); - } -}; - -export { ChainlitAPI }; diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts new file mode 100644 index 0000000000..8aa90c263f --- /dev/null +++ b/frontend/src/api/index.ts @@ -0,0 +1,23 @@ +import toast from 'react-hot-toast'; + +import { ChainlitAPI, ClientError } from '@chainlit/react-client'; + +const devServer = 'http://localhost:8000'; +const url = import.meta.env.DEV ? devServer : window.origin; +const serverUrl = new URL(url); + +const httpEndpoint = `${serverUrl.protocol}//${serverUrl.host}`; +export const wsEndpoint = httpEndpoint; + +const on401 = () => { + if (window.location.pathname !== '/login') { + // The credentials aren't correct, remove the token and redirect to login + window.location.href = '/login'; + } +}; + +const onError = (error: ClientError) => { + toast.error(error.toString()); +}; + +export const apiClient = new ChainlitAPI(httpEndpoint, on401, onError); diff --git a/frontend/src/api/index.tsx b/frontend/src/api/index.tsx deleted file mode 100644 index 35addc4783..0000000000 --- a/frontend/src/api/index.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import { removeToken } from 'helpers/localStorageToken'; -import toast from 'react-hot-toast'; - -const devServer = 'http://localhost:8000'; -const url = import.meta.env.DEV ? devServer : window.origin; -const serverUrl = new URL(url); - -const httpEndpoint = `${serverUrl.protocol}//${serverUrl.host}`; -export const wsEndpoint = httpEndpoint; - -export class ClientError extends Error { - detail?: string; - - constructor(message: string, detail?: string) { - super(message); - this.detail = detail; - } - - toString() { - if (this.detail) { - return `${this.message}: ${this.detail}`; - } else { - return this.message; - } - } -} - -const api = { - fetch: async ( - method: string, - endpoint: string, - token?: string, - data?: any, - signal?: AbortSignal - ) => { - try { - const headers: { Authorization?: string; 'Content-Type': string } = { - 'Content-Type': 'application/json' - }; - if (token) headers['Authorization'] = token; - - const res = await fetch(httpEndpoint + endpoint, { - method, - headers, - signal, - body: JSON.stringify(data) - }); - - if (!res.ok) { - const body = await res.json(); - if (res.status === 401 && window.location.pathname !== '/login') { - // The credentials aren't correct, remove the token and redirect to login - removeToken(); - window.location.href = '/login'; - } - throw new ClientError(res.statusText, body.detail); - } - - return res; - } catch (error: any) { - if (error instanceof ClientError) { - toast.error(error.toString()); - } - console.error(error); - throw error; - } - }, - - get: async (endpoint: string, token?: string) => - await api.fetch('GET', endpoint, token), - - post: async ( - endpoint: string, - data: any, - token?: string, - signal?: AbortSignal - ) => await api.fetch('POST', endpoint, token, data, signal), - - put: async (endpoint: string, data: any, token?: string) => - await api.fetch('PUT', endpoint, token, data), - - patch: async (endpoint: string, data: any, token?: string) => - await api.fetch('PATCH', endpoint, token, data), - - delete: async (endpoint: string, data: any, token?: string) => - await api.fetch('DELETE', endpoint, token, data) -}; - -export { api, httpEndpoint }; diff --git a/frontend/src/components/atoms/buttons/userButton/avatar.tsx b/frontend/src/components/atoms/buttons/userButton/avatar.tsx index b27af7c555..bb7c35a94c 100644 --- a/frontend/src/components/atoms/buttons/userButton/avatar.tsx +++ b/frontend/src/components/atoms/buttons/userButton/avatar.tsx @@ -1,6 +1,6 @@ -import { Avatar, Box } from '@mui/material'; +import { useAuth } from 'api/auth'; -import { useAuth } from 'hooks/auth'; +import { Avatar, Box } from '@mui/material'; export default function UserAvatar() { const { user } = useAuth(); diff --git a/frontend/src/components/atoms/buttons/userButton/menu.tsx b/frontend/src/components/atoms/buttons/userButton/menu.tsx index 81da14e897..a46574aaaa 100644 --- a/frontend/src/components/atoms/buttons/userButton/menu.tsx +++ b/frontend/src/components/atoms/buttons/userButton/menu.tsx @@ -1,3 +1,4 @@ +import { useAuth } from 'api/auth'; import { Link } from 'react-router-dom'; import { useRecoilValue, useSetRecoilState } from 'recoil'; @@ -14,8 +15,6 @@ import { Typography } from '@mui/material'; -import { useAuth } from 'hooks/auth'; - import { projectSettingsState } from 'state/project'; import { settingsState } from 'state/settings'; diff --git a/frontend/src/components/atoms/logo.tsx b/frontend/src/components/atoms/logo.tsx index 6a399cf365..f3c4b0e1c6 100644 --- a/frontend/src/components/atoms/logo.tsx +++ b/frontend/src/components/atoms/logo.tsx @@ -1,4 +1,4 @@ -import { httpEndpoint } from 'api'; +import { apiClient } from 'api'; import { useRecoilValue } from 'recoil'; import { settingsState } from 'state/settings'; @@ -12,6 +12,6 @@ export const Logo = ({ style }: Props) => { const { theme } = useRecoilValue(settingsState); return ( - logo + logo ); }; diff --git a/frontend/src/components/organisms/chat/Messages/container.tsx b/frontend/src/components/organisms/chat/Messages/container.tsx index d5296c4c5a..6b3798a385 100644 --- a/frontend/src/components/organisms/chat/Messages/container.tsx +++ b/frontend/src/components/organisms/chat/Messages/container.tsx @@ -1,4 +1,4 @@ -import { ChainlitAPI } from 'api/chainlitApi'; +import { apiClient } from 'api'; import { memo, useCallback, useMemo } from 'react'; import toast from 'react-hot-toast'; import { useNavigate } from 'react-router-dom'; @@ -12,6 +12,7 @@ import { IMessage, IMessageElement, ITool, + accessTokenState, messagesState, updateMessageById } from '@chainlit/react-client'; @@ -21,7 +22,6 @@ import { playgroundState } from 'state/playground'; import { highlightMessage, sideViewState } from 'state/project'; import { projectSettingsState } from 'state/project'; import { settingsState } from 'state/settings'; -import { accessTokenState } from 'state/user'; interface Props { loading: boolean; @@ -104,7 +104,7 @@ const MessageContainer = memo( ) => { try { await toast.promise( - ChainlitAPI.setHumanFeedback( + apiClient.setHumanFeedback( message.id, feedback, feedbackComment, diff --git a/frontend/src/components/organisms/chat/history/index.tsx b/frontend/src/components/organisms/chat/history/index.tsx index 9dcc31d572..b633231662 100644 --- a/frontend/src/components/organisms/chat/history/index.tsx +++ b/frontend/src/components/organisms/chat/history/index.tsx @@ -14,12 +14,11 @@ import { Typography } from '@mui/material'; +import { MessageHistory } from '@chainlit/react-client'; import { grey } from '@chainlit/react-components/theme'; import { chatHistoryState } from 'state/chatHistory'; -import { MessageHistory } from 'types/chatHistory'; - interface Props { disabled?: boolean; onClick: (content: string) => void; diff --git a/frontend/src/components/organisms/chat/index.tsx b/frontend/src/components/organisms/chat/index.tsx index 9267cb0cc0..8d5718890b 100644 --- a/frontend/src/components/organisms/chat/index.tsx +++ b/frontend/src/components/organisms/chat/index.tsx @@ -5,7 +5,11 @@ import { v4 as uuidv4 } from 'uuid'; import { Alert, Box } from '@mui/material'; -import { IFileResponse, useChatData } from '@chainlit/react-client'; +import { + IFileResponse, + conversationsHistoryState, + useChatData +} from '@chainlit/react-client'; import { ErrorBoundary, useUpload } from '@chainlit/react-components'; import SideView from 'components/atoms/element/sideView'; @@ -13,7 +17,6 @@ import ChatProfiles from 'components/molecules/chatProfiles'; import { TaskList } from 'components/molecules/tasklist/TaskList'; import { attachmentsState } from 'state/chat'; -import { conversationsHistoryState } from 'state/conversations'; import { projectSettingsState, sideViewState } from 'state/project'; import Messages from './Messages'; diff --git a/frontend/src/components/organisms/chat/inputBox/index.tsx b/frontend/src/components/organisms/chat/inputBox/index.tsx index 687d892a11..d594916343 100644 --- a/frontend/src/components/organisms/chat/inputBox/index.tsx +++ b/frontend/src/components/organisms/chat/inputBox/index.tsx @@ -1,3 +1,4 @@ +import { useAuth } from 'api/auth'; import { memo, useCallback } from 'react'; import { useSetRecoilState } from 'recoil'; import { v4 as uuidv4 } from 'uuid'; @@ -12,8 +13,6 @@ import { useChatInteract } from '@chainlit/react-client'; -import { useAuth } from 'hooks/auth'; - import { chatHistoryState } from 'state/chatHistory'; import { IProjectSettings } from 'state/project'; diff --git a/frontend/src/components/organisms/conversationsHistory/sidebar/ConversationsHistoryList.tsx b/frontend/src/components/organisms/conversationsHistory/sidebar/ConversationsHistoryList.tsx index eadf6a8704..2c3cc51ba2 100644 --- a/frontend/src/components/organisms/conversationsHistory/sidebar/ConversationsHistoryList.tsx +++ b/frontend/src/components/organisms/conversationsHistory/sidebar/ConversationsHistoryList.tsx @@ -13,24 +13,13 @@ import Skeleton from '@mui/material/Skeleton'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; +import { ConversationsHistory } from '@chainlit/react-client'; import { grey } from '@chainlit/react-components'; -import { ConversationsHistory } from 'types/chatHistory'; - import { DeleteConversationButton } from './DeleteConversationButton'; -export interface IPageInfo { - hasNextPage: boolean; - endCursor?: string; -} - -export interface IPagination { - first: number; - cursor?: string | number; -} - interface ConversationsHistoryProps { - conversations: ConversationsHistory; + conversations?: ConversationsHistory; error?: string; fetchConversations: () => void; isFetching: boolean; diff --git a/frontend/src/components/organisms/conversationsHistory/sidebar/DeleteConversationButton.tsx b/frontend/src/components/organisms/conversationsHistory/sidebar/DeleteConversationButton.tsx index 6f5e0abae9..1aa30637da 100644 --- a/frontend/src/components/organisms/conversationsHistory/sidebar/DeleteConversationButton.tsx +++ b/frontend/src/components/organisms/conversationsHistory/sidebar/DeleteConversationButton.tsx @@ -1,5 +1,4 @@ -import { ClientError } from 'api'; -import { ChainlitAPI } from 'api/chainlitApi'; +import { apiClient } from 'api'; import { useState } from 'react'; import toast from 'react-hot-toast'; import { useRecoilValue } from 'recoil'; @@ -14,7 +13,7 @@ import DialogContent from '@mui/material/DialogContent'; import DialogContentText from '@mui/material/DialogContentText'; import DialogTitle from '@mui/material/DialogTitle'; -import { accessTokenState } from 'state/user'; +import { ClientError, accessTokenState } from '@chainlit/react-client'; interface Props { conversationId: string; @@ -35,7 +34,7 @@ const DeleteConversationButton = ({ conversationId, onDelete }: Props) => { const handleConfirm = async () => { await toast.promise( - ChainlitAPI.deleteConversation(conversationId, accessToken), + apiClient.deleteConversation(conversationId, accessToken), { loading: 'Deleting conversation...', success: 'Conversation deleted!', diff --git a/frontend/src/components/organisms/conversationsHistory/sidebar/index.tsx b/frontend/src/components/organisms/conversationsHistory/sidebar/index.tsx index a34ffbd1b6..496e637bb8 100644 --- a/frontend/src/components/organisms/conversationsHistory/sidebar/index.tsx +++ b/frontend/src/components/organisms/conversationsHistory/sidebar/index.tsx @@ -1,4 +1,5 @@ -import { ChainlitAPI } from 'api/chainlitApi'; +import { apiClient } from 'api'; +import { useAuth } from 'api/auth'; import isEqual from 'lodash/isEqual'; import uniqBy from 'lodash/uniqBy'; import { useEffect, useRef, useState } from 'react'; @@ -11,16 +12,15 @@ import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; import useMediaQuery from '@mui/material/useMediaQuery'; -import { useAuth } from 'hooks/auth'; - import { IConversationsFilters, - conversationsFiltersState, + accessTokenState, conversationsHistoryState -} from 'state/conversations'; +} from '@chainlit/react-client'; + +import { conversationsFiltersState } from 'state/conversations'; import { projectSettingsState } from 'state/project'; import { settingsState } from 'state/settings'; -import { accessTokenState } from 'state/user'; import { ConversationsHistoryList } from './ConversationsHistoryList'; import Filters from './filters'; @@ -69,7 +69,7 @@ const _ConversationsHistorySidebar = () => { } else { setIsFetching(true); } - const { pageInfo, data } = await ChainlitAPI.getConversations( + const { pageInfo, data } = await apiClient.getConversations( { first: BATCH_SIZE, cursor }, filters, accessToken diff --git a/frontend/src/components/organisms/header.tsx b/frontend/src/components/organisms/header.tsx index 2e63364597..5c284c8cfe 100644 --- a/frontend/src/components/organisms/header.tsx +++ b/frontend/src/components/organisms/header.tsx @@ -1,3 +1,4 @@ +import { useAuth } from 'api/auth'; import { memo, useRef, useState } from 'react'; import { Link, useLocation } from 'react-router-dom'; @@ -20,8 +21,6 @@ import UserButton from 'components/atoms/buttons/userButton'; import { Logo } from 'components/atoms/logo'; import NewChatButton from 'components/molecules/newChatButton'; -import { useAuth } from 'hooks/auth'; - import { IProjectSettings } from 'state/project'; import OpenChatHistoryButton from './conversationsHistory/sidebar/OpenChatHistoryButton'; diff --git a/frontend/src/components/organisms/playground/index.tsx b/frontend/src/components/organisms/playground/index.tsx index 5b89e91107..a49f5cef97 100644 --- a/frontend/src/components/organisms/playground/index.tsx +++ b/frontend/src/components/organisms/playground/index.tsx @@ -1,9 +1,9 @@ -import { ChainlitAPI } from 'api/chainlitApi'; +import { apiClient } from 'api'; import { useCallback } from 'react'; import { toast } from 'react-hot-toast'; import { useRecoilState, useRecoilValue } from 'recoil'; -import { IPrompt } from '@chainlit/react-client'; +import { IPrompt, accessTokenState } from '@chainlit/react-client'; import { IPlaygroundContext, PromptPlayground @@ -17,7 +17,7 @@ import { playgroundState, variableState } from 'state/playground'; -import { accessTokenState, userEnvState } from 'state/user'; +import { userEnvState } from 'state/user'; export default function PlaygroundWrapper() { const accessToken = useRecoilValue(accessTokenState); @@ -54,7 +54,7 @@ export default function PlaygroundWrapper() { controller: AbortController, cb: (done: boolean, token: string) => void ) => { - return ChainlitAPI.getCompletion( + return apiClient.getCompletion( prompt, userEnv, controller, diff --git a/frontend/src/hooks/localChatHistory.ts b/frontend/src/hooks/localChatHistory.ts index 51a66001d9..a961c7d32e 100644 --- a/frontend/src/hooks/localChatHistory.ts +++ b/frontend/src/hooks/localChatHistory.ts @@ -1,6 +1,6 @@ import { useCallback } from 'react'; -import { MessageHistory } from 'types/chatHistory'; +import { MessageHistory } from '@chainlit/react-client'; const KEY = 'chatHistory'; const MAX_SIZE = 50; diff --git a/frontend/src/hooks/useApi.tsx b/frontend/src/hooks/useApi.tsx deleted file mode 100644 index 4d86b92438..0000000000 --- a/frontend/src/hooks/useApi.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { api } from 'api'; -import useSWR, { SWRConfiguration } from 'swr'; - -import { useAuth } from './auth'; - -const fetcher = async (endpoint: string, token?: string) => { - const res = await api.get(endpoint, token); - - return res?.json(); -}; - -function useApi(endpoint: string | null, options?: SWRConfiguration) { - const { accessToken } = useAuth(); - - return useSWR( - endpoint ? [endpoint, accessToken] : null, - ([url, token]: [url: string, token: string]) => fetcher(url, token), - options - ); -} - -export { useApi, fetcher }; diff --git a/frontend/src/hooks/useLLMProviders.ts b/frontend/src/hooks/useLLMProviders.ts index 7026faf1f9..a0b0c23fc6 100644 --- a/frontend/src/hooks/useLLMProviders.ts +++ b/frontend/src/hooks/useLLMProviders.ts @@ -1,15 +1,16 @@ +import { apiClient } from 'api'; import { useEffect } from 'react'; import toast from 'react-hot-toast'; import { useSetRecoilState } from 'recoil'; +import { useApi } from '@chainlit/react-client'; import { IPlayground } from '@chainlit/react-components'; -import { useApi } from 'hooks/useApi'; - import { playgroundState } from 'state/playground'; const useLLMProviders = (shouldFetch?: boolean) => { const { data, error } = useApi( + apiClient, shouldFetch ? '/project/llm-providers' : null ); const setPlayground = useSetRecoilState(playgroundState); diff --git a/frontend/src/pages/AuthCallback.tsx b/frontend/src/pages/AuthCallback.tsx index 218237d955..1a0e1c4308 100644 --- a/frontend/src/pages/AuthCallback.tsx +++ b/frontend/src/pages/AuthCallback.tsx @@ -1,7 +1,7 @@ +import { useAuth } from 'api/auth'; import { useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; -import { useAuth } from 'hooks/auth'; import { useQuery } from 'hooks/query'; export default function AuthCallback() { diff --git a/frontend/src/pages/Conversation.tsx b/frontend/src/pages/Conversation.tsx index 1054c8c18d..2ced403f45 100644 --- a/frontend/src/pages/Conversation.tsx +++ b/frontend/src/pages/Conversation.tsx @@ -1,23 +1,25 @@ +import { apiClient } from 'api'; import { useEffect } from 'react'; import { useParams } from 'react-router-dom'; import { useRecoilState } from 'recoil'; import { Box } from '@mui/material'; -import { IConversation } from '@chainlit/react-client'; +import { + IConversation, + conversationsHistoryState, + useApi +} from '@chainlit/react-client'; import { Conversation } from 'components/organisms/conversationsHistory/Conversation'; -import { useApi } from 'hooks/useApi'; - -import { conversationsHistoryState } from 'state/conversations'; - import Page from './Page'; import ResumeButton from './ResumeButton'; export default function ConversationPage() { const { id } = useParams(); const { data, error, isLoading } = useApi( + apiClient, id ? `/project/conversation/${id}` : null, { revalidateOnFocus: false, diff --git a/frontend/src/pages/Element.tsx b/frontend/src/pages/Element.tsx index 3409acc6d6..092384205d 100644 --- a/frontend/src/pages/Element.tsx +++ b/frontend/src/pages/Element.tsx @@ -1,13 +1,13 @@ +import { apiClient } from 'api'; import { useEffect, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import Page from 'pages/Page'; -import { IMessageElement, useChatData } from '@chainlit/react-client'; +import { IMessageElement, useApi, useChatData } from '@chainlit/react-client'; import { ElementView } from '@chainlit/react-components'; import { useQuery } from 'hooks/query'; -import { useApi } from 'hooks/useApi'; export default function Element() { const { id } = useParams(); @@ -20,6 +20,7 @@ export default function Element() { const conversationId = query.get('conversation'); const { data, error } = useApi( + apiClient, id && conversationId ? `/project/conversation/${conversationId}/element/${id}` : null diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx index 5104e2df13..8f90e746c9 100644 --- a/frontend/src/pages/Login.tsx +++ b/frontend/src/pages/Login.tsx @@ -1,4 +1,5 @@ -import { httpEndpoint } from 'api'; +import { apiClient } from 'api'; +import { useAuth } from 'api/auth'; import { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; @@ -6,28 +7,22 @@ import { AuthLogin } from '@chainlit/react-components'; import { Logo } from 'components/atoms/logo'; -import { useAuth } from 'hooks/auth'; import { useQuery } from 'hooks/query'; export default function Login() { const query = useQuery(); - const { config, setAccessToken, user } = useAuth(); + const { data: config, setAccessToken, user } = useAuth(); const [error, setError] = useState(''); const navigate = useNavigate(); const handleHeaderAuth = async () => { - const res = await fetch(httpEndpoint + '/auth/header', { - method: 'post' - }); - - const json = await res.json(); - - if (!res.ok) { - setError(json.detail); - } else if (json?.access_token) { + try { + const json = await apiClient.headerAuth(); setAccessToken(json.access_token); navigate('/'); + } catch (error: any) { + setError(error.message); } }; @@ -40,18 +35,12 @@ export default function Login() { formData.append('username', email); formData.append('password', password); - const res = await fetch(httpEndpoint + '/login', { - method: 'post', - body: formData - }); - - const json = await res.json(); - - if (!res.ok) { - setError(json.detail); - } else if (json?.access_token) { + try { + const json = await apiClient.passwordAuth(formData); setAccessToken(json.access_token); navigate(callbackUrl); + } catch (error: any) { + setError(error.message); } }; @@ -82,7 +71,7 @@ export default function Login() { providers={config?.oauthProviders || []} onPasswordSignIn={config?.passwordAuth ? handlePasswordLogin : undefined} onOAuthSignIn={async (provider: string) => { - window.location.href = httpEndpoint + '/auth/oauth/' + provider; + window.location.href = apiClient.getOAuthEndpoint(provider); }} renderLogo={} /> diff --git a/frontend/src/pages/Page.tsx b/frontend/src/pages/Page.tsx index 247d8b9059..dc8d072832 100644 --- a/frontend/src/pages/Page.tsx +++ b/frontend/src/pages/Page.tsx @@ -1,3 +1,4 @@ +import { useAuth } from 'api/auth'; import { Navigate } from 'react-router-dom'; import { useRecoilValue } from 'recoil'; @@ -7,8 +8,6 @@ import { ConversationsHistorySidebar } from 'components/organisms/conversationsH import OpenChatHistoryButton from 'components/organisms/conversationsHistory/sidebar/OpenChatHistoryButton'; import { Header } from 'components/organisms/header'; -import { useAuth } from 'hooks/auth'; - import { projectSettingsState } from 'state/project'; import { userEnvState } from 'state/user'; diff --git a/frontend/src/state/chatHistory.ts b/frontend/src/state/chatHistory.ts index c89a471283..dfebbfb4e1 100644 --- a/frontend/src/state/chatHistory.ts +++ b/frontend/src/state/chatHistory.ts @@ -1,6 +1,6 @@ import { atom } from 'recoil'; -import { MessageHistory } from 'types/chatHistory'; +import { MessageHistory } from '@chainlit/react-client'; const KEY = 'chat_history'; diff --git a/frontend/src/state/conversations.ts b/frontend/src/state/conversations.ts index 24d87d480c..5c0b87e7aa 100644 --- a/frontend/src/state/conversations.ts +++ b/frontend/src/state/conversations.ts @@ -1,49 +1,8 @@ -import { groupByDate } from 'helpers/groupeByDate'; -import isEqual from 'lodash/isEqual'; import { atom } from 'recoil'; -import { ConversationsHistory } from 'types/chatHistory'; - -export interface IConversationsFilters { - authorEmail?: string; - search?: string; - feedback?: number; -} +import { IConversationsFilters } from '@chainlit/react-client'; export const conversationsFiltersState = atom({ key: 'ConversationsFilters', default: {} }); - -export const conversationsHistoryState = atom( - { - key: 'ConversationsHistory', - default: { - conversations: undefined, - currentConversationId: undefined, - groupedConversations: undefined, - pageInfo: undefined - }, - effects: [ - ({ setSelf, onSet }: { setSelf: any; onSet: any }) => { - onSet( - (newValue: ConversationsHistory, oldValue: ConversationsHistory) => { - let groupedConversations = newValue.groupedConversations; - - if ( - newValue.conversations && - !isEqual(newValue.conversations, oldValue.groupedConversations) - ) { - groupedConversations = groupByDate(newValue.conversations); - } - - setSelf({ - ...newValue, - groupedConversations - }); - } - ); - } - ] - } -); diff --git a/frontend/src/state/user.ts b/frontend/src/state/user.ts index 18047ec200..c8893775f6 100644 --- a/frontend/src/state/user.ts +++ b/frontend/src/state/user.ts @@ -1,25 +1,8 @@ import { atom } from 'recoil'; -import { IAppUser, Role } from '@chainlit/react-client'; - -export const accessTokenState = atom({ - key: 'AccessToken', - default: undefined -}); - -export const roleState = atom({ - key: 'Role', - default: undefined -}); - const localUserEnv = localStorage.getItem('userEnv'); export const userEnvState = atom>({ key: 'UserEnv', default: localUserEnv ? JSON.parse(localUserEnv) : {} }); - -export const userState = atom({ - key: 'User', - default: null -}); diff --git a/frontend/src/types/chat.ts b/frontend/src/types/chat.ts index dc9b86e444..f093a16024 100644 --- a/frontend/src/types/chat.ts +++ b/frontend/src/types/chat.ts @@ -1,4 +1,4 @@ -import { Socket } from 'socket.io-client'; +import { Socket } from '@chainlit/react-client'; export interface IToken { id: number | string; diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index ff11a5f9d3..e598c417ca 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -8,7 +8,7 @@ export default defineConfig({ plugins: [react(), tsconfigPaths()], resolve: { alias: { - // To prevent conflicts with packages in @chainlit/components, we need to specify the resolution paths for these dependencies. + // To prevent conflicts with packages in @chainlit/react-components, we need to specify the resolution paths for these dependencies. react: path.resolve(__dirname, './node_modules/react'), '@mui/material': path.resolve(__dirname, './node_modules/@mui/material'), '@mui/icons-material': path.resolve( @@ -27,11 +27,7 @@ export default defineConfig({ formik: path.resolve(__dirname, './node_modules/formik'), 'usehooks-ts': path.resolve(__dirname, './node_modules/usehooks-ts'), lodash: path.resolve(__dirname, './node_modules/lodash'), - recoil: path.resolve(__dirname, './node_modules/recoil'), - 'socket.io-client': path.resolve( - __dirname, - './node_modules/socket.io-client' - ) + recoil: path.resolve(__dirname, './node_modules/recoil') } } }); diff --git a/libs/react-client/package.json b/libs/react-client/package.json index 0e2b7dcd9b..2d0d3f1e47 100644 --- a/libs/react-client/package.json +++ b/libs/react-client/package.json @@ -52,6 +52,8 @@ }, "dependencies": { "socket.io-client": "^4.7.2", + "jwt-decode": "^3.1.2", + "swr": "^2.2.2", "lodash": "^4.17.21", "uuid": "^9.0.0" } diff --git a/libs/react-client/pnpm-lock.yaml b/libs/react-client/pnpm-lock.yaml index a5a7aba869..9662a3bbaa 100644 --- a/libs/react-client/pnpm-lock.yaml +++ b/libs/react-client/pnpm-lock.yaml @@ -8,6 +8,9 @@ dependencies: '@types/react': specifier: ^18.2.0 version: 18.2.0 + jwt-decode: + specifier: ^3.1.2 + version: 3.1.2 lodash: specifier: ^4.17.21 version: 4.17.21 @@ -23,6 +26,9 @@ dependencies: socket.io-client: specifier: ^4.7.2 version: 4.7.2 + swr: + specifier: ^2.2.2 + version: 2.2.2(react@18.2.0) uuid: specifier: ^9.0.0 version: 9.0.0 @@ -1037,7 +1043,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001562 - electron-to-chromium: 1.4.583 + electron-to-chromium: 1.4.585 node-releases: 2.0.13 update-browserslist-db: 1.0.13(browserslist@4.22.1) dev: true @@ -1133,6 +1139,10 @@ packages: engines: {node: '>=8'} dev: true + /client-only@0.0.1: + resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==} + dev: false + /color-convert@1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} dependencies: @@ -1303,8 +1313,8 @@ packages: webidl-conversions: 7.0.0 dev: true - /electron-to-chromium@1.4.583: - resolution: {integrity: sha512-93y1gcONABZ7uqYe/JWDVQP/Pj/sQSunF0HVAPdlg/pfBnOyBMLlQUxWvkqcljJg1+W6cjvPuYD+r1Th9Tn8mA==} + /electron-to-chromium@1.4.585: + resolution: {integrity: sha512-B4yBlX0azdA3rVMxpYwLQfDpdwOgcnLCkpvSOd68iFmeedo+WYjaBJS3/W58LVD8CB2nf+o7C4K9xz1l09RkWg==} dev: true /engine.io-client@6.5.3: @@ -1923,6 +1933,10 @@ packages: resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==} dev: true + /jwt-decode@3.1.2: + resolution: {integrity: sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==} + dev: false + /lilconfig@2.1.0: resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} engines: {node: '>=10'} @@ -2030,7 +2044,7 @@ packages: acorn: 8.11.2 pathe: 1.1.1 pkg-types: 1.0.3 - ufo: 1.3.1 + ufo: 1.3.2 dev: true /ms@2.1.2: @@ -2515,6 +2529,16 @@ packages: has-flag: 4.0.0 dev: true + /swr@2.2.2(react@18.2.0): + resolution: {integrity: sha512-CbR41AoMD4TQBQw9ic3GTXspgfM9Y8Mdhb5Ob4uIKXhWqnRLItwA5fpGvB7SmSw3+zEjb0PdhiEumtUvYoQ+bQ==} + peerDependencies: + react: ^16.11.0 || ^17.0.0 || ^18.0.0 + dependencies: + client-only: 0.0.1 + react: 18.2.0 + use-sync-external-store: 1.2.0(react@18.2.0) + dev: false + /symbol-tree@3.2.4: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} dev: true @@ -2655,8 +2679,8 @@ packages: hasBin: true dev: true - /ufo@1.3.1: - resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==} + /ufo@1.3.2: + resolution: {integrity: sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==} dev: true /undici-types@5.26.5: @@ -2686,6 +2710,14 @@ packages: requires-port: 1.0.0 dev: true + /use-sync-external-store@1.2.0(react@18.2.0): + resolution: {integrity: sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==} + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 + dependencies: + react: 18.2.0 + dev: false + /uuid@9.0.0: resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==} hasBin: true diff --git a/libs/react-client/src/api/hooks/api.ts b/libs/react-client/src/api/hooks/api.ts new file mode 100644 index 0000000000..1aa765f6cb --- /dev/null +++ b/libs/react-client/src/api/hooks/api.ts @@ -0,0 +1,30 @@ +import { useRecoilValue } from 'recoil'; +import { ChainlitAPI } from 'src/api'; +import { accessTokenState } from 'src/state'; +import useSWR, { SWRConfiguration } from 'swr'; + +const fetcher = async ( + client: ChainlitAPI, + endpoint: string, + token?: string +) => { + const res = await client.get(endpoint, token); + + return res?.json(); +}; + +function useApi( + client: ChainlitAPI, + path: string | null, + options?: SWRConfiguration +) { + const accessToken = useRecoilValue(accessTokenState); + + return useSWR( + path ? [path, accessToken] : null, + ([url, token]: [url: string, token: string]) => fetcher(client, url, token), + options + ); +} + +export { useApi, fetcher }; diff --git a/frontend/src/hooks/auth.ts b/libs/react-client/src/api/hooks/auth.ts similarity index 73% rename from frontend/src/hooks/auth.ts rename to libs/react-client/src/api/hooks/auth.ts index fa4c2a5200..23e97a649f 100644 --- a/frontend/src/hooks/auth.ts +++ b/libs/react-client/src/api/hooks/auth.ts @@ -1,28 +1,29 @@ -import { getToken, removeToken, setToken } from 'helpers/localStorageToken'; import jwt_decode from 'jwt-decode'; import { useEffect } from 'react'; import { useRecoilState, useSetRecoilState } from 'recoil'; -import useSWRImmutable from 'swr/immutable'; +import { + accessTokenState, + conversationsHistoryState, + userState +} from 'src/state'; +import { IAppUser } from 'src/types'; +import { getToken, removeToken, setToken } from 'src/utils/token'; -import { IAppUser } from '@chainlit/react-client'; +import { ChainlitAPI } from '..'; +import { useApi } from './api'; -import { conversationsHistoryState } from 'state/conversations'; -import { accessTokenState, userState } from 'state/user'; - -import { fetcher } from './useApi'; - -export const useAuth = () => { - const { data: config, isLoading: isLoadingConfig } = useSWRImmutable<{ +export const useAuth = (apiClient: ChainlitAPI) => { + const { data, isLoading } = useApi<{ requireLogin: boolean; passwordAuth: boolean; headerAuth: boolean; oauthProviders: string[]; - }>('/auth/config', fetcher); + }>(apiClient, '/auth/config'); const [accessToken, setAccessToken] = useRecoilState(accessTokenState); const setConversationsHistory = useSetRecoilState(conversationsHistoryState); const [user, setUser] = useRecoilState(userState); - const isReady = !!(!isLoadingConfig && config); + const isReady = !!(!isLoading && data); const logout = () => { setUser(null); @@ -61,9 +62,9 @@ export const useAuth = () => { const isAuthenticated = !!accessToken; - if (config && !config.requireLogin) { + if (data && !data.requireLogin) { return { - config, + data, user: null, role: 'ANONYMOUS', isReady, @@ -75,7 +76,7 @@ export const useAuth = () => { } return { - config, + data, user: user, role: user?.role, isAuthenticated, diff --git a/libs/react-client/src/api/index.tsx b/libs/react-client/src/api/index.tsx new file mode 100644 index 0000000000..da8b8a19f3 --- /dev/null +++ b/libs/react-client/src/api/index.tsx @@ -0,0 +1,242 @@ +import { IConversation, IPrompt } from 'src/types'; +import { removeToken } from 'src/utils/token'; + +export * from './hooks/auth'; +export * from './hooks/api'; + +export interface IConversationsFilters { + authorEmail?: string; + search?: string; + feedback?: number; +} + +export interface IPageInfo { + hasNextPage: boolean; + endCursor?: string; +} + +export interface IPagination { + first: number; + cursor?: string | number; +} + +export class ClientError extends Error { + detail?: string; + + constructor(message: string, detail?: string) { + super(message); + this.detail = detail; + } + + toString() { + if (this.detail) { + return `${this.message}: ${this.detail}`; + } else { + return this.message; + } + } +} + +type Payload = FormData | any; + +export class APIBase { + constructor( + public httpEndpoint: string, + public on401?: () => void, + public onError?: (error: ClientError) => void + ) {} + + buildEndpoint(path: string) { + if (this.httpEndpoint.endsWith('/')) { + // remove trailing slash on httpEndpoint + return `${this.httpEndpoint.slice(0, -1)}${path}`; + } else { + return `${this.httpEndpoint}${path}`; + } + } + + checkToken(token: string) { + const prefix = 'Bearer '; + if (token.startsWith(prefix)) { + return token; + } else { + return prefix + token; + } + } + + async fetch( + method: string, + path: string, + token?: string, + data?: Payload, + signal?: AbortSignal + ): Promise { + try { + const headers: { Authorization?: string; 'Content-Type'?: string } = {}; + if (token) headers['Authorization'] = this.checkToken(token); // Assuming token is a bearer token + + let body; + + if (data instanceof FormData) { + body = data; + } else { + headers['Content-Type'] = 'application/json'; + body = data ? JSON.stringify(data) : null; + } + + const res = await fetch(this.buildEndpoint(path), { + method, + headers, + signal, + body + }); + + if (!res.ok) { + const body = await res.json(); + if (res.status === 401 && this.on401) { + removeToken(); + this.on401(); + } + throw new ClientError(res.statusText, body.detail); + } + + return res; + } catch (error: any) { + if (error instanceof ClientError && this.onError) { + this.onError(error); + } + console.error(error); + throw error; + } + } + + async get(endpoint: string, token?: string) { + return await this.fetch('GET', endpoint, token); + } + + async post( + endpoint: string, + data: Payload, + token?: string, + signal?: AbortSignal + ) { + return await this.fetch('POST', endpoint, token, data, signal); + } + + async put(endpoint: string, data: Payload, token?: string) { + return await this.fetch('PUT', endpoint, token, data); + } + + async patch(endpoint: string, data: Payload, token?: string) { + return await this.fetch('PATCH', endpoint, token, data); + } + + async delete(endpoint: string, data: Payload, token?: string) { + return await this.fetch('DELETE', endpoint, token, data); + } +} + +export class ChainlitAPI extends APIBase { + async headerAuth() { + const res = await this.post(`/auth/header`, {}); + return res.json(); + } + + async passwordAuth(data: FormData) { + const res = await this.post(`/login`, data); + return res.json(); + } + + async getCompletion( + prompt: IPrompt, + userEnv = {}, + controller: AbortController, + accessToken?: string, + tokenCb?: (done: boolean, token: string) => void + ) { + const response = await this.post( + `/completion`, + { prompt, userEnv }, + accessToken, + controller.signal + ); + + const reader = response?.body?.getReader(); + + const stream = new ReadableStream({ + start(controller) { + function push() { + reader! + .read() + .then(({ done, value }) => { + if (done) { + controller.close(); + tokenCb && tokenCb(done, ''); + return; + } + const string = new TextDecoder('utf-8').decode(value); + tokenCb && tokenCb(done, string); + controller.enqueue(value); + push(); + }) + .catch((err) => { + controller.close(); + tokenCb && tokenCb(true, ''); + console.error(err); + }); + } + push(); + } + }); + + return stream; + } + + async setHumanFeedback( + messageId: string, + feedback: number, + feedbackComment?: string, + accessToken?: string + ) { + await this.put( + `/message/feedback`, + { messageId, feedback, feedbackComment }, + accessToken + ); + } + + async getConversations( + pagination: IPagination, + filter: IConversationsFilters, + accessToken?: string + ): Promise<{ + pageInfo: IPageInfo; + data: IConversation[]; + }> { + const res = await this.post( + `/project/conversations`, + { pagination, filter }, + accessToken + ); + + return res.json(); + } + + async deleteConversation(conversationId: string, accessToken?: string) { + const res = await this.delete( + `/project/conversation`, + { conversationId }, + accessToken + ); + + return res.json(); + } + + getLogoEndpoint(theme: string) { + return this.buildEndpoint(`/logo?theme=${theme}`); + } + + getOAuthEndpoint(provider: string) { + return this.buildEndpoint(`/auth/oauth/${provider}`); + } +} diff --git a/libs/react-client/src/index.ts b/libs/react-client/src/index.ts index 98c48e46ed..448625fbd4 100644 --- a/libs/react-client/src/index.ts +++ b/libs/react-client/src/index.ts @@ -2,6 +2,9 @@ export * from './useChatData'; export * from './useChatInteract'; export * from './useChatMessages'; export * from './useChatSession'; +export * from './api'; export * from './types'; export * from './state'; export * from './utils/message'; + +export { Socket } from 'socket.io-client'; diff --git a/libs/react-client/src/state.ts b/libs/react-client/src/state.ts index b9064a2477..7e32da575f 100644 --- a/libs/react-client/src/state.ts +++ b/libs/react-client/src/state.ts @@ -1,15 +1,20 @@ +import isEqual from 'lodash/isEqual'; import { DefaultValue, atom, selector } from 'recoil'; import { Socket } from 'socket.io-client'; import { v4 as uuidv4 } from 'uuid'; import { + ConversationsHistory, IAction, + IAppUser, IAsk, IAvatarElement, IMessage, IMessageElement, - ITasklistElement + ITasklistElement, + Role } from './types'; +import { groupByDate } from './utils/group'; export interface ISession { socket: Socket; @@ -112,3 +117,54 @@ export const firstUserMessageState = atom({ key: 'FirstUserMessage', default: undefined }); + +export const accessTokenState = atom({ + key: 'AccessToken', + default: undefined +}); + +export const roleState = atom({ + key: 'Role', + default: undefined +}); + +export const userState = atom({ + key: 'User', + default: null +}); + +export const conversationsHistoryState = atom( + { + key: 'ConversationsHistory', + default: { + conversations: undefined, + currentConversationId: undefined, + groupedConversations: undefined, + pageInfo: undefined + }, + effects: [ + ({ setSelf, onSet }: { setSelf: any; onSet: any }) => { + onSet( + ( + newValue: ConversationsHistory | undefined, + oldValue: ConversationsHistory | undefined + ) => { + let groupedConversations = newValue?.groupedConversations; + + if ( + newValue?.conversations && + !isEqual(newValue.conversations, oldValue?.groupedConversations) + ) { + groupedConversations = groupByDate(newValue.conversations); + } + + setSelf({ + ...newValue, + groupedConversations + }); + } + ); + } + ] + } +); diff --git a/frontend/src/types/chatHistory.ts b/libs/react-client/src/types/chatHistory.ts similarity index 62% rename from frontend/src/types/chatHistory.ts rename to libs/react-client/src/types/chatHistory.ts index 27506b4ea5..8b2e19f3d2 100644 --- a/frontend/src/types/chatHistory.ts +++ b/libs/react-client/src/types/chatHistory.ts @@ -1,6 +1,6 @@ -import { IConversation } from '@chainlit/react-client'; +import { IConversation } from 'src/types'; -import { IPageInfo } from 'components/organisms/conversationsHistory/sidebar/ConversationsHistoryList'; +import { IPageInfo } from '..'; export type MessageHistory = { content: string; diff --git a/libs/react-client/src/types/index.ts b/libs/react-client/src/types/index.ts index f5a83a7cd2..46a4819763 100644 --- a/libs/react-client/src/types/index.ts +++ b/libs/react-client/src/types/index.ts @@ -4,3 +4,4 @@ export * from './file'; export * from './message'; export * from './user'; export * from './conversation'; +export * from './chatHistory'; diff --git a/libs/react-client/src/useChatSession.ts b/libs/react-client/src/useChatSession.ts index e08676dc00..5c67451de5 100644 --- a/libs/react-client/src/useChatSession.ts +++ b/libs/react-client/src/useChatSession.ts @@ -40,7 +40,7 @@ import { updateMessageContentById } from 'src/utils/message'; -import { IMessageUpdate, IToken } from './useChatData'; +import type { IMessageUpdate, IToken } from './useChatData'; const useChatSession = () => { const sessionId = useRecoilValue(sessionIdState); diff --git a/frontend/src/helpers/groupeByDate.ts b/libs/react-client/src/utils/group.ts similarity index 95% rename from frontend/src/helpers/groupeByDate.ts rename to libs/react-client/src/utils/group.ts index 0a6689d711..7e216e8857 100644 --- a/frontend/src/helpers/groupeByDate.ts +++ b/libs/react-client/src/utils/group.ts @@ -1,4 +1,4 @@ -import { IConversation } from '@chainlit/react-client'; +import { IConversation } from 'src/types'; export const groupByDate = (data: IConversation[]) => { const groupedData: { [key: string]: IConversation[] } = {}; diff --git a/libs/react-client/src/utils/message.ts b/libs/react-client/src/utils/message.ts index 775d3bbbc0..59a2512da6 100644 --- a/libs/react-client/src/utils/message.ts +++ b/libs/react-client/src/utils/message.ts @@ -1,6 +1,5 @@ import isEqual from 'lodash/isEqual'; - -import { IMessage, IMessageElement } from '../types'; +import { IMessage } from 'src/types'; const nestMessages = (messages: IMessage[]): IMessage[] => { let nestedMessages: IMessage[] = []; @@ -28,95 +27,6 @@ const isLastMessage = (messages: IMessage[], index: number) => { return true; }; -const isForIdMatch = ( - id: string | number | undefined, - forIds: string[] | undefined -) => { - if (!forIds || !forIds.length || !id) { - return false; - } - - return forIds.includes(id.toString()); -}; - -const isGlobalMatch = (forIds: string[] | undefined) => { - return !forIds || !forIds.length; -}; - -const escapeRegExp = (string: string) => { - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping - return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); -}; - -const prepareContent = ({ - elements, - content, - id, - language -}: { - elements: IMessageElement[]; - content?: string; - id: string; - language?: string; -}) => { - const elementNames = elements.map((e) => escapeRegExp(e.name)); - - // Sort by descending length to avoid matching substrings - elementNames.sort((a, b) => b.length - a.length); - - const elementRegexp = elementNames.length - ? new RegExp(`(${elementNames.join('|')})`, 'g') - : undefined; - - let preparedContent = content ? content.trim() : ''; - const inlinedElements = elements.filter( - (e) => isForIdMatch(id, e?.forIds) && e.display === 'inline' - ); - const refElements: IMessageElement[] = []; - - if (elementRegexp) { - preparedContent = preparedContent.replaceAll(elementRegexp, (match) => { - const element = elements.find((e) => { - const nameMatch = e.name === match; - const scopeMatch = - isGlobalMatch(e?.forIds) || isForIdMatch(id, e?.forIds); - return nameMatch && scopeMatch; - }); - const foundElement = !!element; - - const inlined = element?.display === 'inline'; - if (!foundElement) { - // Element reference does not exist, return plain text - return match; - } else if (inlined) { - // If element is inlined, add it to the list and return plain text - if (inlinedElements.indexOf(element) === -1) { - inlinedElements.push(element); - } - return match; - } else { - // Element is a reference, add it to the list and return link - refElements.push(element); - // spaces break markdown links. The address in the link is not used anyway - return `[${match}](${match.replaceAll(' ', '_')})`; - } - }); - } - - if (language) { - const prefix = `\`\`\`${language}`; - const suffix = '```'; - if (!preparedContent.startsWith('```')) { - preparedContent = `${prefix}\n${preparedContent}\n${suffix}`; - } - } - return { - preparedContent, - inlinedElements, - refElements - }; -}; - // Nested messages utils const addMessage = (messages: IMessage[], message: IMessage): IMessage[] => { @@ -291,7 +201,6 @@ export { hasMessageById, isLastMessage, nestMessages, - prepareContent, updateMessageById, updateMessageContentById }; diff --git a/frontend/src/helpers/localStorageToken.ts b/libs/react-client/src/utils/token.ts similarity index 100% rename from frontend/src/helpers/localStorageToken.ts rename to libs/react-client/src/utils/token.ts diff --git a/libs/react-client/tsconfig.json b/libs/react-client/tsconfig.json index 8bc832ec05..162f7cd79b 100644 --- a/libs/react-client/tsconfig.json +++ b/libs/react-client/tsconfig.json @@ -32,7 +32,7 @@ "src/*": ["./src/*"] } }, - "exclude": ["**/test", "**/dist", "**/types", "**/__tests__"], - "include": ["./src"], + "exclude": ["**/test", "**/dist", "**/__tests__"], + "include": ["src/**/*"], "types": ["@testing-library/jest-dom", "node"] } diff --git a/libs/react-components/hooks/index.ts b/libs/react-components/hooks/index.ts index b941bded0a..79e3ddec44 100644 --- a/libs/react-components/hooks/index.ts +++ b/libs/react-components/hooks/index.ts @@ -1,4 +1,3 @@ -export { useApi } from './useApi'; export { useColors } from './useColors'; export { useIsDarkMode } from './useIsDarkMode'; export { useUpload } from './useUpload'; diff --git a/libs/react-components/hooks/useApi.tsx b/libs/react-components/hooks/useFetch.tsx similarity index 71% rename from libs/react-components/hooks/useApi.tsx rename to libs/react-components/hooks/useFetch.tsx index 7f0b055ca2..75a8a8708c 100644 --- a/libs/react-components/hooks/useApi.tsx +++ b/libs/react-components/hooks/useFetch.tsx @@ -1,4 +1,4 @@ -import useSWR from 'swr'; +import useSWR, { SWRResponse } from 'swr'; const fetcher = async (url: string): Promise => { const response = await fetch(url); @@ -17,7 +17,7 @@ const fetcher = async (url: string): Promise => { } }; -const useApi = (endpoint: string | null) => { - return useSWR(endpoint, fetcher); +const useFetch = (endpoint: string | null): SWRResponse => { + return useSWR(endpoint, fetcher); }; -export { useApi }; +export { useFetch }; diff --git a/libs/react-components/hooks/useUpload.tsx b/libs/react-components/hooks/useUpload.tsx index 56a14e225c..ab1cc09744 100644 --- a/libs/react-components/hooks/useUpload.tsx +++ b/libs/react-components/hooks/useUpload.tsx @@ -6,7 +6,7 @@ import { useDropzone } from 'react-dropzone'; -import { FileSpec, IFileResponse } from '@chainlit/react-client'; +import type { FileSpec, IFileResponse } from 'client-types/'; interface useUploadProps { onError?: (error: string) => void; diff --git a/libs/react-components/package.json b/libs/react-components/package.json index 59132b0bb3..8465f50a8c 100644 --- a/libs/react-components/package.json +++ b/libs/react-components/package.json @@ -61,7 +61,6 @@ "uuid": "^9.0.0" }, "dependencies": { - "@chainlit/react-client": "workspace:^", "draft-js": "^0.11.7", "formik": "^2.4.3", "highlight.js": "^11.9.0", diff --git a/libs/react-components/pnpm-lock.yaml b/libs/react-components/pnpm-lock.yaml index 26feabae21..12986ced69 100644 --- a/libs/react-components/pnpm-lock.yaml +++ b/libs/react-components/pnpm-lock.yaml @@ -5,9 +5,6 @@ settings: excludeLinksFromLockfile: false dependencies: - '@chainlit/react-client': - specifier: workspace:^ - version: link:../react-client '@emotion/react': specifier: ^11.11.1 version: 11.11.1(@types/react@18.2.0)(react@18.2.0) @@ -1754,7 +1751,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001562 - electron-to-chromium: 1.4.583 + electron-to-chromium: 1.4.585 node-releases: 2.0.13 update-browserslist-db: 1.0.13(browserslist@4.22.1) dev: true @@ -2398,8 +2395,8 @@ packages: resolution: {integrity: sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==} dev: false - /electron-to-chromium@1.4.583: - resolution: {integrity: sha512-93y1gcONABZ7uqYe/JWDVQP/Pj/sQSunF0HVAPdlg/pfBnOyBMLlQUxWvkqcljJg1+W6cjvPuYD+r1Th9Tn8mA==} + /electron-to-chromium@1.4.585: + resolution: {integrity: sha512-B4yBlX0azdA3rVMxpYwLQfDpdwOgcnLCkpvSOd68iFmeedo+WYjaBJS3/W58LVD8CB2nf+o7C4K9xz1l09RkWg==} dev: true /element-size@1.1.1: @@ -4175,7 +4172,7 @@ packages: acorn: 8.11.2 pathe: 1.1.1 pkg-types: 1.0.3 - ufo: 1.3.1 + ufo: 1.3.2 dev: true /mouse-change@1.4.0: @@ -5609,8 +5606,8 @@ packages: resolution: {integrity: sha512-xV8kqRKM+jhMvcHWUKthV9fNebIzrNy//2O9ZwWcfiBFR5f25XVZPLlEajk/sf3Ra15V92isyQqnIEXRDaZWEA==} dev: false - /ufo@1.3.1: - resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==} + /ufo@1.3.2: + resolution: {integrity: sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==} dev: true /undici-types@5.26.5: diff --git a/libs/react-components/src/Attachments.tsx b/libs/react-components/src/Attachments.tsx index 0ed64962b6..9e9079249a 100644 --- a/libs/react-components/src/Attachments.tsx +++ b/libs/react-components/src/Attachments.tsx @@ -2,7 +2,7 @@ import React from 'react'; import Stack from '@mui/material/Stack'; -import { IFileElement } from '@chainlit/react-client'; +import type { IFileElement } from 'client-types/'; import { FileElement } from './elements'; diff --git a/libs/react-components/src/Markdown.tsx b/libs/react-components/src/Markdown.tsx index 7bf34c94a2..3b327ff9aa 100644 --- a/libs/react-components/src/Markdown.tsx +++ b/libs/react-components/src/Markdown.tsx @@ -14,10 +14,10 @@ import TableContainer from '@mui/material/TableContainer'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; -import { IMessageElement } from '@chainlit/react-client'; - import { ElementRef } from 'src/messages/components/ElementRef'; +import type { IMessageElement } from 'client-types/'; + import { InlineCode } from './InlineCode'; interface Props { diff --git a/libs/react-components/src/elements/Audio.tsx b/libs/react-components/src/elements/Audio.tsx index a0f7f15840..1d98479784 100644 --- a/libs/react-components/src/elements/Audio.tsx +++ b/libs/react-components/src/elements/Audio.tsx @@ -3,7 +3,7 @@ import { grey } from 'theme/palette'; import Box from '@mui/material/Box'; import useTheme from '@mui/material/styles/useTheme'; -import { IAudioElement } from '@chainlit/react-client'; +import type { IAudioElement } from 'client-types/'; const AudioElement = ({ element }: { element: IAudioElement }) => { const theme = useTheme(); diff --git a/libs/react-components/src/elements/Avatar.tsx b/libs/react-components/src/elements/Avatar.tsx index 89181268b7..96b8565972 100644 --- a/libs/react-components/src/elements/Avatar.tsx +++ b/libs/react-components/src/elements/Avatar.tsx @@ -1,7 +1,7 @@ import Avatar from '@mui/material/Avatar'; import Tooltip from '@mui/material/Tooltip'; -import { IAvatarElement } from '@chainlit/react-client'; +import type { IAvatarElement } from 'client-types/'; interface Props { element: IAvatarElement; diff --git a/libs/react-components/src/elements/Element.tsx b/libs/react-components/src/elements/Element.tsx index ca6c8a5259..0ac81cb9cf 100644 --- a/libs/react-components/src/elements/Element.tsx +++ b/libs/react-components/src/elements/Element.tsx @@ -1,4 +1,4 @@ -import { IMessageElement } from '@chainlit/react-client'; +import type { IMessageElement } from 'client-types/'; import { AudioElement } from './Audio'; import { FileElement } from './File'; diff --git a/libs/react-components/src/elements/ElementSideView.tsx b/libs/react-components/src/elements/ElementSideView.tsx index 8d6a4ad2aa..4ff2fd535b 100644 --- a/libs/react-components/src/elements/ElementSideView.tsx +++ b/libs/react-components/src/elements/ElementSideView.tsx @@ -12,7 +12,7 @@ import Typography from '@mui/material/Typography'; import styled from '@mui/material/styles/styled'; import useMediaQuery from '@mui/material/useMediaQuery'; -import { IMessageElement } from '@chainlit/react-client'; +import type { IMessageElement } from 'client-types/'; import 'react-resizable/css/styles.css'; diff --git a/libs/react-components/src/elements/ElementView.tsx b/libs/react-components/src/elements/ElementView.tsx index 040c69b7dd..a20859e27c 100644 --- a/libs/react-components/src/elements/ElementView.tsx +++ b/libs/react-components/src/elements/ElementView.tsx @@ -4,7 +4,7 @@ import IconButton from '@mui/material/IconButton'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { IMessageElement } from '@chainlit/react-client'; +import type { IMessageElement } from 'client-types/'; import { Element } from './Element'; diff --git a/libs/react-components/src/elements/File.tsx b/libs/react-components/src/elements/File.tsx index ae3f3d544d..fcbaf4b355 100644 --- a/libs/react-components/src/elements/File.tsx +++ b/libs/react-components/src/elements/File.tsx @@ -8,7 +8,7 @@ import Link from '@mui/material/Link'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { IFileElement } from '@chainlit/react-client'; +import type { IFileElement } from 'client-types/'; const FileElement = ({ element, diff --git a/libs/react-components/src/elements/Image.tsx b/libs/react-components/src/elements/Image.tsx index d101bc62b8..05015fa8d9 100644 --- a/libs/react-components/src/elements/Image.tsx +++ b/libs/react-components/src/elements/Image.tsx @@ -1,4 +1,4 @@ -import { IImageElement } from '@chainlit/react-client'; +import type { IImageElement } from 'client-types/'; import { FrameElement } from './Frame'; diff --git a/libs/react-components/src/elements/InlinedAudioList.tsx b/libs/react-components/src/elements/InlinedAudioList.tsx index f222498976..331d02a7f6 100644 --- a/libs/react-components/src/elements/InlinedAudioList.tsx +++ b/libs/react-components/src/elements/InlinedAudioList.tsx @@ -1,7 +1,7 @@ import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; -import { IAudioElement } from '@chainlit/react-client'; +import type { IAudioElement } from 'client-types/'; import { AudioElement } from './Audio'; diff --git a/libs/react-components/src/elements/InlinedElements.tsx b/libs/react-components/src/elements/InlinedElements.tsx index 89bc59daae..8374559b1b 100644 --- a/libs/react-components/src/elements/InlinedElements.tsx +++ b/libs/react-components/src/elements/InlinedElements.tsx @@ -1,6 +1,6 @@ import Stack from '@mui/material/Stack'; -import { ElementType, IMessageElement } from '@chainlit/react-client'; +import type { ElementType, IMessageElement } from 'client-types/'; import { InlinedAudioList } from './InlinedAudioList'; import { InlinedFileList } from './InlinedFileList'; diff --git a/libs/react-components/src/elements/InlinedFileList.tsx b/libs/react-components/src/elements/InlinedFileList.tsx index 38003aad3d..669cd2c56e 100644 --- a/libs/react-components/src/elements/InlinedFileList.tsx +++ b/libs/react-components/src/elements/InlinedFileList.tsx @@ -1,6 +1,6 @@ import Stack from '@mui/material/Stack'; -import { IFileElement } from '@chainlit/react-client'; +import type { IFileElement } from 'client-types/'; import { FileElement } from './File'; diff --git a/libs/react-components/src/elements/InlinedImageList.tsx b/libs/react-components/src/elements/InlinedImageList.tsx index b8b1346c55..e3fc4924ea 100644 --- a/libs/react-components/src/elements/InlinedImageList.tsx +++ b/libs/react-components/src/elements/InlinedImageList.tsx @@ -1,4 +1,4 @@ -import { IImageElement } from '@chainlit/react-client'; +import type { IImageElement } from 'client-types/'; import { ImageElement } from './Image'; import { ListWithSize } from './ListWithSize'; diff --git a/libs/react-components/src/elements/InlinedPDFList.tsx b/libs/react-components/src/elements/InlinedPDFList.tsx index c0927a0418..3183ab3c3c 100644 --- a/libs/react-components/src/elements/InlinedPDFList.tsx +++ b/libs/react-components/src/elements/InlinedPDFList.tsx @@ -1,6 +1,6 @@ import Stack from '@mui/material/Stack'; -import { IPdfElement } from '@chainlit/react-client'; +import type { IPdfElement } from 'client-types/'; import { PDFElement } from './PDF'; diff --git a/libs/react-components/src/elements/InlinedPlotlyList.tsx b/libs/react-components/src/elements/InlinedPlotlyList.tsx index 51e85550ec..039171b5c3 100644 --- a/libs/react-components/src/elements/InlinedPlotlyList.tsx +++ b/libs/react-components/src/elements/InlinedPlotlyList.tsx @@ -1,6 +1,6 @@ import Stack from '@mui/material/Stack'; -import { IPlotlyElement } from '@chainlit/react-client'; +import type { IPlotlyElement } from 'client-types/'; import { PlotlyElement } from './Plotly'; diff --git a/libs/react-components/src/elements/InlinedTextList.tsx b/libs/react-components/src/elements/InlinedTextList.tsx index 86134cea00..41494b5769 100644 --- a/libs/react-components/src/elements/InlinedTextList.tsx +++ b/libs/react-components/src/elements/InlinedTextList.tsx @@ -2,7 +2,7 @@ import Alert from '@mui/material/Alert'; import AlertTitle from '@mui/material/AlertTitle'; import Stack from '@mui/material/Stack'; -import { ITextElement } from '@chainlit/react-client'; +import type { ITextElement } from 'client-types/'; import { TextElement } from './Text'; diff --git a/libs/react-components/src/elements/InlinedVideoList.tsx b/libs/react-components/src/elements/InlinedVideoList.tsx index 3fec6f0c0a..1f550b3871 100644 --- a/libs/react-components/src/elements/InlinedVideoList.tsx +++ b/libs/react-components/src/elements/InlinedVideoList.tsx @@ -1,4 +1,4 @@ -import { IVideoElement } from '@chainlit/react-client'; +import type { IVideoElement } from 'client-types/'; import { ListWithSize } from './ListWithSize'; import { VideoElement } from './Video'; diff --git a/libs/react-components/src/elements/ListWithSize.tsx b/libs/react-components/src/elements/ListWithSize.tsx index 794b20567b..7fe2d2891f 100644 --- a/libs/react-components/src/elements/ListWithSize.tsx +++ b/libs/react-components/src/elements/ListWithSize.tsx @@ -1,7 +1,7 @@ import ImageList from '@mui/material/ImageList'; import ImageListItem from '@mui/material/ImageListItem'; -import { IImageElement, IVideoElement } from '@chainlit/react-client'; +import type { IImageElement, IVideoElement } from 'client-types/'; const sizeToUnit = (element: IImageElement | IVideoElement) => { switch (element.size) { diff --git a/libs/react-components/src/elements/PDF.tsx b/libs/react-components/src/elements/PDF.tsx index 40c16a05bb..46e8c31960 100644 --- a/libs/react-components/src/elements/PDF.tsx +++ b/libs/react-components/src/elements/PDF.tsx @@ -1,4 +1,4 @@ -import { IPdfElement } from '@chainlit/react-client'; +import type { IPdfElement } from 'client-types/'; interface Props { element: IPdfElement; diff --git a/libs/react-components/src/elements/Plotly.tsx b/libs/react-components/src/elements/Plotly.tsx index f648a091f1..fc6e739ddc 100644 --- a/libs/react-components/src/elements/Plotly.tsx +++ b/libs/react-components/src/elements/Plotly.tsx @@ -1,9 +1,9 @@ import { Suspense, lazy } from 'react'; import { ErrorBoundary } from 'src/ErrorBoundary'; -import { IPlotlyElement } from '@chainlit/react-client'; +import { useFetch } from 'hooks/useFetch'; -import { useApi } from 'hooks/index'; +import type { IPlotlyElement } from 'client-types/'; const Plot = lazy(() => import('react-plotly.js')); @@ -12,7 +12,7 @@ interface Props { } const _PlotlyElement = ({ element }: Props) => { - const { data, error, isLoading } = useApi( + const { data, error, isLoading } = useFetch( !element.content && element.url ? element.url : null ); diff --git a/libs/react-components/src/elements/Text.tsx b/libs/react-components/src/elements/Text.tsx index bcef2d96f9..e93f7f08dd 100644 --- a/libs/react-components/src/elements/Text.tsx +++ b/libs/react-components/src/elements/Text.tsx @@ -1,15 +1,15 @@ import { Markdown } from 'src/Markdown'; -import { ITextElement } from '@chainlit/react-client'; +import { useFetch } from 'hooks/useFetch'; -import { useApi } from 'hooks/index'; +import type { ITextElement } from 'client-types/'; interface Props { element: ITextElement; } const TextElement = ({ element }: Props) => { - const { data, error, isLoading } = useApi( + const { data, error, isLoading } = useFetch( !element.content && element.url ? element.url : null ); let content = element.content as string; diff --git a/libs/react-components/src/elements/Video.tsx b/libs/react-components/src/elements/Video.tsx index 38558e8698..9b5b3fbfee 100644 --- a/libs/react-components/src/elements/Video.tsx +++ b/libs/react-components/src/elements/Video.tsx @@ -1,4 +1,4 @@ -import { IVideoElement } from '@chainlit/react-client'; +import type { IVideoElement } from 'client-types/'; const VideoElement = ({ element }: { element: IVideoElement }) => { if (!element.url && !element.content) { diff --git a/libs/react-components/src/messages/Message.tsx b/libs/react-components/src/messages/Message.tsx index 72c5ab6c91..825e9a953d 100644 --- a/libs/react-components/src/messages/Message.tsx +++ b/libs/react-components/src/messages/Message.tsx @@ -5,14 +5,14 @@ import { memo, useContext, useEffect, useState } from 'react'; import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; -import { IAction, IMessage, IMessageElement } from '@chainlit/react-client'; - import { AskUploadButton } from './components/AskUploadButton'; import { AUTHOR_BOX_WIDTH, Author } from './components/Author'; import { DetailsButton } from './components/DetailsButton'; import { MessageActions } from './components/MessageActions'; import { MessageContent } from './components/MessageContent'; +import type { IAction, IMessage, IMessageElement } from 'client-types/'; + import { Messages } from './Messages'; interface Props { diff --git a/libs/react-components/src/messages/MessageContainer.tsx b/libs/react-components/src/messages/MessageContainer.tsx index 2efa39a9be..47839d3c9b 100644 --- a/libs/react-components/src/messages/MessageContainer.tsx +++ b/libs/react-components/src/messages/MessageContainer.tsx @@ -3,8 +3,7 @@ import { memo, useEffect, useRef } from 'react'; import Box from '@mui/material/Box'; -import { IAction, IMessage, IMessageElement } from '@chainlit/react-client'; - +import type { IAction, IMessage, IMessageElement } from 'client-types/'; import { IMessageContext } from 'src/types/messageContext'; import { Messages } from './Messages'; diff --git a/libs/react-components/src/messages/Messages.tsx b/libs/react-components/src/messages/Messages.tsx index 4d58bb5dfa..496554fa27 100644 --- a/libs/react-components/src/messages/Messages.tsx +++ b/libs/react-components/src/messages/Messages.tsx @@ -1,12 +1,8 @@ import { MessageContext } from 'contexts/MessageContext'; import { memo, useContext } from 'react'; +import { isLastMessage } from 'utils/message'; -import { - IAction, - IMessage, - IMessageElement, - isLastMessage -} from '@chainlit/react-client'; +import type { IAction, IMessage, IMessageElement } from 'client-types/'; import { Message } from './Message'; diff --git a/libs/react-components/src/messages/components/ActionButton.tsx b/libs/react-components/src/messages/components/ActionButton.tsx index 0a347693cc..34b5787684 100644 --- a/libs/react-components/src/messages/components/ActionButton.tsx +++ b/libs/react-components/src/messages/components/ActionButton.tsx @@ -4,7 +4,7 @@ import { useContext } from 'react'; import Button from '@mui/material/Button'; import Tooltip from '@mui/material/Tooltip'; -import { IAction } from '@chainlit/react-client'; +import type { IAction } from 'client-types/'; interface ActionProps { action: IAction; diff --git a/libs/react-components/src/messages/components/ActionDrawerButton.tsx b/libs/react-components/src/messages/components/ActionDrawerButton.tsx index 92cfb32416..a3d8ffa0d8 100644 --- a/libs/react-components/src/messages/components/ActionDrawerButton.tsx +++ b/libs/react-components/src/messages/components/ActionDrawerButton.tsx @@ -6,7 +6,7 @@ import Menu from '@mui/material/Menu'; import Stack from '@mui/material/Stack'; import Tooltip from '@mui/material/Tooltip'; -import { IAction } from '@chainlit/react-client'; +import type { IAction } from 'client-types/'; import { ActionButton } from './ActionButton'; diff --git a/libs/react-components/src/messages/components/AskUploadButton.tsx b/libs/react-components/src/messages/components/AskUploadButton.tsx index 70e699b827..687058345b 100644 --- a/libs/react-components/src/messages/components/AskUploadButton.tsx +++ b/libs/react-components/src/messages/components/AskUploadButton.tsx @@ -6,10 +6,10 @@ import LoadingButton from '@mui/lab/LoadingButton'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { IAsk, IFileResponse } from '@chainlit/react-client'; - import { useUpload } from 'hooks/useUpload'; +import type { IAsk, IFileResponse } from 'client-types/'; + const AskUploadChildButton = ({ askUser, onError diff --git a/libs/react-components/src/messages/components/Author.tsx b/libs/react-components/src/messages/components/Author.tsx index 38b44da6a7..c5f1c21557 100644 --- a/libs/react-components/src/messages/components/Author.tsx +++ b/libs/react-components/src/messages/components/Author.tsx @@ -6,10 +6,10 @@ import Box from '@mui/material/Box'; import Tooltip from '@mui/material/Tooltip'; import Typography from '@mui/material/Typography'; -import { IMessage } from '@chainlit/react-client'; - import { useColorForName } from 'hooks/useColors'; +import type { IMessage } from 'client-types/'; + import { MessageTime } from './MessageTime'; interface Props { diff --git a/libs/react-components/src/messages/components/DetailsButton.tsx b/libs/react-components/src/messages/components/DetailsButton.tsx index 01fc99ba46..eb864e4620 100644 --- a/libs/react-components/src/messages/components/DetailsButton.tsx +++ b/libs/react-components/src/messages/components/DetailsButton.tsx @@ -6,7 +6,7 @@ import ExpandLess from '@mui/icons-material/ExpandLess'; import ExpandMore from '@mui/icons-material/ExpandMore'; import CircularProgress from '@mui/material/CircularProgress'; -import { IMessage } from '@chainlit/react-client'; +import type { IMessage } from 'client-types/'; interface Props { message: IMessage; diff --git a/libs/react-components/src/messages/components/ElementRef.tsx b/libs/react-components/src/messages/components/ElementRef.tsx index a0322025ad..47deb64157 100644 --- a/libs/react-components/src/messages/components/ElementRef.tsx +++ b/libs/react-components/src/messages/components/ElementRef.tsx @@ -3,7 +3,7 @@ import { useContext } from 'react'; import Link from '@mui/material/Link'; -import { IMessageElement } from '@chainlit/react-client'; +import type { IMessageElement } from 'client-types/'; interface Props { element: IMessageElement; diff --git a/libs/react-components/src/messages/components/FeedbackButtons.tsx b/libs/react-components/src/messages/components/FeedbackButtons.tsx index cae6257533..f7854c2fff 100644 --- a/libs/react-components/src/messages/components/FeedbackButtons.tsx +++ b/libs/react-components/src/messages/components/FeedbackButtons.tsx @@ -15,7 +15,7 @@ import ButtonGroup from '@mui/material/ButtonGroup'; import Stack from '@mui/material/Stack'; import Tooltip from '@mui/material/Tooltip'; -import { IMessage } from '@chainlit/react-client'; +import type { IMessage } from 'client-types/'; const ICON_SIZE = '16px'; diff --git a/libs/react-components/src/messages/components/MessageActions.tsx b/libs/react-components/src/messages/components/MessageActions.tsx index b0634e99de..8b21bb0d47 100644 --- a/libs/react-components/src/messages/components/MessageActions.tsx +++ b/libs/react-components/src/messages/components/MessageActions.tsx @@ -1,7 +1,7 @@ import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; -import { IAction, IMessage } from '@chainlit/react-client'; +import type { IAction, IMessage } from 'client-types/'; import { ActionButton } from './ActionButton'; import { ActionDrawerButton } from './ActionDrawerButton'; diff --git a/libs/react-components/src/messages/components/MessageButtons.tsx b/libs/react-components/src/messages/components/MessageButtons.tsx index f4bb70598a..522f2b49d1 100644 --- a/libs/react-components/src/messages/components/MessageButtons.tsx +++ b/libs/react-components/src/messages/components/MessageButtons.tsx @@ -3,7 +3,7 @@ import { useContext } from 'react'; import Stack from '@mui/material/Stack'; -import { IMessage } from '@chainlit/react-client'; +import type { IMessage } from 'client-types/'; import { FeedbackButtons } from './FeedbackButtons'; import { PlaygroundButton } from './PlaygroundButton'; diff --git a/libs/react-components/src/messages/components/MessageContent.tsx b/libs/react-components/src/messages/components/MessageContent.tsx index 2a9cac5392..eec99402fd 100644 --- a/libs/react-components/src/messages/components/MessageContent.tsx +++ b/libs/react-components/src/messages/components/MessageContent.tsx @@ -3,12 +3,13 @@ import { Collapse } from 'src/Collapse'; import { Markdown } from 'src/Markdown'; import { InlinedElements } from 'src/elements/InlinedElements'; import { exportToFile } from 'utils/exportToFile'; +import { prepareContent } from 'utils/message'; import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { IMessageContent, prepareContent } from '@chainlit/react-client'; +import type { IMessageContent } from 'client-types/'; import { MessageButtons } from './MessageButtons'; diff --git a/libs/react-components/src/messages/components/PlaygroundButton.tsx b/libs/react-components/src/messages/components/PlaygroundButton.tsx index 0cca176502..1854c3498f 100644 --- a/libs/react-components/src/messages/components/PlaygroundButton.tsx +++ b/libs/react-components/src/messages/components/PlaygroundButton.tsx @@ -5,7 +5,7 @@ import BugReport from '@mui/icons-material/BugReport'; import IconButton from '@mui/material/IconButton'; import Tooltip from '@mui/material/Tooltip'; -import { IMessage } from '@chainlit/react-client'; +import type { IMessage } from 'client-types/'; interface Props { message: IMessage; diff --git a/libs/react-components/src/playground/basic.tsx b/libs/react-components/src/playground/basic.tsx index ab55e4b382..b14ea6b337 100644 --- a/libs/react-components/src/playground/basic.tsx +++ b/libs/react-components/src/playground/basic.tsx @@ -5,7 +5,7 @@ import { useContext } from 'react'; import Alert from '@mui/material/Alert'; import Stack from '@mui/material/Stack'; -import { IPrompt } from '@chainlit/react-client'; +import type { IPrompt } from 'client-types/'; import Completion from './editor/completion'; import FormattedEditor from './editor/formatted'; diff --git a/libs/react-components/src/playground/chat.tsx b/libs/react-components/src/playground/chat.tsx index eee7d6c100..33308d1d98 100644 --- a/libs/react-components/src/playground/chat.tsx +++ b/libs/react-components/src/playground/chat.tsx @@ -9,7 +9,7 @@ import Button from '@mui/material/Button'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { IPrompt } from '@chainlit/react-client'; +import type { IPrompt } from 'client-types/'; import Completion from './editor/completion'; import PromptMessage from './editor/promptMessage'; diff --git a/libs/react-components/src/playground/editor/MessageWrapper.tsx b/libs/react-components/src/playground/editor/MessageWrapper.tsx index 95b89f6c6a..58ebfe7434 100644 --- a/libs/react-components/src/playground/editor/MessageWrapper.tsx +++ b/libs/react-components/src/playground/editor/MessageWrapper.tsx @@ -9,7 +9,7 @@ import { SelectChangeEvent } from '@mui/material/Select'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { IPromptMessage, PromptMessageRole } from '@chainlit/react-client'; +import type { IPromptMessage, PromptMessageRole } from 'client-types/'; const roles = ['Assistant', 'System', 'User']; diff --git a/libs/react-components/src/playground/editor/formatted.tsx b/libs/react-components/src/playground/editor/formatted.tsx index 8646c00a67..45aa61dfdc 100644 --- a/libs/react-components/src/playground/editor/formatted.tsx +++ b/libs/react-components/src/playground/editor/formatted.tsx @@ -19,10 +19,10 @@ import { } from 'src/playground/helpers/format'; import { useIsFirstRender } from 'usehooks-ts'; -import { IPrompt } from '@chainlit/react-client'; - import { useColors } from 'hooks/useColors'; +import type { IPrompt } from 'client-types/'; + import 'draft-js/dist/Draft.css'; export interface IVariable { diff --git a/libs/react-components/src/playground/editor/promptMessage.tsx b/libs/react-components/src/playground/editor/promptMessage.tsx index eb510d8b60..4fd6745687 100644 --- a/libs/react-components/src/playground/editor/promptMessage.tsx +++ b/libs/react-components/src/playground/editor/promptMessage.tsx @@ -3,8 +3,7 @@ import { EditorState } from 'draft-js'; import Alert from '@mui/material/Alert'; import { useTheme } from '@mui/material/styles'; -import { IPrompt, IPromptMessage } from '@chainlit/react-client'; - +import type { IPrompt, IPromptMessage } from 'client-types/'; import { PromptMode } from 'src/types/playground'; import MessageWrapper from './MessageWrapper'; diff --git a/libs/react-components/src/playground/editor/template/index.tsx b/libs/react-components/src/playground/editor/template/index.tsx index 4d028fcd28..03197ca606 100644 --- a/libs/react-components/src/playground/editor/template/index.tsx +++ b/libs/react-components/src/playground/editor/template/index.tsx @@ -14,7 +14,7 @@ import { } from 'src/playground/helpers/format'; import { useIsFirstRender } from 'usehooks-ts'; -import { IPrompt } from '@chainlit/react-client'; +import type { IPrompt } from 'client-types/'; import Variable from './variable'; diff --git a/libs/react-components/src/playground/modelSettings.tsx b/libs/react-components/src/playground/modelSettings.tsx index 6d1e434006..409e135e26 100644 --- a/libs/react-components/src/playground/modelSettings.tsx +++ b/libs/react-components/src/playground/modelSettings.tsx @@ -16,8 +16,7 @@ import { SelectChangeEvent } from '@mui/material/Select'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { ILLMSettings } from '@chainlit/react-client'; - +import type { ILLMSettings } from 'client-types/'; import { ILLMProvider } from 'src/types/playground'; type Schema = { diff --git a/libs/react-components/src/types/messageContext.ts b/libs/react-components/src/types/messageContext.ts index 5bdeb26663..010f67f7bb 100644 --- a/libs/react-components/src/types/messageContext.ts +++ b/libs/react-components/src/types/messageContext.ts @@ -1,9 +1,9 @@ -import { +import type { IAsk, IAvatarElement, IMessage, IMessageElement -} from '@chainlit/react-client'; +} from 'client-types/'; interface IMessageContext { askUser?: IAsk; diff --git a/libs/react-components/src/types/playground.ts b/libs/react-components/src/types/playground.ts index 903c71af30..c7bea02e5e 100644 --- a/libs/react-components/src/types/playground.ts +++ b/libs/react-components/src/types/playground.ts @@ -1,6 +1,6 @@ import { TFormInput } from 'src/inputs'; -import { IPrompt } from '@chainlit/react-client'; +import type { IPrompt } from 'client-types/'; export interface ILLMProvider { id: string; diff --git a/libs/react-components/src/types/playgroundContext.ts b/libs/react-components/src/types/playgroundContext.ts index 831d860d1b..f0ef05b135 100644 --- a/libs/react-components/src/types/playgroundContext.ts +++ b/libs/react-components/src/types/playgroundContext.ts @@ -1,5 +1,4 @@ -import { IPrompt } from '@chainlit/react-client'; - +import type { IPrompt } from 'client-types/'; import { IPlayground, PromptMode } from 'src/types/playground'; interface IPlaygroundContext { diff --git a/libs/react-components/tests/content.spec.tsx b/libs/react-components/tests/content.spec.tsx index e92ca5acc2..c1469f68d2 100644 --- a/libs/react-components/tests/content.spec.tsx +++ b/libs/react-components/tests/content.spec.tsx @@ -1,10 +1,10 @@ import { render } from '@testing-library/react'; import { expect, it } from 'vitest'; -import { ITextElement } from '@chainlit/react-client'; - import { MessageContent } from 'src/messages/components/MessageContent'; +import type { ITextElement } from 'client-types/'; + it('renders the message content', () => { const { getByText } = render( { + if (!forIds || !forIds.length || !id) { + return false; + } + + return forIds.includes(id.toString()); +}; + +const isGlobalMatch = (forIds: string[] | undefined) => { + return !forIds || !forIds.length; +}; + +const escapeRegExp = (string: string) => { + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping + return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +}; + +export const prepareContent = ({ + elements, + content, + id, + language +}: { + elements: IMessageElement[]; + content?: string; + id: string; + language?: string; +}) => { + const elementNames = elements.map((e) => escapeRegExp(e.name)); + + // Sort by descending length to avoid matching substrings + elementNames.sort((a, b) => b.length - a.length); + + const elementRegexp = elementNames.length + ? new RegExp(`(${elementNames.join('|')})`, 'g') + : undefined; + + let preparedContent = content ? content.trim() : ''; + const inlinedElements = elements.filter( + (e) => isForIdMatch(id, e?.forIds) && e.display === 'inline' + ); + const refElements: IMessageElement[] = []; + + if (elementRegexp) { + preparedContent = preparedContent.replaceAll(elementRegexp, (match) => { + const element = elements.find((e) => { + const nameMatch = e.name === match; + const scopeMatch = + isGlobalMatch(e?.forIds) || isForIdMatch(id, e?.forIds); + return nameMatch && scopeMatch; + }); + const foundElement = !!element; + + const inlined = element?.display === 'inline'; + if (!foundElement) { + // Element reference does not exist, return plain text + return match; + } else if (inlined) { + // If element is inlined, add it to the list and return plain text + if (inlinedElements.indexOf(element) === -1) { + inlinedElements.push(element); + } + return match; + } else { + // Element is a reference, add it to the list and return link + refElements.push(element); + // spaces break markdown links. The address in the link is not used anyway + return `[${match}](${match.replaceAll(' ', '_')})`; + } + }); + } + + if (language) { + const prefix = `\`\`\`${language}`; + const suffix = '```'; + if (!preparedContent.startsWith('```')) { + preparedContent = `${prefix}\n${preparedContent}\n${suffix}`; + } + } + return { + preparedContent, + inlinedElements, + refElements + }; +}; + +export const isLastMessage = (messages: IMessage[], index: number) => { + if (messages.length - 1 === index) { + return true; + } + + for (let i = index + 1; i < messages.length; i++) { + if (messages[i].streaming) { + continue; + } else { + return false; + } + } + + return true; +}; diff --git a/package.json b/package.json index 1845478357..e9e088c6fc 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "lintPython": "cd backend && poetry run mypy chainlit/", "formatPython": "black `git ls-files | grep '.py$'` && isort --profile=black .", "buildUi": "cd libs/react-client && pnpm run build && cd ../react-components && pnpm run build && cd ../../frontend && pnpm run build", - "build:react-components": "cd libs/react-components && pnpm build", + "build:react-components": "cd libs/react-client && pnpm build && cd ../react-components && pnpm build", "build": "pnpm run buildUi && (mkdir -p backend/chainlit/frontend && cp -R frontend/dist backend/chainlit/frontend) && (cd backend && poetry build)" } } From b1fcbafaf58ad690db61ba03770d4c0be2a8df88 Mon Sep 17 00:00:00 2001 From: Willy Douhard Date: Thu, 16 Nov 2023 16:18:06 +0100 Subject: [PATCH 5/5] add readme --- libs/react-client/README.md | 172 +++++++++++++++++++++++++++++++++ libs/react-client/package.json | 3 +- 2 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 libs/react-client/README.md diff --git a/libs/react-client/README.md b/libs/react-client/README.md new file mode 100644 index 0000000000..af8668b9bf --- /dev/null +++ b/libs/react-client/README.md @@ -0,0 +1,172 @@ +## Overview + +The `@chainlit/react-client` package provides a set of React hooks as well as an API client to connect to your [Chainlit](https://github.com/Chainlit/chainlit) application from any React application. The package includes hooks for managing chat sessions, messages, data, and interactions. + +## Installation + +To install the package, run the following command in your project directory: + +```sh +npm install @chainlit/react-client +``` + +This package use [Recoil](https://github.com/facebookexperimental/Recoil) to manage its state. This means you will have to wrap your application in a recoil provider: + +```tsx +import React from 'react'; +import ReactDOM from 'react-dom/client'; +import { RecoilRoot } from 'recoil'; + +ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( + + + + + +); +``` + +## Usage + +### `useChatSession` + +This hook is responsible for managing the chat session's connection to the WebSocket server. + +#### Methods + +- `connect`: Establishes a connection to the WebSocket server. +- `disconnect`: Disconnects from the WebSocket server. +- `setChatProfile`: Sets the chat profile state. + +#### Example + +```jsx +import { useChatSession } from '@chainlit/react-client'; + +const ChatComponent = () => { + const { connect, disconnect, chatProfile, setChatProfile } = useChatSession(); + + // Connect to the WebSocket server + useEffect(() => { + connect({ + wsEndpoint: 'YOUR_WEBSOCKET_ENDPOINT', // Your Chainlit server url + userEnv: { + /* user environment variables */ + }, + accessToken: 'YOUR_ACCESS_TOKEN' // Optional Chainlit auth token + }); + + return () => { + disconnect(); + }; + }, [connect, disconnect]); + + // Rest of your component logic +}; +``` + +### `useChatMessages` + +This hook provides access to the chat messages and the first user message. + +#### Properties + +- `messages`: An array of chat messages. +- `firstUserMessage`: The first message from the user. + +#### Example + +```jsx +import { useChatMessages } from '@chainlit/react-client'; + +const MessagesComponent = () => { + const { messages, firstUserMessage } = useChatMessages(); + + // Render your messages + return ( +
+ {messages.map((message) => ( +

{message.content}

+ ))} +
+ ); +}; +``` + +### `useChatData` + +This hook provides access to various chat-related data and states. + +#### Properties + +- `actions`: An array of actions. +- `askUser`: The current ask user state. +- `avatars`: An array of avatar elements. +- `chatSettingsDefaultValue`: The default value for chat settings. +- `chatSettingsInputs`: The current chat settings inputs. +- `chatSettingsValue`: The current value of chat settings. +- `connected`: A boolean indicating if the WebSocket connection is established. +- `disabled`: A boolean indicating if the chat is disabled. +- `elements`: An array of chat elements. +- `error`: A boolean indicating if there is an error in the session. +- `loading`: A boolean indicating if the chat is in a loading state. +- `tasklists`: An array of tasklist elements. + +#### Example + +```jsx +import { useChatData } from '@chainlit/react-client'; + +const ChatDataComponent = () => { + const { loading, connected, error } = useChatData(); + + // Use the data to render your component + if (loading) return

Loading...

; + if (error) return

Error connecting to chat...

; + if (!connected) return

Disconnected...

; + + // Rest of your component logic +}; +``` + +### `useChatInteract` + +This hook provides methods to interact with the chat, such as sending messages, replying, and updating settings. + +#### Methods + +- `callAction`: Calls an action. +- `clear`: Clears the chat session. +- `replyMessage`: Replies to a message. +- `sendMessage`: Sends a message. +- `stopTask`: Stops the current task. +- `setIdToResume`: Sets the ID to resume a conversation. +- `updateChatSettings`: Updates the chat settings. + +#### Example + +```jsx +import { useChatInteract } from '@chainlit/react-client'; + +const InteractionComponent = () => { + const { sendMessage, replyMessage } = useChatInteract(); + + const handleSendMessage = () => { + const message = { content: 'Hello, World!', id: 'message-id' }; + sendMessage(message); + }; + + const handleReplyMessage = () => { + const message = { content: 'Replying to your message', id: 'reply-id' }; + replyMessage(message); + }; + + // Render your interaction component + return ( +
+ + +
+ ); +}; +``` diff --git a/libs/react-client/package.json b/libs/react-client/package.json index 2d0d3f1e47..c92a94cffb 100644 --- a/libs/react-client/package.json +++ b/libs/react-client/package.json @@ -23,7 +23,8 @@ "author": "Chainlit", "license": "Apache-2.0", "files": [ - "dist" + "dist", + "README.md" ], "main": "dist/index.js", "module": "dist/index.mjs",