diff --git a/entrypoint.sh b/entrypoint.sh index 2ee00263c..8f8c5dbe8 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,7 +3,7 @@ cd /usr/ui/medplat-ui npm install --legacy-peer-deps -bower install +bower install --allow-root --config.interactive=false cd /usr/web mvn clean install -P docker -Dmaven.test.skip=true diff --git a/medplat-ui/app/ai-assistant/chat.controller.js b/medplat-ui/app/ai-assistant/chat.controller.js new file mode 100644 index 000000000..87e7da971 --- /dev/null +++ b/medplat-ui/app/ai-assistant/chat.controller.js @@ -0,0 +1,59 @@ +(function () { + 'use strict'; + angular.module('imtecho.controllers') + .controller('ChatController', ChatController); + + function ChatController($timeout, $translate) { + var chat = this; + chat.showChat = false; + chat.messages = [ + { text: "Hello! I am AI ANM, your assistant. How can I help you today?", sender: "ai", timestamp: new Date() } + ]; + chat.newMessage = ""; + + chat.toggleChat = function () { + chat.showChat = !chat.showChat; + if (chat.showChat) { + $timeout(scrollBottom, 100); + } + }; + + chat.sendMessage = function () { + if (!chat.newMessage.trim()) return; + + chat.messages.push({ + text: chat.newMessage, + sender: "user", + timestamp: new Date() + }); + + var userMsg = chat.newMessage; + chat.newMessage = ""; + $timeout(scrollBottom, 100); + + // Mock AI response + $timeout(function () { + var response = "I understand you're asking about: " + userMsg + ". I'm currently in testing mode, but I can help you report issues in the 'Manage' section."; + chat.messages.push({ + text: response, + sender: "ai", + timestamp: new Date() + }); + $timeout(scrollBottom, 100); + }, 1000); + }; + + chat.checkEnter = function (event) { + if (event.which === 13) { + chat.sendMessage(); + } + }; + + function scrollBottom() { + var chatBox = document.getElementById('chat-messages'); + if (chatBox) { + chatBox.scrollTop = chatBox.scrollHeight; + } + } + } +})(); diff --git a/medplat-ui/app/ai-assistant/chat.html b/medplat-ui/app/ai-assistant/chat.html new file mode 100644 index 000000000..5d5ea009f --- /dev/null +++ b/medplat-ui/app/ai-assistant/chat.html @@ -0,0 +1,142 @@ +
@@ -170,6 +182,12 @@