Skip to content

Commit 18066fd

Browse files
authored
fix: add comment component and upgrade models (#308)
1 parent 205fccc commit 18066fd

Some content is hidden

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

42 files changed

+601
-231
lines changed

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export default [
132132
'error',
133133
{
134134
allowExpressions: true,
135+
allowFunctionsWithoutTypeParameters: true,
135136
allowHigherOrderFunctions: true,
136137
allowTypedFunctionExpressions: true,
137138
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@emotion/react": "11.14.0",
1616
"@emotion/styled": "11.14.0",
1717
"@graasp/apps-query-client": "3.7.5",
18-
"@graasp/sdk": "5.13.3",
18+
"@graasp/sdk": "github:graasp/graasp-sdk#add-chatbot-export",
1919
"@graasp/ui": "5.5.4",
2020
"@mui/icons-material": "6.4.12",
2121
"@mui/lab": "6.0.0-dev.240424162023-9968b4889d",

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { GPTVersion } from '@graasp/sdk';
22

33
export const DEFAULT_BOT_USERNAME = 'Graasp Bot';
4-
export const DEFAULT_MODEL_VERSION = GPTVersion.GPT_3_5_TURBO;
4+
export const DEFAULT_MODEL_VERSION = GPTVersion.GPT_4_O_MINI;
55
export const ANONYMOUS_USER = 'Anonymous';
66

77
// UI

src/langs/en.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@
6464
"SEARCH_BY_OTHER_KEYWORDS": "Search by other keywords or regex",
6565
"CHECK_WHOLE_CHAT": "Check the whole chat",
6666
"MODEL_VERSION": "Model version",
67-
"GPT_3_5_TURBO_DESCRIPTION": "Optimized for speed and efficiency, suitable for applications where quick interactions are needed.",
67+
"GPT_3_5_TURBO_DESCRIPTION": "Best for basic chat and non-chat tasks where legacy compatibility is needed",
6868
"GPT_4_DESCRIPTION": "Features deeper learning and more comprehensive knowledge, ideal for content creation and technical support.",
69-
"GPT_4_TURBO_DESCRIPTION": "Combines the depth of GPT-4 with enhanced speed, perfect for high-demand scenarios.",
69+
"GPT_4_TURBO_DESCRIPTION": "Best for high-intelligence tasks where you want a proven, older flagship model",
70+
"GPT_4_1_NANO_DESCRIPTION": "Best for ultra-fast tasks where average intelligence is sufficient",
71+
"GPT_4_O_DESCRIPTION": "Best for high-intelligence, versatile applications requiring top performance and flexibility",
72+
"GPT_4_O_MINI_DESCRIPTION": "Best for fast, focused tasks where efficiency matters most",
7073
"CHATBOT_MODEL_VERSION_HELPER": "This defines the model that will be used. The default is: {{default}}.",
7174
"RECOMMENDED": "Recommended"
7275
}

src/modules/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import AnalyticsView from './main/AnalyticsView';
88
import BuilderView from './main/BuilderView';
99
import PlayerView from './main/PlayerView';
1010

11-
const App = (): JSX.Element => {
11+
function App(): JSX.Element {
1212
const context = useLocalContext();
1313

1414
useEffect(() => {
@@ -30,6 +30,6 @@ const App = (): JSX.Element => {
3030
default:
3131
return <PlayerView />;
3232
}
33-
};
33+
}
3434

3535
export default App;

src/modules/Root.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { FC } from 'react';
21
import { I18nextProvider } from 'react-i18next';
32
import { ToastContainer } from 'react-toastify';
43

@@ -70,7 +69,7 @@ const RootDiv = styled('div')({
7069
height: '100%',
7170
});
7271

73-
const Root: FC = () => {
72+
function Root() {
7473
const [mockContext, setMockContext] = useObjectState(defaultMockContext);
7574

7675
return (
@@ -121,6 +120,6 @@ const Root: FC = () => {
121120
</StyledEngineProvider>
122121
</RootDiv>
123122
);
124-
};
123+
}
125124

126125
export default Root;

src/modules/analytics/FrequentWords.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ type Props = {
2929
allWords: { [key: string]: number };
3030
};
3131

32-
const FrequentWords = ({
32+
function FrequentWords({
3333
commentsByUserSide,
3434
allWords,
35-
}: Props): JSX.Element => {
35+
}: Readonly<Props>): JSX.Element {
3636
const { t } = useTranslation();
3737

3838
const mostFrequentWordsWithCount = getTopFrequentWords(allWords, 5);
@@ -162,6 +162,6 @@ const FrequentWords = ({
162162
</Grid2>
163163
</Stack>
164164
);
165-
};
165+
}
166166

167167
export default FrequentWords;

src/modules/analytics/StatisticCard.tsx

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,28 @@ type Props = {
77
id?: string;
88
};
99

10-
const StatisticCard = ({ icon, title, children, id }: Props): JSX.Element => (
11-
<Stack
12-
height="100%"
13-
component={Paper}
14-
p={2}
15-
variant="outlined"
16-
direction="row"
17-
alignItems="center"
18-
id={id}
19-
>
20-
{icon}
21-
<Stack flexGrow={1} direction="column" alignItems="center">
22-
<Typography align="center">{title}</Typography>
23-
{children}
10+
function StatisticCard({
11+
icon,
12+
title,
13+
children,
14+
id,
15+
}: Readonly<Props>): JSX.Element {
16+
return (
17+
<Stack
18+
height="100%"
19+
component={Paper}
20+
p={2}
21+
variant="outlined"
22+
direction="row"
23+
alignItems="center"
24+
id={id}
25+
>
26+
{icon}
27+
<Stack flexGrow={1} direction="column" alignItems="center">
28+
<Typography align="center">{title}</Typography>
29+
{children}
30+
</Stack>
2431
</Stack>
25-
</Stack>
26-
);
32+
);
33+
}
2734
export default StatisticCard;

src/modules/analytics/WordCloud.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ type Props = {
99
open: boolean;
1010
onClose: () => void;
1111
};
12-
const WordCloud = ({ wordCounts, open, onClose }: Props): JSX.Element => {
12+
function WordCloud({
13+
wordCounts,
14+
open,
15+
onClose,
16+
}: Readonly<Props>): JSX.Element {
1317
const words = Object.entries(wordCounts).map(([text, value]) => ({
1418
text,
1519
value,
@@ -26,6 +30,6 @@ const WordCloud = ({ wordCounts, open, onClose }: Props): JSX.Element => {
2630
<ReactWordcloud words={words} options={options} size={[600, 400]} />
2731
</Dialog>
2832
);
29-
};
33+
}
3034

3135
export default WordCloud;

src/modules/comment/ToolbarButton.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ForwardRefRenderFunction, PropsWithChildren, forwardRef } from 'react';
1+
import { ForwardedRef, PropsWithChildren, forwardRef } from 'react';
22

33
import { Button } from '@mui/material';
44

@@ -8,10 +8,7 @@ type Props = {
88
disabled?: boolean;
99
};
1010

11-
const ToolbarButton: ForwardRefRenderFunction<
12-
HTMLButtonElement,
13-
PropsWithChildren<Props>
14-
> = (props, ref) => {
11+
function ToolbarButton(props: Props, ref: ForwardedRef<HTMLButtonElement>) {
1512
// structure the custom props from the other ones given by the tooltip
1613
const { dataCy, onClick, disabled, ...otherProps } = props;
1714
return (
@@ -32,7 +29,7 @@ const ToolbarButton: ForwardRefRenderFunction<
3229
onClick={onClick}
3330
/>
3431
);
35-
};
32+
}
3633

3734
export default forwardRef<HTMLButtonElement, PropsWithChildren<Props>>(
3835
ToolbarButton,

0 commit comments

Comments
 (0)