Skip to content

Commit 01da1ed

Browse files
committed
fix /slots endpoint
1 parent 1881ffa commit 01da1ed

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Diff for: examples/server/server.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2233,6 +2233,7 @@ struct server_context {
22332233

22342234
auto res = std::make_unique<server_task_result_metrics>();
22352235
res->id = task.id;
2236+
res->slots_data = slots_data;
22362237
res->n_idle_slots = n_idle_slots;
22372238
res->n_processing_slots = n_processing_slots;
22382239
res->n_tasks_deferred = queue_tasks.queue_tasks_deferred.size();

Diff for: examples/server/utils.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,12 @@ static std::string llama_get_chat_template(const struct llama_model * model) {
327327
std::string template_key = "tokenizer.chat_template";
328328
// call with NULL buffer to get the total size of the string
329329
int32_t res = llama_model_meta_val_str(model, template_key.c_str(), NULL, 0);
330-
if (res < 0) {
330+
if (res < 2) {
331331
return "";
332332
} else {
333333
std::vector<char> model_template(res, 0);
334334
llama_model_meta_val_str(model, template_key.c_str(), model_template.data(), model_template.size());
335-
return std::string(model_template.data(), model_template.size());
335+
return std::string(model_template.data(), model_template.size() - 1);
336336
}
337337
}
338338

0 commit comments

Comments
 (0)