Skip to content

Commit 41468d3

Browse files
authored
fix: update graasp sdk (#330)
set model for assistants to GPT-4o update husky hooks to type-check build: improve concurrence of checks and tests also improve pre-commit hook build: label processes in test script
1 parent 9815a5b commit 41468d3

File tree

7 files changed

+150
-224
lines changed

7 files changed

+150
-224
lines changed

.husky/post-checkout

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
yarn pretty-quick --staged && yarn lint && yarn test
4+
yarn pre-commit

.husky/pre-push

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
yarn lint && yarn build
4+
yarn build

package.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"@codemirror/lang-javascript": "^6.2.1",
3030
"@emotion/react": "11.11.4",
3131
"@emotion/styled": "11.11.5",
32-
"@graasp/apps-query-client": "^3.4.11",
33-
"@graasp/sdk": "4.7.2",
32+
"@graasp/apps-query-client": "^3.4.14",
33+
"@graasp/sdk": "4.10.1",
3434
"@graasp/ui": "4.17.1",
3535
"@mui/icons-material": "5.15.17",
3636
"@mui/lab": "5.0.0-alpha.170",
@@ -63,17 +63,15 @@
6363
"build:test": "yarn vite build --mode test",
6464
"preview": "yarn vite preview",
6565
"preview:test": "yarn vite preview --mode test",
66-
"postinstall": "husky install",
66+
"postinstall": "husky",
6767
"lint": "eslint .",
6868
"prettier:write": "prettier {src,cypress}/**/*.{ts,tsx,js,jsx} --write",
6969
"prettier:check": "prettier {src,cypress}/**/*.{ts,tsx,js,jsx} --check",
7070
"type-check": "tsc --noEmit",
71-
"check": "yarn lint && yarn prettier:check && yarn type-check",
72-
"hooks:install": "husky install",
73-
"hooks:uninstall": "husky uninstall",
74-
"pre-commit": "yarn prettier:check && yarn lint",
71+
"check": "concurrently --kill-others-on-fail -s all -n \"type-check,linter,prettier\" \"yarn type-check\" \"yarn lint\" \"yarn prettier:check\"",
72+
"pre-commit": "concurrently --kill-others-on-fail -s all -n \"checks,tests\" \"yarn check\" \"yarn test\"",
7573
"cypress:open": "env-cmd -f ./.env.test cypress open",
76-
"test": "concurrently -k -s first \"yarn start:test\" \"yarn test:ci\" ",
74+
"test": "concurrently -k -s first -n \"test-server,cypress\" \"yarn start:test\" \"yarn test:ci\" ",
7775
"test:ci": "env-cmd -f ./.env.test cypress run --browser chrome --headless && nyc report --reporter=text --reporter=text-summary",
7876
"unit-tests": "vitest",
7977
"cov:report": "open ./coverage/lcov-report/index.html"

src/hooks/useAssistants.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChatbotRole } from '@graasp/sdk';
1+
import { ChatbotRole, GPTVersion } from '@graasp/sdk';
22

33
import { ChatbotResponseAppData, ResponseAppData } from '@/config/appDataTypes';
44
import {
@@ -36,7 +36,9 @@ interface UseAssistantsValues {
3636

3737
const useAssistants = (): UseAssistantsValues => {
3838
const { t } = useTranslation('prompts');
39-
const { mutateAsync: postChatBot } = mutations.usePostChatBot();
39+
const { mutateAsync: postChatBot } = mutations.usePostChatBot(
40+
GPTVersion.GPT_4_O, // TODO: Allow user to choose which model to use.
41+
);
4042
const {
4143
chatbot,
4244
instructions: generalPrompt,

src/mocks/db.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,41 @@ import type { Database, LocalContext } from '@graasp/apps-query-client';
22
import {
33
AppData,
44
AppDataVisibility,
5+
AppItemFactory,
56
CompleteMember,
67
Context,
7-
DiscriminatedItem,
88
ItemType,
9+
MemberFactory,
910
PermissionLevel,
1011
} from '@graasp/sdk';
1112

1213
import { API_HOST, PORT } from '@/config/env';
1314

15+
import { AppDataTypes } from '@/config/appDataTypes';
1416
import { buildMockResponses } from './mockResponses';
1517

1618
export const mockMembers: CompleteMember[] = [
17-
{
19+
MemberFactory({
1820
id: 'mock-member-id-1',
1921
name: 'I (current member)',
2022
21-
extra: {},
2223
type: 'individual',
2324
createdAt: new Date('1996-09-08T19:00:00').toISOString(),
2425
updatedAt: new Date().toISOString(),
2526
enableSaveActions: true,
26-
},
27-
{
27+
}),
28+
MemberFactory({
2829
id: 'mock-member-id-2',
2930
name: 'You',
3031
31-
extra: {},
3232
type: 'individual',
3333
createdAt: new Date('1995-02-02T15:00:00').toISOString(),
3434
updatedAt: new Date().toISOString(),
3535
enableSaveActions: true,
36-
},
36+
}),
3737
];
3838

39-
export const mockItem: DiscriminatedItem = {
39+
export const mockItem = AppItemFactory({
4040
id: '1234-1234-1234-5678',
4141
name: 'app-collaborative-ideation',
4242
displayName: 'App Collaborative Ideation',
@@ -53,7 +53,7 @@ export const mockItem: DiscriminatedItem = {
5353
url: `http://localhost:${PORT}`,
5454
},
5555
},
56-
};
56+
});
5757

5858
const mockResponses = buildMockResponses(mockItem, mockMembers);
5959

@@ -63,7 +63,7 @@ const mockAppData: AppData[] = [
6363
id: '3',
6464
item: mockItem,
6565
creator: mockMembers[0],
66-
type: 'idea-set',
66+
type: AppDataTypes.ResponsesSet,
6767
member: mockMembers[0],
6868
visibility: AppDataVisibility.Member,
6969
createdAt: new Date().toISOString(),

0 commit comments

Comments
 (0)