From e1387769d3db218cdb4aeb8cd90cc163ea3fad54 Mon Sep 17 00:00:00 2001 From: deRohrer <131810848+deRohrer@users.noreply.github.com> Date: Fri, 30 Aug 2024 17:37:55 +0200 Subject: [PATCH] feat: make chatbot configurable (#1) * build: temporarily comment part of vite config * build: change CRLF line endings to LF * feat: builder view prototype * feat: use Settings in Player View * feat: multiline input fields * feat: add tabs including assistant settings * feat: add colors to different exchanges and assistant settings * feat: add create at least one assistant warning * feat: possible to move panels up and down * feat: add assistant image icons * feat: add uuid ids to elements * feat: make arrows same color as panels * feat: add maxima to inputs * feat: add tooltip for arrows * feat: uses current User * fix: remove useData function * feat: conserve chats when reloaded * feat: autofocus on text area * fix: remove console log lines * fix: remove outdated comments and files * fix: use intersection types for duplicate code * feat: add message on ending of exchanges * fix: optimize number of passed parameters * feat: add comments * fix: move up dissmissExchange function from message input to message pane * fix: remove infinte rerender of messages * feat: updated prompt sent to chatbot * fix: stop hiding default avatar symbol * feat: add function descriptions * fix: correct dismissExchange function description * feat: add view conversations tab * fix: correct errors commented in PR including typos and double variables * fix: stop showing conversations results twice * fix: don't show banner with instructions on complete of exchange in the conversations view --- .gitignore | 3 + .prettierrc | 3 +- .yarnrc.yml | 2 +- CHANGELOG.md | 60 ++- README.md | 2 +- cypress/support/component-index.html | 2 +- renovate.json | 17 +- src/config/appData.ts | 4 - src/config/appSettings.ts | 28 ++ src/config/config.ts | 61 +++ src/config/i18n.ts | 2 +- src/config/messages.ts | 2 - src/langs/en.json | 53 ++- src/langs/fr.json | 68 +++- src/modules/context/SettingsContext.tsx | 62 ++- .../interaction/ParticipantInteraction.tsx | 355 ++++++++--------- src/modules/main/BuilderView.tsx | 266 +++++++++---- src/modules/main/PlayerView.tsx | 12 - src/modules/message/MessageInput.tsx | 86 ++-- src/modules/message/MessagesPane.tsx | 368 ++++++++--------- src/results/ConversationsView.tsx | 160 ++++++++ src/settings/AssistantSettings.tsx | 266 +++++++++++++ src/settings/ChatSettings.tsx | 61 +++ src/settings/ExchangesSettings.tsx | 376 ++++++++++++++++++ src/types/Agent.ts | 5 +- src/types/Exchange.ts | 17 +- src/types/Interaction.ts | 15 +- yarn.lock | 34 +- 28 files changed, 1752 insertions(+), 638 deletions(-) delete mode 100644 src/config/appData.ts create mode 100644 src/config/appSettings.ts create mode 100644 src/config/config.ts delete mode 100644 src/config/messages.ts create mode 100644 src/results/ConversationsView.tsx create mode 100644 src/settings/AssistantSettings.tsx create mode 100644 src/settings/ChatSettings.tsx create mode 100644 src/settings/ExchangesSettings.tsx diff --git a/.gitignore b/.gitignore index b3f4503..eb5868e 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,6 @@ yarn-debug.log* cypress/screenshots/ cypress/videos/ cypress/downloads/ + +#vite +vite.config.ts.timestamp-* \ No newline at end of file diff --git a/.prettierrc b/.prettierrc index 08af675..dc08065 100644 --- a/.prettierrc +++ b/.prettierrc @@ -13,5 +13,6 @@ ], "importOrderSeparation": true, "importOrderSortSpecifiers": true, - "plugins": ["@trivago/prettier-plugin-sort-imports"] + "plugins": ["@trivago/prettier-plugin-sort-imports"], + "endOfLine": "auto" } diff --git a/.yarnrc.yml b/.yarnrc.yml index 6bc5e6d..75e896b 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1,6 +1,6 @@ compressionLevel: mixed -defaultSemverRangePrefix: "" +defaultSemverRangePrefix: '' enableGlobalCache: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 22592bd..e7d357a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,39 +2,37 @@ ## 1.0.0 (2024-04-14) - ### Features -* add one thread and auto dismiss options ([273b267](https://github.com/graasp/graasp-app-botticelli/commit/273b267e17931f6f5f5fa28a6b01aba4774dc1ed)) -* add scrolling ([3d09ac7](https://github.com/graasp/graasp-app-botticelli/commit/3d09ac76d51e94c930fcd73aeda6ba7466052824)) -* blur after sending message ([13f83e6](https://github.com/graasp/graasp-app-botticelli/commit/13f83e6283031b08f5be15d9202429f92e6df7d9)) -* improve prompts ([bbfca97](https://github.com/graasp/graasp-app-botticelli/commit/bbfca970479a9b655c2d2863dc640e4856020ba6)) -* make height full viewport ([ef95461](https://github.com/graasp/graasp-app-botticelli/commit/ef95461d54c569ec6c7390537965e794e1d0ad65)) -* save app data ([6db1c6a](https://github.com/graasp/graasp-app-botticelli/commit/6db1c6a0228544eedfdbf50e9dd512932fd4aac7)) -* save chat in session storage ([c8c6ed0](https://github.com/graasp/graasp-app-botticelli/commit/c8c6ed046fe36cfb6eedae3ed2e9e775b94bedfe)) -* show warning on unload ([3435ddf](https://github.com/graasp/graasp-app-botticelli/commit/3435ddfd840b697487c5db8c644796e8e09e0dca)) -* update prompt ([3736f05](https://github.com/graasp/graasp-app-botticelli/commit/3736f05ce53fa10b491f981fe9d1213472f3241e)) - +- add one thread and auto dismiss options ([273b267](https://github.com/graasp/graasp-app-botticelli/commit/273b267e17931f6f5f5fa28a6b01aba4774dc1ed)) +- add scrolling ([3d09ac7](https://github.com/graasp/graasp-app-botticelli/commit/3d09ac76d51e94c930fcd73aeda6ba7466052824)) +- blur after sending message ([13f83e6](https://github.com/graasp/graasp-app-botticelli/commit/13f83e6283031b08f5be15d9202429f92e6df7d9)) +- improve prompts ([bbfca97](https://github.com/graasp/graasp-app-botticelli/commit/bbfca970479a9b655c2d2863dc640e4856020ba6)) +- make height full viewport ([ef95461](https://github.com/graasp/graasp-app-botticelli/commit/ef95461d54c569ec6c7390537965e794e1d0ad65)) +- save app data ([6db1c6a](https://github.com/graasp/graasp-app-botticelli/commit/6db1c6a0228544eedfdbf50e9dd512932fd4aac7)) +- save chat in session storage ([c8c6ed0](https://github.com/graasp/graasp-app-botticelli/commit/c8c6ed046fe36cfb6eedae3ed2e9e775b94bedfe)) +- show warning on unload ([3435ddf](https://github.com/graasp/graasp-app-botticelli/commit/3435ddfd840b697487c5db8c644796e8e09e0dca)) +- update prompt ([3736f05](https://github.com/graasp/graasp-app-botticelli/commit/3736f05ce53fa10b491f981fe9d1213472f3241e)) ### Bug Fixes -* attempt to make warning work on mobile ([7333e99](https://github.com/graasp/graasp-app-botticelli/commit/7333e99e25d4bcfe2aa23d03087412ac61ecbd2f)) -* **deps:** update dependency @emotion/styled to v11.11.5 ([ed3c6f1](https://github.com/graasp/graasp-app-botticelli/commit/ed3c6f1cb205b94e8063c18736541b6dbf4c162d)) -* **deps:** update dependency @graasp/apps-query-client to v3.4.10 ([ff23dbb](https://github.com/graasp/graasp-app-botticelli/commit/ff23dbb6b35c5d42ea5dc2de2aa8f89e3e4b8a4e)) -* **deps:** update dependency @graasp/sdk to v4.6.0 ([03c8d5f](https://github.com/graasp/graasp-app-botticelli/commit/03c8d5f45c19b5995be54ddc9d99b872c828cb3b)) -* **deps:** update dependency @graasp/sdk to v4.7.1 ([afd90bb](https://github.com/graasp/graasp-app-botticelli/commit/afd90bb6ee850a7290c45bb6b1fa2ce8dced000e)) -* **deps:** update dependency @types/react to v18.2.75 ([54c503e](https://github.com/graasp/graasp-app-botticelli/commit/54c503e35dc864f3b3f0d4e42fbee2e41f67d057)) -* **deps:** update dependency typescript to v5.4.4 ([ce757e6](https://github.com/graasp/graasp-app-botticelli/commit/ce757e6cc1b2303a6be614622a1e9cd77238e749)) -* **deps:** update dependency typescript to v5.4.5 ([7c24658](https://github.com/graasp/graasp-app-botticelli/commit/7c24658a953a2ecace3394dcd038871410fbf73c)) -* **deps:** update mui (non-major) ([d206f8d](https://github.com/graasp/graasp-app-botticelli/commit/d206f8daf8be8562a76f47208fe287e028191e1f)) -* **deps:** update react monorepo ([ed7e82a](https://github.com/graasp/graasp-app-botticelli/commit/ed7e82ad865b207b0a71a37d960b996bf7793af3)) -* **deps:** update react monorepo ([7fe3b03](https://github.com/graasp/graasp-app-botticelli/commit/7fe3b03771a347dc670816a6615c60d2c289b9a8)) -* fix player view test ([365ee8a](https://github.com/graasp/graasp-app-botticelli/commit/365ee8a0c79a1dd80b4742c148adae248809d250)) -* fix prompt builder helper ([c0f453a](https://github.com/graasp/graasp-app-botticelli/commit/c0f453a5be8a32773e16aaabf6c7a5079af79800)) -* fix size of instructions ([f12013d](https://github.com/graasp/graasp-app-botticelli/commit/f12013d6dee686e17b45cfc827309fb9525287af)) -* fix tests ([8955748](https://github.com/graasp/graasp-app-botticelli/commit/895574856d7b3dc53f096804fc89f273e9dd5cf2)) -* fix window access ([78b7519](https://github.com/graasp/graasp-app-botticelli/commit/78b7519f75149093773c82156ac675138d061226)) -* remove autoscrolling ([b6a1a06](https://github.com/graasp/graasp-app-botticelli/commit/b6a1a0615eba2b136515e41291af13826ca7df6e)) -* set status to idle after response ([6084db3](https://github.com/graasp/graasp-app-botticelli/commit/6084db3e483e2db3e7b18f3a232eb2a9b8bf903b)) -* update cues ([568ff8a](https://github.com/graasp/graasp-app-botticelli/commit/568ff8aec44dcd7e506850b5badc068ff8599490)) -* update text ([a34c545](https://github.com/graasp/graasp-app-botticelli/commit/a34c5459e78fb53b5c871cd134f29e49dd7062f0)) +- attempt to make warning work on mobile ([7333e99](https://github.com/graasp/graasp-app-botticelli/commit/7333e99e25d4bcfe2aa23d03087412ac61ecbd2f)) +- **deps:** update dependency @emotion/styled to v11.11.5 ([ed3c6f1](https://github.com/graasp/graasp-app-botticelli/commit/ed3c6f1cb205b94e8063c18736541b6dbf4c162d)) +- **deps:** update dependency @graasp/apps-query-client to v3.4.10 ([ff23dbb](https://github.com/graasp/graasp-app-botticelli/commit/ff23dbb6b35c5d42ea5dc2de2aa8f89e3e4b8a4e)) +- **deps:** update dependency @graasp/sdk to v4.6.0 ([03c8d5f](https://github.com/graasp/graasp-app-botticelli/commit/03c8d5f45c19b5995be54ddc9d99b872c828cb3b)) +- **deps:** update dependency @graasp/sdk to v4.7.1 ([afd90bb](https://github.com/graasp/graasp-app-botticelli/commit/afd90bb6ee850a7290c45bb6b1fa2ce8dced000e)) +- **deps:** update dependency @types/react to v18.2.75 ([54c503e](https://github.com/graasp/graasp-app-botticelli/commit/54c503e35dc864f3b3f0d4e42fbee2e41f67d057)) +- **deps:** update dependency typescript to v5.4.4 ([ce757e6](https://github.com/graasp/graasp-app-botticelli/commit/ce757e6cc1b2303a6be614622a1e9cd77238e749)) +- **deps:** update dependency typescript to v5.4.5 ([7c24658](https://github.com/graasp/graasp-app-botticelli/commit/7c24658a953a2ecace3394dcd038871410fbf73c)) +- **deps:** update mui (non-major) ([d206f8d](https://github.com/graasp/graasp-app-botticelli/commit/d206f8daf8be8562a76f47208fe287e028191e1f)) +- **deps:** update react monorepo ([ed7e82a](https://github.com/graasp/graasp-app-botticelli/commit/ed7e82ad865b207b0a71a37d960b996bf7793af3)) +- **deps:** update react monorepo ([7fe3b03](https://github.com/graasp/graasp-app-botticelli/commit/7fe3b03771a347dc670816a6615c60d2c289b9a8)) +- fix player view test ([365ee8a](https://github.com/graasp/graasp-app-botticelli/commit/365ee8a0c79a1dd80b4742c148adae248809d250)) +- fix prompt builder helper ([c0f453a](https://github.com/graasp/graasp-app-botticelli/commit/c0f453a5be8a32773e16aaabf6c7a5079af79800)) +- fix size of instructions ([f12013d](https://github.com/graasp/graasp-app-botticelli/commit/f12013d6dee686e17b45cfc827309fb9525287af)) +- fix tests ([8955748](https://github.com/graasp/graasp-app-botticelli/commit/895574856d7b3dc53f096804fc89f273e9dd5cf2)) +- fix window access ([78b7519](https://github.com/graasp/graasp-app-botticelli/commit/78b7519f75149093773c82156ac675138d061226)) +- remove autoscrolling ([b6a1a06](https://github.com/graasp/graasp-app-botticelli/commit/b6a1a0615eba2b136515e41291af13826ca7df6e)) +- set status to idle after response ([6084db3](https://github.com/graasp/graasp-app-botticelli/commit/6084db3e483e2db3e7b18f3a232eb2a9b8bf903b)) +- update cues ([568ff8a](https://github.com/graasp/graasp-app-botticelli/commit/568ff8aec44dcd7e506850b5badc068ff8599490)) +- update text ([a34c545](https://github.com/graasp/graasp-app-botticelli/commit/a34c5459e78fb53b5c871cd134f29e49dd7062f0)) diff --git a/README.md b/README.md index 29de754..39833bf 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,4 @@ A version of Botticelli's participant interface that runs on the Graasp platform ### Credits -Uses Graasp's app template as a starter. \ No newline at end of file +Uses Graasp's app template as a starter. diff --git a/cypress/support/component-index.html b/cypress/support/component-index.html index e39ba42..faf3b5f 100644 --- a/cypress/support/component-index.html +++ b/cypress/support/component-index.html @@ -1,4 +1,4 @@ - +
diff --git a/renovate.json b/renovate.json index 61ad54a..c4f32b3 100644 --- a/renovate.json +++ b/renovate.json @@ -1,16 +1,23 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "github>graasp/renovate-config:app" - ], + "extends": ["github>graasp/renovate-config:app"], "packageRules": [ { "matchDepTypes": ["devDependencies"], - "matchPackagePatterns": ["lint", "prettier", "vite", "cypress", "commitlint", "axios", "concurrently", "env"], + "matchPackagePatterns": [ + "lint", + "prettier", + "vite", + "cypress", + "commitlint", + "axios", + "concurrently", + "env" + ], "automerge": true }, { - "matchUpdateTypes": ["minor","patch"], + "matchUpdateTypes": ["minor", "patch"], "matchCurrentVersion": "!/^0/", "automerge": true } diff --git a/src/config/appData.ts b/src/config/appData.ts deleted file mode 100644 index ca81b01..0000000 --- a/src/config/appData.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum AppDataTypes { - ParticipantComment = 'participant-comment', - AssistantComment = 'assistant-comment', -} diff --git a/src/config/appSettings.ts b/src/config/appSettings.ts new file mode 100644 index 0000000..d2a3096 --- /dev/null +++ b/src/config/appSettings.ts @@ -0,0 +1,28 @@ +import { UUID } from '@graasp/sdk'; + +import Agent from '@/types/Agent'; + +type AssistantSettings = Omit{JSON.stringify(appSettings, null, 2)}- ) : ( -
{JSON.stringify(appActions, null, 2)}- ) : ( -
{JSON.stringify(appDatas, null, 2)}-
{JSON.stringify(members, null, 2)}*/} - {/*