Skip to content

Commit 993b960

Browse files
authored
fix: issues with interface (#304)
* fix: issues with interface * fix: make requested changes
1 parent 5ba1bde commit 993b960

File tree

15 files changed

+420
-366
lines changed

15 files changed

+420
-366
lines changed

eslint.config.mjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ export default [
5656
globals: {
5757
...globals.browser,
5858
...globals.node,
59-
...globals.mocha,
60-
...globals.jest,
6159
cy: true,
6260
Cypress: true,
6361
},
@@ -155,9 +153,9 @@ export default [
155153
],
156154

157155
'react/function-component-definition': [
158-
2,
156+
'error',
159157
{
160-
namedComponents: 'arrow-function',
158+
namedComponents: ['function-declaration', 'arrow-function'],
161159
},
162160
],
163161

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
"vite": "6.3.5",
113113
"vite-plugin-checker": "0.9.3",
114114
"vite-plugin-istanbul": "7.0.0",
115+
"vite-tsconfig-paths": "5.1.4",
115116
"vitest": "3.2.3"
116117
},
117118
"browserslist": {

src/config/appSetting.ts

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

33
export const SettingsKeys = {
44
ChatbotPrompt: 'chatbot-prompt',
@@ -19,7 +19,7 @@ export type ChatbotPromptSettings = {
1919
[ChatbotPromptSettingsKeys.InitialPrompt]: ChatBotMessage[];
2020
[ChatbotPromptSettingsKeys.ChatbotCue]: string;
2121
[ChatbotPromptSettingsKeys.ChatbotName]: string;
22-
[ChatbotPromptSettingsKeys.GptVersion]?: GPTVersion;
22+
[ChatbotPromptSettingsKeys.GptVersion]?: string;
2323
// used to allow access using settings[settingKey] syntax
2424
// [key: string]: unknown;
2525
};

src/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import { GPTVersion } from '@graasp/sdk';
2+
13
export const DEFAULT_BOT_USERNAME = 'Graasp Bot';
4+
export const DEFAULT_MODEL_VERSION = GPTVersion.GPT_3_5_TURBO;
25
export const ANONYMOUS_USER = 'Anonymous';
36

47
// UI

src/langs/en.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424
"CHATBOT_NAME_LABEL": "Chatbot Name",
2525
"CHATBOT_NAME_HELPER": "This is the name that users will see when they interact with the chatbot",
2626
"CHATBOT_NAME_DEFAULT_MESSAGE": "by default",
27+
"CHATBOT_VERSION_DEFAULT_MESSAGE": "by default",
2728
"CHATBOT_PROMPT_LABEL": "Chatbot Prompt",
2829
"CHATBOT_PROMPT_HELPER_LABEL": "In-depth technical description",
29-
"CHATBOT_PROMPT_HELPER": "This is the name that users will see when they interact with the chatbot",
30+
"CHATBOT_PROMPT_HELPER": "This is a collection of examples of interactions that define the chatbot's personality.",
3031
"CHATBOT_PROMPT_FORMAT_HELPER": "To describe the initial situation, create an object at the start of the array with 2 keys: 'role' and 'content'. For the initial description the role must be 'system'. Place your description of the initial situation in the 'content' key. Add interaction examples after that. Add one object per message with the role corresponding to either 'assistant' or 'user'.",
3132
"CHATBOT_PROMPT_FORMAT_EXAMPLE": "Here is an example",
3233
"CHATBOT_PROMPT_API_REFERENCE": "See the API reference",
@@ -66,7 +67,7 @@
6667
"GPT_3_5_TURBO_DESCRIPTION": "Optimized for speed and efficiency, suitable for applications where quick interactions are needed.",
6768
"GPT_4_DESCRIPTION": "Features deeper learning and more comprehensive knowledge, ideal for content creation and technical support.",
6869
"GPT_4_TURBO_DESCRIPTION": "Combines the depth of GPT-4 with enhanced speed, perfect for high-demand scenarios.",
69-
"CHATBOT_MODEL_VERSION_HELPER": "This defines gpt version used within the model, default version is gpt-3.5-turbo-0125.",
70+
"CHATBOT_MODEL_VERSION_HELPER": "This defines the model that will be used. The default is: {{default}}.",
7071
"RECOMMENDED": "Recommended"
7172
}
7273
}

src/modules/common/ChatbotPrompt.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
buildPrompt,
99
useLocalContext,
1010
} from '@graasp/apps-query-client';
11-
import { UUID } from '@graasp/sdk';
11+
import { GPTVersion, UUID } from '@graasp/sdk';
1212

1313
import { AppActionsType } from '@/config/appActions';
1414
import { AppDataTypes, CommentData } from '@/config/appData';
@@ -51,7 +51,7 @@ const ChatbotPrompt = ({ id }: Props): JSX.Element | null => {
5151
const chatbotPrompt = chatbotPrompts?.[0];
5252

5353
const { mutateAsync: postChatBot } = mutations.usePostChatBot(
54-
chatbotPrompt?.data?.gptVersion,
54+
chatbotPrompt?.data?.gptVersion as GPTVersion,
5555
);
5656

5757
const { data: generalSettings } = hooks.useAppSettings<GeneralSettings>({

src/modules/common/CommentEditor.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
} from 'lucide-react';
2929

3030
import { CommentAppData } from '@/config/appData';
31-
// import { DEFAULT_MAX_COMMENT_LENGTH_SETTING } from '@/config/appSetting';
3231
import {
3332
COMMENT_EDITOR_BOLD_BUTTON_CYPRESS,
3433
COMMENT_EDITOR_CANCEL_BUTTON_CYPRESS,

src/modules/common/CommentThread.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from '@mui/material';
1111

1212
import { ChatbotThreadMessage, buildPrompt } from '@graasp/apps-query-client';
13+
import { GPTVersion } from '@graasp/sdk';
1314

1415
import { AppActionsType } from '@/config/appActions';
1516
import { AppDataTypes, CommentAppData } from '@/config/appData';
@@ -19,8 +20,6 @@ import {
1920
GeneralSettings,
2021
SettingsKeys,
2122
} from '@/config/appSetting';
22-
// import { DEFAULT_GENERAL_SETTINGS } from '@/config/settings';
23-
// import { GENERAL_SETTINGS_NAME } from '@/config/appSettings';
2423
import { hooks, mutations } from '@/config/queryClient';
2524
import { COMMENT_THREAD_CONTAINER_CYPRESS } from '@/config/selectors';
2625
import { buildThread } from '@/utils/comments';
@@ -68,7 +67,7 @@ const CommentThread = ({ children, threadSx }: Props): JSX.Element | null => {
6867
const chatbotPrompt = chatbotPrompts?.[0];
6968

7069
const { mutateAsync: postChatbot, isLoading } = mutations.usePostChatBot(
71-
chatbotPrompt?.data?.gptVersion,
70+
chatbotPrompt?.data?.gptVersion as GPTVersion,
7271
);
7372

7473
const { data: generalSettings } = hooks.useAppSettings<GeneralSettings>({

0 commit comments

Comments
 (0)