Skip to content

Commit 855214b

Browse files
authored
feat: implement virtual agent
connect to GPT models via Graasp backend to enhance ideation feat: chatbot hook for generating single answer fix: improve chatbot config fix: sending set to correct member refactor: activity context bases for assistants implementation chore(deps): minor upgrade deps docs(README): add sonor cloud badges feat(settings): set assistants feat: generate responses with chatbot work in progress, still requires some testing ci: fix worflows ci: fix workflows change aws-region var refactor: use hooks to get responses refactor(settings): all settings and corresponding view BREAKING CHANGE: settings definition has changed fix(settings): save assistants fix(settings): check for assistants modifs chore: idea -> response feat: display version in settings fix: likert scale fix: translate ratings fix: save assistants after edit fix(deps): upgrade deps chore(deps): minor deps updates fix: type problems with AppData rollback to sdk 3.6.0
1 parent 81ab3b1 commit 855214b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+4074
-2590
lines changed

.github/workflows/deploy-dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ jobs:
4444
version: 'latest'
4545
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }}
4646
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }}
47-
aws-region: ${{ secrets.APPS_AWS_REGION }}
48-
aws-s3-bucket-name: ${{ secrets.AWS_S3_BUCKET_NAME_APPS_DEV }}
47+
aws-region: ${{ vars.APPS_AWS_REGION_DEV }}
48+
aws-s3-bucket-name: ${{ vars.AWS_S3_BUCKET_NAME_APPS_DEV }}
4949
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_APPS_DEV }}

.github/workflows/deploy-prod.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ jobs:
4242
version: 'latest'
4343
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }}
4444
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
45-
aws-region: ${{ secrets.APPS_AWS_REGION }}
46-
aws-s3-bucket-name: ${{ secrets.AWS_S3_BUCKET_NAME_APPS_PROD }}
45+
aws-region: ${{ vars.APPS_AWS_REGION_PROD }}
46+
aws-s3-bucket-name: ${{ vars.AWS_S3_BUCKET_NAME_APPS_PROD }}
4747
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_APPS_PROD }}

.github/workflows/deploy-stage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ jobs:
4242
version: 'latest'
4343
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGE }}
4444
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGE }}
45-
aws-region: ${{ secrets.APPS_AWS_REGION }}
46-
aws-s3-bucket-name: ${{ secrets.AWS_S3_BUCKET_NAME_APPS_STAGE }}
45+
aws-region: ${{ vars.APPS_AWS_REGION_STAGE }}
46+
aws-s3-bucket-name: ${{ vars.AWS_S3_BUCKET_NAME_APPS_STAGE }}
4747
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_APPS_STAGE }}
Lines changed: 336 additions & 336 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ enableGlobalCache: false
44

55
nodeLinker: node-modules
66

7-
yarnPath: .yarn/releases/yarn-4.0.2.cjs
7+
yarnPath: .yarn/releases/yarn-4.1.0.cjs

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88

99
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)
1010

11+
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=graasp_graasp-app-collaborative-ideation&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=graasp_graasp-app-collaborative-ideation)
12+
13+
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=graasp_graasp-app-collaborative-ideation&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=graasp_graasp-app-collaborative-ideation)
14+
15+
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=graasp_graasp-app-collaborative-ideation&metric=bugs)](https://sonarcloud.io/summary/new_code?id=graasp_graasp-app-collaborative-ideation)
16+
17+
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=graasp_graasp-app-collaborative-ideation&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=graasp_graasp-app-collaborative-ideation)
18+
1119
# Development
1220

1321
## Installation

