obiscr / ChatGPT

This project is a plugin that supports ChatGPT running on JetBrains series IDE.
https://plugins.jetbrains.com/plugin/20603-chatgpt
Other
1.01k stars 227 forks source link

There are errors in the generated code regarding sign conversion. #269

Closed Chenjiangwen closed 1 year ago

Chenjiangwen commented 1 year ago

In the code generated by chatGPT, using copy or insert to editor, the symbols: >, <, and ' ' will be converted to & gt;' '& lt;' '& quot;' in the editor.

Chenjiangwen commented 1 year ago

example: the code generated by chatGPT:

def bubble_sort(arr):
    n = len(arr)
    for i in range(n - 1):
        for j in range(0, n - i - 1):
            if arr[j] > arr[j + 1]:
                arr[j], arr[j + 1] = arr[j + 1], arr[j]
    return arr
arr = [64, 34, 25, 12, 22, 11, 90]
sorted_arr = bubble_sort(arr)
print("result:", sorted_arr)

but using 'copy' or 'insert in editor', the code will be:

def bubble_sort(arr):
    n = len(arr)

    for i in range(n-1):
        for j in range(0, n-i-1):
            if arr[j] &gt; arr[j+1]:  <--------
                arr[j], arr[j+1] = arr[j+1], arr[j]
    return arr
arr = [64, 34, 25, 12, 22, 11, 90]
sorted_arr = bubble_sort(arr)
print(&quot;result:&quot;, sorted_arr) <--------
obiscr commented 1 year ago

Thanks, In my tests, copying does not work, but Insert to Editor is fine. It will be fixed in a later version.

269

obiscr commented 1 year ago

This issue has been fixed in version 3.1.2. please update to latest version.