-
Notifications
You must be signed in to change notification settings - Fork 0
OpenAI integration #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,3 @@ | ||
| <?xml version="1.0"?> | ||
| <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> | ||
| <router id="standard"> | ||
| <route id="example" frontName="example"> | ||
| <module name="MageSheet_Example" /> | ||
| </route> | ||
| </router> | ||
| </config> | ||
| <route id='openai' frontName='openai'> | ||
| <module name='MageSheet_Example' /> | ||
| </route> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <form id='chat-form'> | ||
| <input type='text' id='chat-input' placeholder='Type your message here...'/> | ||
| <button type='submit'>Send</button> | ||
| </form> | ||
| <div id='chat-output'></div> | ||
| <script type='text/javascript'> | ||
| require(['MageSheet_Example/js/chat'], function(chat) { | ||
| chat({}, document.getElementById('chat-form')); | ||
| }); | ||
| </script> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| define(['jquery'], function($) { | ||
| 'use strict'; | ||
| return function(config, element) { | ||
| .on('submit', function(event) { | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Burada
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a syntax error here. The |
||
| event.preventDefault(); | ||
| var message = .val(); | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| $.ajax({ | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Burada |
||
| url: '/openai/chat', | ||
| type: 'POST', | ||
| data: { message: message }, | ||
| success: function(response) { | ||
| .append('<div>' + response + '</div>'); | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Burada |
||
| } | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to previous issues, the jQuery selector is missing here. It should be |
||
| }); | ||
| }); | ||
| }; | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The routes.xml file structure is incorrect. It is missing the root tag and the tag. A tag must be nested within a tag, which in turn must be within a tag. Please refer to the Magento documentation for the correct structure.