Open zhuangjun1981 opened 2 months ago
Thanks @zhuangjun1981! I tried your prompt from example 2 in the latest version of main and didn't see any issue:
It generates this:
I also tried using the chinese equivalent to that prompt (assuming the Claude translation is correct!!). Here's what I got:
The code itself would need some work since it seems like matplotlib can't render the chinese characters. But that could probably be solved with some back and forth with the LLM. Here's what the v1.0 code generates:
I think some recent changes I made may have solved the JSON parsing issues. Could you try pulling the latest version of main and see if the issue persists for you?
Aha, in the new version, the console display problem is fixed. But the special character in the script is still causing problem.
SyntaxError: Non-UTF-8 code starting with '\xc9' in file C:\Users\wood_\PycharmProjects\CodeAIde\generated_code\generated_script_1.0.py on line 4, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Script execution completed.
Script execution completed. You can close this window.
If I open the generated script in sublime text, it looks like this:
Does it mean that my system is missing the encoder?
How did you get the code to sublime text?
I just entered the two prompts you supplied above. Here's my chat window:
Both provided readable code in the CodeAIde code popup. Here's what the chinese prompted code looks like:
I hit the "copy code" button and pasted it into Sublime. It rendered the chinese comments there:
Then I hit the "save code" button and saved it as test.py and opened that in sublime. That rendered correctly as well:
Can you share a screenshot of the code as it was displayed in your CodeAIde code popup?
Looks like the console and the interpreter cannot accommodate some of the characters generated by the language model.
==============================================
Example1: if I ask the assistant a Chinese question, it will return useful code but the console cannot display the response correctly.
==============================================
Example 2: if I ask "User: please plot a sine wave and cosine wave superimposed on each other. " the code it generated contains special character "pi", such as
# Create x values from 0 to 2π
And the interpreter will spit out an error:
SyntaxError: Non-UTF-8 code starting with '\xa6' in file C:\Users\wood_\PycharmProjects\CodeAIde\generated_code\generated_script_1.0.py on line 4, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Looks like the character
π
is the source of the issue.