diff --git a/src/layouts/components/main-layout-header-bar.vue b/src/layouts/components/main-layout-header-bar.vue
index 01af21c..5ad6d39 100644
--- a/src/layouts/components/main-layout-header-bar.vue
+++ b/src/layouts/components/main-layout-header-bar.vue
@@ -3,14 +3,8 @@
setup
>
import { useUiStore } from 'src/stores/ui-store';
- import { useAuthStore } from 'src/stores/auth-store';
- import { useChatbotStore } from 'src/stores/chatbot-store';
-
- // import HeaderBarNotification from './main-layout-header-bar-notification.vue';
const uiStore = useUiStore();
- const chatbot_store = useChatbotStore();
- const auth_store = useAuthStore();
@@ -37,19 +31,6 @@
/>
-
-
-
-
-
diff --git a/src/layouts/main-layout.vue b/src/layouts/main-layout.vue
index 67c31b3..4ae920f 100644
--- a/src/layouts/main-layout.vue
+++ b/src/layouts/main-layout.vue
@@ -37,7 +37,7 @@
-
+
diff --git a/src/modules/chatbot/components/chatbot-drawer.vue b/src/modules/chatbot/components/chatbot-drawer.vue
index 59ea63f..380c991 100644
--- a/src/modules/chatbot/components/chatbot-drawer.vue
+++ b/src/modules/chatbot/components/chatbot-drawer.vue
@@ -12,10 +12,13 @@
const chatbot_store = useChatbotStore();
const text = ref('');
+ const is_showing_right_drawer = ref(true);
+ const drawer_width = ref(85);
const handleSend = async () => {
const message = text.value.trim();
text.value = '';
+ console.log('message: ', message, ', length: ', message.length);
await chatbot_api.sendMessage(message);
};
@@ -26,53 +29,79 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/modules/chatbot/components/dialogue-content.vue b/src/modules/chatbot/components/dialogue-content.vue
index 53a6993..f9f80dd 100644
--- a/src/modules/chatbot/components/dialogue-content.vue
+++ b/src/modules/chatbot/components/dialogue-content.vue
@@ -20,11 +20,11 @@
-
+
import { computed } from 'vue';
- import MarkdownIt from 'markdown-it'
+ // import MarkdownIt from 'markdown-it'
import { useAuthStore } from 'src/stores/auth-store';
import type { Message } from 'src/modules/chatbot/models/dialogue-message.model';
import { useI18n } from 'vue-i18n';
@@ -15,41 +15,73 @@
message: Message;
}>();
+ const message_text = computed(() => message.text.includes('chatbot.') ? t(message.text) : message.text)
+
+ const is_error = computed(() => message.text.includes('NO_REPLY_RECEIVED') || message.text.includes('SEND_MESSAGE_FAILED'));
+
// Initialize Markdown parser
- const md = new MarkdownIt({
- breaks: false, // Support line breaks
- linkify: true, // Make URLs clickable
- html: false // Prevent raw HTML injection
- })
+ // const md = new MarkdownIt({
+ // // breaks: false, // Support line breaks
+ // linkify: true, // Make URLs clickable
+ // html: false // Prevent raw HTML injection
+ // })
- // Removes all the h1,h2,h3 to make the Md more user friendly
- const cleanMarkdown = (markdown: string): string => {
- if (!markdown) return ''
- return markdown
- .replace(/\r\n/g, '\n') // normalize Windows line endings
- .replace(/([.!?])(\s+)(?=[A-Z])/g, '$1\n') // insert line break after sentence-ending punctuation
- .replace(/\n{3,}/g, '\n\n') // squash triple+ line breaks
- .replace(/^#{1,3}\s(.*)$/gm, '#### $1') // downgrade headings
- }
+ // // Removes all the h1,h2,h3 to make the Md more user friendly
+ // const cleanMarkdown = (markdown: string): string => {
+ // if (!markdown) return ''
+ // return markdown
+ // .replace(/\r\n/g, '\n') // normalize Windows line endings
+ // .replace(/([.!?])(\s+)(?=[A-Z])/g, '$1\n') // insert line break after sentence-ending punctuation
+ // .replace(/\n{3,}/g, '\n\n') // squash triple+ line breaks
+ // .replace(/^#{1,3}\s(.*)$/gm, '#### $1') // downgrade headings
+ // }
- // Compute parsed content
- const parsedText = computed((): string => {
- const cleaned = cleanMarkdown(message.text || '')
- if (cleaned.includes('chatbot.')) {
- const translated_message = t(message.text);
- return md.render(translated_message);
- }
- return md.render(cleaned);
- })
+ // // Compute parsed content
+ // const parsedText = computed((): string => {
+ // const cleaned = cleanMarkdown(message.text || '')
+ // if (cleaned.includes('chatbot.')) {
+ // const translated_message = t(message.text);
+ // return md.render(translated_message);
+ // }
+ // return md.render(cleaned);
+ // })
+
+
+ {{ message_text }}
+
+
+
+
-
-
+ :text="[message_text]"
+ />
+
+
\ No newline at end of file
diff --git a/src/modules/chatbot/models/page-context.model.ts b/src/modules/chatbot/models/page-context.model.ts
index ea6e5d7..5d76c92 100644
--- a/src/modules/chatbot/models/page-context.model.ts
+++ b/src/modules/chatbot/models/page-context.model.ts
@@ -1,13 +1,13 @@
import { RouteNames } from "src/router/router-constants";
-export interface chatbotPageContext {
+export interface ChatbotPageContext {
name: string;
description: string;
features: string[];
path: RouteNames | null;
}
-export const dashboardContext: chatbotPageContext = {
+export const dashboardContext: ChatbotPageContext = {
name: "Dashboard",
description: "Landing page containing useful links and a carousel showcasing recent news, as well as a local weather widget in the top right corner",
features: [
@@ -18,7 +18,7 @@ export const dashboardContext: chatbotPageContext = {
path: RouteNames.DASHBOARD,
};
-export const leftDrawerContext: chatbotPageContext = {
+export const leftDrawerContext: ChatbotPageContext = {
name: "Left Drawer",
description: "A drawer that acts as a navigation bar, routes to different parts of the website. Some icons will be hidden according to user access",
features: [
@@ -33,7 +33,7 @@ export const leftDrawerContext: chatbotPageContext = {
path: null,
};
-export const profileContext: chatbotPageContext = {
+export const profileContext: ChatbotPageContext = {
name: "Profile",
description: "Display and edit user information",
features: [
@@ -44,7 +44,7 @@ export const profileContext: chatbotPageContext = {
path: RouteNames.PROFILE,
};
-export const employeeListContext: chatbotPageContext = {
+export const employeeListContext: ChatbotPageContext = {
name: "Employee List",
description: "View all the hired and currently active Staff",
features: [
@@ -57,7 +57,7 @@ export const employeeListContext: chatbotPageContext = {
path: RouteNames.EMPLOYEE_LIST,
};
-export const timesheetApprovalContext: chatbotPageContext = {
+export const timesheetApprovalContext: ChatbotPageContext = {
name: "Timesheet Approval",
description: "Page where employee hours and shifts are approved for accounting purposes. Requires timesheet_approval module access.",
features: [
@@ -71,7 +71,7 @@ export const timesheetApprovalContext: chatbotPageContext = {
path: RouteNames.TIMESHEET_APPROVALS,
};
-export const timesheetContext: chatbotPageContext = {
+export const timesheetContext: ChatbotPageContext = {
name: "Timesheet",
description:
"Page where an employee can enter their hours for their day and week. Display in 2-week pay periods.",
@@ -86,7 +86,7 @@ export const timesheetContext: chatbotPageContext = {
path: RouteNames.TIMESHEET,
};
-export const helpContext: chatbotPageContext = {
+export const helpContext: ChatbotPageContext = {
name: "Help",
description: "page containing common Q&A segments regarding website functionalities",
features: [
@@ -98,7 +98,7 @@ export const helpContext: chatbotPageContext = {
path: RouteNames.HELP,
}
-export const PageContexts: Record = {
+export const PageContexts: Record = {
"login": null,
"login-success": null,
"error": null,
diff --git a/src/modules/chatbot/services/chatbot.service.ts b/src/modules/chatbot/services/chatbot.service.ts
index b68f6b4..0a297ed 100644
--- a/src/modules/chatbot/services/chatbot.service.ts
+++ b/src/modules/chatbot/services/chatbot.service.ts
@@ -1,28 +1,28 @@
-import type { chatbotPageContext } from "src/modules/chatbot/models/page-context.model";
+import type { ChatbotPageContext } from "src/modules/chatbot/models/page-context.model";
import type { Message } from "src/modules/chatbot/models/dialogue-message.model";
import { api } from "src/boot/axios";
export const chatbotService = {
// Function to send the message to the backend
- sendChatMessage: async (userInput: string): Promise => {
- const response = await api.post("/chatbot", { userInput });
+ sendChatMessage: async (userInput: string, pageContext: ChatbotPageContext | undefined): Promise => {
+ const response = await api.post("/chatbot", { userInput, pageContext });
return response.data as Message;
},
- // Function to send context to backend
- sendPageContext: async (context: chatbotPageContext): Promise => {
- const response = await api.post("/chatbot/context", context);
- return response.data;
- },
+ // // Function to send context to backend
+ // sendPageContext: async (context: chatbotPageContext): Promise => {
+ // const response = await api.post("/chatbot/context", context);
+ // return response.data;
+ // },
- // Function to send user credentials to the backend to communicate with n8n.
- sendUserCredentials: async (email: string, role: string): Promise => {
- const response = await api.post("/chatbot/user", { email, role });
- return response.data;
- },
+ // // Function to send user credentials to the backend to communicate with n8n.
+ // sendUserCredentials: async (email: string, role: string): Promise => {
+ // const response = await api.post("/chatbot/user", { email, role });
+ // return response.data;
+ // },
- retrieveCustomerDiagnostics: async (id: string): Promise => {
- const response = await api.get(`/chat/customer/${id}`);
- return response.data;
- },
+ // retrieveCustomerDiagnostics: async (id: string): Promise => {
+ // const response = await api.get(`/chat/customer/${id}`);
+ // return response.data;
+ // },
};
diff --git a/src/modules/timesheet-approval/components/overview-list-filters.vue b/src/modules/timesheet-approval/components/overview-list-filters.vue
index 9290348..588dab1 100644
--- a/src/modules/timesheet-approval/components/overview-list-filters.vue
+++ b/src/modules/timesheet-approval/components/overview-list-filters.vue
@@ -14,7 +14,6 @@
onMounted(() => {
Object.values(overview_column_names).map(column => column_options.value.push({ label: `timesheet_approvals.table.${column}`, value: column as OverviewColumns }))
column_options.value = column_options.value.filter(column => !EXCLUDED_COLUMNS.includes(column.value));
- console.log('filter column values: ', column_options.value )
})
diff --git a/src/modules/timesheets/components/timesheet-wrapper.vue b/src/modules/timesheets/components/timesheet-wrapper.vue
index 5949338..00318ba 100644
--- a/src/modules/timesheets/components/timesheet-wrapper.vue
+++ b/src/modules/timesheets/components/timesheet-wrapper.vue
@@ -30,7 +30,7 @@
const is_timesheets_approved = computed(() => timesheet_store.timesheets.every(timesheet => timesheet.is_approved))
const total_hours = computed(() => timesheet_store.timesheets.reduce((sum, timesheet) =>
- sum + timesheet.weekly_hours.regular
+ sum += timesheet.weekly_hours.regular
+ timesheet.weekly_hours.evening
+ timesheet.weekly_hours.emergency
+ timesheet.weekly_hours.overtime,
diff --git a/src/stores/chatbot-store.ts b/src/stores/chatbot-store.ts
index 3b66c21..b0fc645 100644
--- a/src/stores/chatbot-store.ts
+++ b/src/stores/chatbot-store.ts
@@ -2,19 +2,20 @@ import { ref } from "vue";
import { defineStore } from "pinia";
import { chatbotService } from "src/modules/chatbot/services/chatbot.service";
import type { Message } from "src/modules/chatbot/models/dialogue-message.model";
+import { type ChatbotPageContext, PageContexts } from "src/modules/chatbot/models/page-context.model";
import type { RouteNames } from "src/router/router-constants";
-import { PageContexts } from "src/modules/chatbot/models/page-context.model";
export const useChatbotStore = defineStore("chatbot", () => {
const messages = ref([]);
const has_shown_instructions = ref(false);
const is_showing_chatbot = ref(false);
+ const current_page_context = ref(undefined);
const sendChatMessage = async (user_message: string) => {
const last_chatbot_message = messages.value.at(messages.value.length - 1)!;
try {
- const chatbot_response = await chatbotService.sendChatMessage(user_message);
+ const chatbot_response = await chatbotService.sendChatMessage(user_message, current_page_context.value);
if (chatbot_response) {
last_chatbot_message.text = chatbot_response.text;
last_chatbot_message.isThinking = false;
@@ -30,11 +31,9 @@ export const useChatbotStore = defineStore("chatbot", () => {
}
};
- const updatePageContext = async (page_name: RouteNames) => {
- const chatbot_page_context = PageContexts[page_name];
-
- if (chatbot_page_context)
- await chatbotService.sendPageContext(chatbot_page_context);
+ const updatePageContext = (page_name: RouteNames) => {
+ current_page_context.value = PageContexts[page_name] ?? undefined;
+
};
const showInstructionsOnce = () => {