package.json

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,29 @@
2323
"homepage": ".",
2424
"type": "module",
2525
"dependencies": {
26+
"@codemirror/lang-javascript": "^6.2.1",
2627
"@emotion/react": "11.11.3",
2728
"@emotion/styled": "11.11.0",
2829
"@graasp/apps-query-client": "3.4.1",
29-
"@graasp/sdk": "3.4.0",
30-
"@mui/icons-material": "5.15.4",
31-
"@mui/lab": "5.0.0-alpha.160",
32-
"@mui/material": "5.15.4",
33-
"@mui/x-data-grid": "^6.18.7",
34-
"@sentry/react": "7.93.0",
30+
"@graasp/sdk": "3.6.0",
31+
"@mui/icons-material": "5.15.7",
32+
"@mui/lab": "5.0.0-alpha.163",
33+
"@mui/material": "5.15.7",
34+
"@mui/x-data-grid": "^6.19.3",
35+
"@sentry/react": "7.99.0",
3536
"@tanstack/react-query": "^4.36.1",
3637
"@tanstack/react-query-devtools": "^4.36.1",
37-
"i18next": "23.7.16",
38+
"@uiw/react-codemirror": "^4.21.21",
39+
"i18next": "23.8.2",
3840
"lodash.isequal": "^4.5.0",
3941
"lodash.shuffle": "^4.2.0",
40-
"plotly.js": "^2.28.0",
42+
"plotly.js": "^2.29.0",
4143
"qs": "6.11.2",
4244
"react": "18.2.0",
4345
"react-dom": "18.2.0",
44-
"react-i18next": "13.5.0",
46+
"react-i18next": "14.0.3",
4547
"react-plotly.js": "^2.6.0",
46-
"react-router-dom": "^6.21.2",
48+
"react-router-dom": "^6.22.0",
4749
"typescript": "5.3.3"
4850
},
4951
"scripts": {
@@ -70,27 +72,27 @@
7072
"cov:report": "open ./coverage/lcov-report/index.html"
7173
},
7274
"devDependencies": {
73-
"@commitlint/cli": "18.4.4",
74-
"@commitlint/config-conventional": "18.4.4",
75-
"@commitlint/types": "^18.4.4",
76-
"@cypress/code-coverage": "3.12.18",
75+
"@commitlint/cli": "18.6.0",
76+
"@commitlint/config-conventional": "18.6.0",
77+
"@commitlint/types": "^18.6.0",
78+
"@cypress/code-coverage": "3.12.19",
7779
"@trivago/prettier-plugin-sort-imports": "4.3.0",
7880
"@types/d3": "^7.4.3",
7981
"@types/i18n": "0.13.10",
8082
"@types/lodash.clonedeep": "^4.5.9",
8183
"@types/lodash.isequal": "^4.5.8",
8284
"@types/lodash.shuffle": "^4.2.9",
83-
"@types/node": "20.11.3",
84-
"@types/react": "18.2.48",
85+
"@types/node": "20.11.16",
86+
"@types/react": "18.2.53",
8587
"@types/react-dom": "18.2.18",
8688
"@types/react-plotly.js": "^2.6.3",
87-
"@types/uuid": "9.0.7",
88-
"@typescript-eslint/eslint-plugin": "6.19.0",
89-
"@typescript-eslint/parser": "6.19.0",
89+
"@types/uuid": "9.0.8",
90+
"@typescript-eslint/eslint-plugin": "6.20.0",
91+
"@typescript-eslint/parser": "6.20.0",
9092
"@vitejs/plugin-react": "^4.2.1",
91-
"@vitest/browser": "^1.2.0",
93+
"@vitest/browser": "^1.2.2",
9294
"concurrently": "8.2.2",
93-
"cypress": "13.6.2",
95+
"cypress": "13.6.4",
9496
"env-cmd": "10.1.0",
9597
"eslint": "8.56.0",
9698
"eslint-config-airbnb": "19.0.4",
@@ -103,19 +105,19 @@
103105
"eslint-plugin-prettier": "4.2.1",
104106
"eslint-plugin-react": "^7.33.2",
105107
"eslint-plugin-react-hooks": "4.6.0",
106-
"husky": "8.0.3",
107-
"jsdom": "^23.2.0",
108+
"husky": "9.0.10",
109+
"jsdom": "^24.0.0",
108110
"lodash.clonedeep": "^4.5.0",
109111
"miragejs": "^0.1.48",
110112
"nyc": "15.1.0",
111113
"prettier": "2.8.8",
112-
"pretty-quick": "3.1.3",
114+
"pretty-quick": "3.3.1",
113115
"stylis-plugin-rtl": "^2.1.1",
114-
"uuid": "9.0.1",
115-
"vite": "^5.0.11",
116-
"vite-plugin-checker": "^0.6.2",
116+
"uuid": "^9.0.1",
117+
"vite": "^5.0.12",
118+
"vite-plugin-checker": "^0.6.4",
117119
"vite-plugin-istanbul": "^5.0.0",
118-
"vitest": "^1.2.0"
120+
"vitest": "^1.2.2"
119121
},
120122
"browserslist": {
121123
"production": [
@@ -139,5 +141,5 @@
139141
"src/**/*.test.ts"
140142
]
141143
},
142-
"packageManager": "yarn@4.0.2"
144+
"packageManager": "yarn@4.1.0"
143145
}
Lines changed: 1 addition & 0 deletions
Loading

