Skip to content

Commit 0cabcbe

Browse files
committed
fixed server 200 null response when context is exceeded
1 parent 2f2e4b3 commit 0cabcbe

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

examples/server/server.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,11 +1464,10 @@ struct server_context {
14641464
std::vector<server_task_result> results(id_tasks.size());
14651465
for (size_t i = 0; i < id_tasks.size(); i++) {
14661466
server_task_result result = queue_results.recv(id_tasks);
1467-
14681467
if (result.error) {
14691468
error_handler(result.data);
14701469
cancel_tasks(id_tasks);
1471-
break;
1470+
return;
14721471
}
14731472

14741473
size_t idx = result.data["index"];
@@ -1948,9 +1947,9 @@ struct server_context {
19481947
continue;
19491948
}
19501949
// context shift is disabled and prompt is too large - discard it
1951-
if (!params.ctx_shift && slot.n_prompt_tokens > slot.n_ctx ){
1950+
if (!params.ctx_shift && (slot.n_prompt_tokens > slot.n_ctx) ){
19521951
slot.release();
1953-
send_error(slot, "input is too large to process. enable context shift or increase the context length", ERROR_TYPE_SERVER);
1952+
send_error(slot, "Input is too large to process. Enable context shift or increase the context length", ERROR_TYPE_SERVER);
19541953
continue;
19551954
}
19561955

0 commit comments

Comments
 (0)