-
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?
Conversation
define(['jquery'], function($) { | ||
'use strict'; | ||
return function(config, element) { | ||
.on('submit', function(event) { |
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.
Burada element
değişkeni kullanılmamış ve jQuery seçicisi eksik. Örneğin $(element).on('submit', ...)
olarak kullanılmalı. Ayrıca, ilerleyen satırlarda da benzer şekilde jQuery seçicileri ($(element).find(...)
, $('#chat-output')
gibi) eksik veya hatalı. Kodun doğru çalışması için form ve input elemanlarına net şekilde erişilmeli.
.on('submit', function(event) { | ||
event.preventDefault(); | ||
var message = .val(); | ||
$.ajax({ |
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.
Burada message = .val();
ifadesi eksik. Doğru şekilde input elemanını seçip değerini almak için var message = $(element).find('#chat-input').val();
şeklinde kullanılmalı.
type: 'POST', | ||
data: { message: message }, | ||
success: function(response) { | ||
.append('<div>' + response + '</div>'); |
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.
Burada append('<div>' + response + '</div>')
ifadesinden önce hedef DOM elementi seçilmemiş. Yanıtı ekleyeceğiniz elementi (örn. #chat-output
) net bir şekilde seçmelisiniz: $('#chat-output').append(...)
gibi.
Genel olarak yapılan değişiklikler olumlu, işlevsellik açısından chat formu ve ilgili JS dosyası eklenmiş. Ancak
Kodunuzu gözden geçirip, özellikle |
</route> | ||
</router> | ||
</config> | ||
<route id='openai' frontName='openai'> |
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.
define(['jquery'], function($) { | ||
'use strict'; | ||
return function(config, element) { | ||
.on('submit', function(event) { |
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.
There's a syntax error here. The .on('submit', ...)
method is called without a preceding jQuery object. It should likely be $(element).on('submit', ...)
if element
refers to the form, or $(element).find('#chat-form').on('submit', ...)
if element
is a parent container.
return function(config, element) { | ||
.on('submit', function(event) { | ||
event.preventDefault(); | ||
var message = .val(); |
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 message
variable assignment is incomplete. It should be var message = $(element).find('#chat-input').val();
or similar, depending on how element
is used and the structure of your HTML.
data: { message: message }, | ||
success: function(response) { | ||
.append('<div>' + response + '</div>'); | ||
} |
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.
Similar to previous issues, the jQuery selector is missing here. It should be $(element).find('#chat-output').append(...)
to target the correct element.
Overall, the PR introduces new functionality for an OpenAI chat integration, which is a good initiative. However, there are several critical issues that need to be addressed before this PR can be merged:
Please address these issues. Once fixed, I can review the changes again. |
No description provided.