Skip to content
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

JSON error with compiled version #10

Open
liamgwallace opened this issue Jun 26, 2023 · 2 comments
Open

JSON error with compiled version #10

liamgwallace opened this issue Jun 26, 2023 · 2 comments

Comments

@liamgwallace
Copy link

liamgwallace commented Jun 26, 2023

When I compile the unaltered project to an .exe I get the following error


Error: Failed to parse JSON (-1,0)

Specifically: Unexpected character at position 0: "

		Line#
--->	231:Throw,Exception(failed to parse LSON(" r"," ErrorLevel")", -1,Format("Unexpected character at position {}: '{}'",(NumGet(pJson)-&_json)//2, Chr(NumGet(pJson), "short"))))

If I run the .AHK script then it works just fine.

I would really like to run this from an exe any help would be greatly appreciated.

p.s. love the robot icon!

@liamgwallace
Copy link
Author

I have done some digging and it seems like the result of the JSON.Dump is different when I run .AHK or .EXE. Here is the code

body := {}
body.model := MODEL_INSTRUCT_ID ;
body.input := CutText ;
body.instruction := UserInput ;
MsgBox, % "Body: " . JSON.Dump(body)

here are the 2 outputs
as .AHK
Body: {"input": " testing33", "instruction": "test inst", "model": "text-davinci-edit-001"}
as .EXE
Body: {"\u6E69\u7570t": "\u7420\u7365\u6974\u676E\u3333\u33343", "\u6E69\u7473\u7572\u7463\u6F69n": "\u6574\u7473\u6920\u736Et", "\u6F6D\u6564l": "\u6574\u7478\u642D\u7661\u6E69\u6963\u652D\u6964\u2D74\u30301: \"test inst\", \"model\": \"text-davinci-edit-001\"}"}

@htadashi
Copy link
Owner

Thanks for reporting this issue @liamgwallace. Unfortunately, I wasn't able to reproduce this problem in my local machines (both .ahk and .exe versions are working fine here). Did you find some solution that solved it in your machine? If so, I'd appreciate hearing about it so I can also update this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants