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

Fixes issue of medium to large prompts causing crashing with no errors while using color mode. #126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1041,10 +1041,10 @@ int main(int argc, char ** argv) {
bool another_line=true;
while (another_line) {
fflush(stdout);
char buf[256] = {0};
char buf[16384] = { 0 };
int n_read;
if(params.use_color) printf(ANSI_BOLD ANSI_COLOR_GREEN);
if (scanf("%255[^\n]%n%*c", buf, &n_read) <= 0) {
if (params.use_color) printf(ANSI_BOLD ANSI_COLOR_GREEN);
if (scanf("%16383[^\n]%n%*c", buf, &n_read) <= 0) {
// presumable empty line, consume the newline
if (scanf("%*c") <= 0) { /*ignore*/ }
n_read=0;
Expand Down