src/config/appDataTypes.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { AppData, AppDataVisibility } from '@graasp/sdk';
22

3+
import { AssistantId } from '@/interfaces/assistant';
4+
import { ChatbotResponseData } from '@/interfaces/chatbot';
35
import { ActivityStatus, ActivityType } from '@/interfaces/interactionProcess';
46
import { NoveltyRelevanceRatings } from '@/interfaces/ratings';
57

@@ -8,6 +10,7 @@ export enum AppDataTypes {
810
ResponsesSet = 'responses-set',
911
CurrentState = 'current-state',
1012
Ratings = 'ratings',
13+
ChatbotResponse = 'chatbot-response',
1114
}
1215

1316
export type ResponseData<T = NoveltyRelevanceRatings> = {
@@ -35,6 +38,7 @@ export type ResponsesSetAppData = AppData & {
3538
data: {
3639
round: number;
3740
responses: ResponsesData;
41+
assistant?: AssistantId;
3842
};
3943
};
4044

@@ -59,3 +63,9 @@ export type RatingsAppData<T> = AppData & {
5963
data: RatingsData<T>;
6064
visibility: AppDataVisibility.Member;
6165
};
66+
67+
export type ChatbotResponseAppData = AppData & {
68+
type: AppDataTypes.ChatbotResponse;
69+
data: ChatbotResponseData;
70+
visibility: AppDataVisibility.Member;
71+
};

src/config/appSettingsType.ts

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { AssistantPersona } from '@/interfaces/assistant';
2+
import { EvaluationType } from '@/interfaces/evaluationType';
3+
import { ResponseVisibilityMode } from '@/interfaces/interactionProcess';
4+
5+
import { DEFAULT_SYSTEM_PROMPT } from './prompts';
6+
7+
type InstructionType = 'html' | 'markdown' | 'plain-text';
8+
9+
export type InstructionsSetting = {
10+
title: {
11+
content: string;
12+
type: InstructionType;
13+
};
14+
details?: {
15+
content: string;
16+
type: InstructionType;
17+
};
18+
};
19+
20+
export type OrchestratorSetting = {
21+
id: string;
22+
};
23+
24+
export type ActivitySetting = {
25+
mode: ResponseVisibilityMode;
26+
numberOfResponsesPerSet: number;
27+
numberOfBotResponsesPerSet: number;
28+
exclusiveResponseDistribution: boolean;
29+
evaluationType: EvaluationType;
30+
};
31+
32+
export type AssistantsSetting = {
33+
assistants: AssistantPersona[];
34+
};
35+
36+
export type AllSettingsType = {
37+
instructions: InstructionsSetting;
38+
orchestrator: OrchestratorSetting;
39+
activity: ActivitySetting;
40+
notParticipating: { ids: string[] };
41+
chatbot: {
42+
systemPrompt: string;
43+
};
44+
assistants: AssistantsSetting;
45+
};
46+
47+
// default values for the data property of settings by name
48+
export const defaultSettingsValues: AllSettingsType = {
49+
instructions: {
50+
title: {
51+
content: '',
52+
type: 'plain-text',
53+
},
54+
},
55+
orchestrator: {
56+
id: '',
57+
},
58+
activity: {
59+
mode: ResponseVisibilityMode.Open,
60+
numberOfResponsesPerSet: 3,
61+
numberOfBotResponsesPerSet: 1,
62+
exclusiveResponseDistribution: true,
63+
evaluationType: EvaluationType.NoveltyRelevanceRatings,
64+
},
65+
notParticipating: { ids: [] },
66+
chatbot: {
67+
systemPrompt: DEFAULT_SYSTEM_PROMPT,
68+
},
69+
assistants: {
70+
assistants: [],
71+
},
72+
};

0 commit comments

Comments
 (0)