-
Notifications
You must be signed in to change notification settings - Fork 76
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
Skynet chatGPT #122
base: master
Are you sure you want to change the base?
Skynet chatGPT #122
Conversation
y4my4my4m
commented
Aug 25, 2023
- Skynet
- Full chat application for 3.5 / 4.0
- Basic implementation for gpt2 / gpt3
- Middleware server example config file / instructions
Update and make compatible with the latest openai api endpoints |
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, '{'); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
//SysLog(payload); | ||
|
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
U8 *StrChr(U8 *Str,U8 Pivot) | ||
{ | ||
//U8 *Orig=Str; | ||
while (*Str!=Pivot&&*Str!=0)Str++; | ||
if (*Str==Pivot) return Str; | ||
else return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this.