Skip to content

Fast local LLM inference on plain CPUs. No GPU, 8 GB of RAM. OpenAI-compatible server.

916 B
Raw Blame
diff --git a/common/chat.h b/common/chat.h
index cb39e34..428a60e 100644
--- a/common/chat.h
+++ b/common/chat.h
@@ -172,7 +172,7 @@ struct common_chat_msg_spans {
 
     bool is_user_start(int32_t pos) const {
         for (auto it = spans.begin(); it != spans.end(); ++it) {
-            if (it->role == COMMON_CHAT_ROLE_USER && pos == (int32_t) it->pos) {
+            if ((it->role == COMMON_CHAT_ROLE_USER || it->role == COMMON_CHAT_ROLE_TOOL) && pos == (int32_t) it->pos) {
                 return true;
             }
         }
@@ -181,7 +181,7 @@ struct common_chat_msg_spans {
 
     int32_t last_user_message_pos() const {
         for (auto it = spans.rbegin(); it != spans.rend(); ++it) {
-            if (it->role == COMMON_CHAT_ROLE_USER) {
+            if (it->role == COMMON_CHAT_ROLE_USER || it->role == COMMON_CHAT_ROLE_TOOL) {
                 return (int32_t) it->pos;
             }
         }