-
-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
To be totally clear I am using the ChatGPT online endpoint and directing it to my locally hosted LM Studio endpoint however this should be irrelevant
Description:
The AI API fails to process code snippets that contain comments (e.g., // This is a comment). This causes the response to fail with a JSON parsing error.
Error Message Response:
Question cannot be answered
Return: {"error":{"message":"Invalid body: failed to parse JSON value. Please check the value to ensure it is valid JSON","type":"invalid_request","code":"invalid_json"}}
!!! Very likely that other syntax and special characters are breaking json format that I have not run into !!!
Reproduction Steps:
- Send the following code to the AI:
// GetMachineName retrieves the machine's (computer's) name
function GetMachineName: string;
var
Buffer: array[0..255] of WideChar; // Buffer to store the machine name
Size: DWORD; // Size of the buffer
begin
Size := Length(Buffer);
if GetComputerNameW(@Buffer[0], Size) then
Result := PWideChar(@Buffer[0]) // If successful, return the machine name
else
Result := 'Unknown'; // Return 'Unknown' if failed
end;Steps To Fix:
- Replace "//" characters with something like block comments "{}" automatically:
{ GetMachineName retrieves the machine's (computer's) name }
function GetMachineName: string;
var
Buffer: array[0..255] of WideChar;
Size: DWORD; { Size of the buffer }
begin
Size := Length(Buffer);
if GetComputerNameW(@Buffer[0], Size) then
Result := PWideChar(@Buffer[0]) { If successful, return the machine name }
else
Result := 'Unknown'; { Return 'Unknown' if failed }
end;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels