server
: catch errors in format_final_response_oaicompat instead of taking server down
This commit is contained in:
parent
595e11cb11
commit
94377d743c
1 changed files with 6 additions and 2 deletions
|
@ -2879,8 +2879,12 @@ int main(int argc, char ** argv) {
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
ctx_server.receive_cmpl_results(task_ids, [&](const std::vector<server_task_result> & results) {
|
ctx_server.receive_cmpl_results(task_ids, [&](const std::vector<server_task_result> & results) {
|
||||||
// multitask is never support in chat completion, there is only one result
|
// multitask is never support in chat completion, there is only one result
|
||||||
|
try {
|
||||||
json result_oai = format_final_response_oaicompat(data, results[0].data, completion_id, /*.streaming =*/ false, verbose);
|
json result_oai = format_final_response_oaicompat(data, results[0].data, completion_id, /*.streaming =*/ false, verbose);
|
||||||
res_ok(res, result_oai);
|
res_ok(res, result_oai);
|
||||||
|
} catch (const std::runtime_error & e) {
|
||||||
|
res_error(res, format_error_response(e.what(), ERROR_TYPE_SERVER));
|
||||||
|
}
|
||||||
}, [&](const json & error_data) {
|
}, [&](const json & error_data) {
|
||||||
res_error(res, error_data);
|
res_error(res, error_data);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue