Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12,857 changes: 7,754 additions & 5,103 deletions frontend/package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
"@types/node": "^12.0.0",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
"@types/react-router-dom": "^5.1.8",
"@uiw/react-md-editor": "^3.23.5",
"axios": "^0.21.4",
"chakra-ui-markdown-renderer": "^4.1.0",
"classnames": "^2.5.1",
"country-code-emoji": "^2.3.0",
"date-fns": "^2.28.0",
"formik": "^2.2.9",
Expand Down Expand Up @@ -65,8 +67,5 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/react-router-dom": "^5.1.8"
}
}
5 changes: 2 additions & 3 deletions frontend/src/components/ChatBot/ChatBot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const getMessageClassName = (type: string) => {
return 'chat-message user'
}
}
const getMessageStyle = (type: string, customStyle) => {
const getMessageStyle = (type: string, customStyle: { backgroundColor: any; fontColor: any; }) => {
if(type === 'bot') {
return {}
} else if(type === 'bot-error') {
Expand All @@ -48,7 +48,7 @@ export const ChatBot = ({
showCloseButton = true,
showLauncher = true,
height = '520px',
}) => {
}: ChatBotProps) => {

const user = CurrentUser.get();

Expand Down Expand Up @@ -84,7 +84,6 @@ export const ChatBot = ({
setQuestion(e.target.value)
}, []);


const handleSubmit = React.useCallback(async (e) => {


Expand Down
5 changes: 3 additions & 2 deletions frontend/src/services/authServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { baseURL } from '../config';
export async function signUp(payload: {
email: string;
password: string;
confirmPassword: string;
}): Promise<AxiosResponse<SignUp>> {
return await axios({
baseURL: baseURL,
Expand All @@ -13,7 +14,7 @@ export async function signUp(payload: {
});
}
export async function logIn(payload: {
email: string;
username: string;
password: string;
}): Promise<AxiosResponse<SignUp>> {
return await axios({
Expand All @@ -32,4 +33,4 @@ export async function authGoogle(payload: {
url: '/auth/google_auth',
data: payload,
});
}
}
2 changes: 1 addition & 1 deletion frontend/src/types/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export interface SignUp {
token: string;
access: string;
}
4 changes: 2 additions & 2 deletions src/knowledgebase/chatbot/openaiChatbotService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export class OpenaiChatbotService {
const answer = await this.openaiService.getChatGptCompletion(
{
messages: messages as any,
temperature: 0.1,
temperature: 1,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Increasing the temperature to 1 will make the chatbot's responses highly random and non-deterministic. For a knowledge-based chatbot that should provide factual and consistent answers, a lower temperature (close to 0) is generally recommended. Please consider if this change is intended, as it will significantly alter the chatbot's behavior.

Suggested change
temperature: 1,
temperature: 0.1,

frequency_penalty: 0,
presence_penalty: 0,
top_p: 1,
Expand Down Expand Up @@ -401,7 +401,7 @@ export class OpenaiChatbotService {
const answerStream = await this.openaiService.getChatGptCompletionStream(
{
messages: messages,
temperature: 0,
temperature: 1,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Similar to the non-streaming version, increasing the temperature to 1 for the streaming response will make the output less predictable. For consistent and factual answers from the knowledge base, a lower temperature is advisable.

Suggested change
temperature: 1,
temperature: 0,

frequency_penalty: 0,
presence_penalty: 0,
stream: true,
Expand Down
6 changes: 3 additions & 3 deletions src/openai/openai.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export class OpenaiService {
data: OpenAI.Chat.ChatCompletionCreateParams,
openAiClient: OpenAI,
): Promise<string> {
const input = JSON.stringify(data.messages.slice(1))
const input = JSON.stringify(data.messages.slice(1));
const prompt = `
The chat history is: "${input}".
Determine whether any content in the chat history relates to package tracking or tracking numbers (e.g., questions about shipments, delivery, or tracking numbers) or address (e.g., questions about pickup address relative to user address).
Expand All @@ -177,7 +177,7 @@ export class OpenaiService {
const response = await openAiClient.chat.completions.create({
model: data.model, // Or use another model
messages: [{ role: 'system', content: prompt }],
temperature: 0, // To make the response more deterministic
temperature: 1, // To make the response more deterministic
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Increasing the temperature to 1 for analyzeChatConversation will make the analysis of user input less deterministic. This can lead to unpredictable behavior in how the system categorizes user intent and triggers API calls. For a function that requires predictable classification, a temperature of 0 is strongly recommended.

Suggested change
temperature: 1, // To make the response more deterministic
temperature: 0, // To make the response more deterministic

});

const result = response.choices[0]?.message?.content?.trim();
Expand Down Expand Up @@ -267,7 +267,7 @@ export class OpenaiService {

async implementApiCalls(
analyzedInput: string,
data: OpenAI.Chat.ChatCompletionCreateParams
data: OpenAI.Chat.ChatCompletionCreateParams,
) {
const addressObject = this.getAddress(analyzedInput);
const pakkeshopData = await this.fetchPakkeshopInformation(addressObject);
Expand Down