Skip to content

Commit

Permalink
Fix VT102 support
Browse files Browse the repository at this point in the history
It turns out \e[39m wasn't introduced until ECMA-48 3rd c. 1984.
  • Loading branch information
jart committed Nov 25, 2024
1 parent d18ddf1 commit 4b61791
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llamafile/chatbot_repl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void repl() {
bestlineSetCompletionCallback(on_completion);
write(1, get_role_color(g_role), strlen(get_role_color(g_role)));
char *line = bestlineWithHistory(">>> ", "llamafile");
write(1, UNFOREGROUND, strlen(UNFOREGROUND));
write(1, RESET, strlen(RESET));
g_last_printed_char = '\n';
if (!line) {
if (g_got_sigint)
Expand Down
2 changes: 2 additions & 0 deletions llamafile/server/v1_chat_completions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ Client::get_v1_chat_completions_params(V1ChatCompletionParams* params)
if (!top_p.isNumber())
return send_error(400, "top_p must be number");
params->top_p = top_p.getNumber();
if (!(0 <= params->top_p && params->top_p <= 1))
return send_error(400, "top_p must be between 0 and 1");
}

// temperature: number|null
Expand Down
2 changes: 2 additions & 0 deletions llamafile/server/v1_completions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ Client::get_v1_completions_params(V1CompletionParams* params)
if (!top_p.isNumber())
return send_error(400, "top_p must be number");
params->top_p = top_p.getNumber();
if (!(0 <= params->top_p && params->top_p <= 1))
return send_error(400, "top_p must be between 0 and 1");
}

// temperature: number|null
Expand Down

0 comments on commit 4b61791

Please sign in to comment.