Skip to content

Conversation

@y4my4my4m
Copy link
Collaborator

  • Skynet
    • Full chat application for 3.5 / 4.0
    • Basic implementation for gpt2 / gpt3
  • Middleware server example config file / instructions

@y4my4my4m
Copy link
Collaborator Author

Update and make compatible with the latest openai api endpoints

Comment on lines +20 to +28
U8 *StrChr(U8 *Str,U8 Pivot)
{
//U8 *Orig=Str;
while (*Str!=Pivot&&*Str!=0)Str++;
if (*Str==Pivot) return Str;
else return 0;
}
U8* RemoveBeforeJSON(U8 *input) {
U8 *jsonStart = StrChr(input, '{');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StrChr is only used once here. Just put it in RemoveBeforeJSON.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, why not just use StrFind?

Comment on lines +63 to +64
//SysLog(payload);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove those lines.

responseLength += TCPSocketReceive(sock, responseBuf + responseLength, bufferSize - responseLength - 1);
responseBuf[responseLength] = 0;
}
//SysLog(responseBuf);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line.

}

U8 *completion = contentEntry->string_data;
//SysLog(completion);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line.

Free(msg);
}

U8 *currentUserMsg = StrPrint(NULL, "{\"role\": \"user\",\"content\": \"%s\"}", message);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should sanitize the user input.

Comment on lines +20 to +26
U8 *StrChr(U8 *Str,U8 Pivot)
{
//U8 *Orig=Str;
while (*Str!=Pivot&&*Str!=0)Str++;
if (*Str==Pivot) return Str;
else return 0;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this.

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

Successfully merging this pull request may close these issues.

3 participants