Skip to content

Commit 4b61791

Browse files
committed
Fix VT102 support
It turns out \e[39m wasn't introduced until ECMA-48 3rd c. 1984.
1 parent d18ddf1 commit 4b61791

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

llamafile/chatbot_repl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void repl() {
144144
bestlineSetCompletionCallback(on_completion);
145145
write(1, get_role_color(g_role), strlen(get_role_color(g_role)));
146146
char *line = bestlineWithHistory(">>> ", "llamafile");
147-
write(1, UNFOREGROUND, strlen(UNFOREGROUND));
147+
write(1, RESET, strlen(RESET));
148148
g_last_printed_char = '\n';
149149
if (!line) {
150150
if (g_got_sigint)

llamafile/server/v1_chat_completions.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ Client::get_v1_chat_completions_params(V1ChatCompletionParams* params)
287287
if (!top_p.isNumber())
288288
return send_error(400, "top_p must be number");
289289
params->top_p = top_p.getNumber();
290+
if (!(0 <= params->top_p && params->top_p <= 1))
291+
return send_error(400, "top_p must be between 0 and 1");
290292
}
291293

292294
// temperature: number|null

llamafile/server/v1_completions.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ Client::get_v1_completions_params(V1CompletionParams* params)
280280
if (!top_p.isNumber())
281281
return send_error(400, "top_p must be number");
282282
params->top_p = top_p.getNumber();
283+
if (!(0 <= params->top_p && params->top_p <= 1))
284+
return send_error(400, "top_p must be between 0 and 1");
283285
}
284286

285287
// temperature: number|null

0 commit comments

Comments
 (0)