diff --git a/Block/Example.php b/Block/Example.php index 5303b77..fb78ac9 100644 --- a/Block/Example.php +++ b/Block/Example.php @@ -18,6 +18,6 @@ class Example extends Template * @return string */ public function getContent() { - return "Hello World"; + return "Hello World, Welcome to Magento"; } } \ No newline at end of file diff --git a/etc/frontend/routes.xml b/etc/frontend/routes.xml index b85b4e5..4dad8ee 100644 --- a/etc/frontend/routes.xml +++ b/etc/frontend/routes.xml @@ -1,8 +1,3 @@ - - - - - - - - + + + diff --git a/view/frontend/templates/chat.phtml b/view/frontend/templates/chat.phtml new file mode 100644 index 0000000..df68307 --- /dev/null +++ b/view/frontend/templates/chat.phtml @@ -0,0 +1,10 @@ +
+ + +
+
+ diff --git a/view/frontend/web/js/chat.js b/view/frontend/web/js/chat.js new file mode 100644 index 0000000..28f07d2 --- /dev/null +++ b/view/frontend/web/js/chat.js @@ -0,0 +1,17 @@ +define(['jquery'], function($) { + 'use strict'; + return function(config, element) { + .on('submit', function(event) { + event.preventDefault(); + var message = .val(); + $.ajax({ + url: '/openai/chat', + type: 'POST', + data: { message: message }, + success: function(response) { + .append('
' + response + '
'); + } + }); + }); + }; +});