Skip to content

Commit 714b811

Browse files
authored
minor debug log fix
1 parent aa4277c commit 714b811

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

examples/server/server.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ struct server_context {
731731

732732
// find the slot that has at least n% prompt similarity
733733
if (ret == nullptr && slot_prompt_similarity != 0.0f) {
734-
int max_lcs_len = 0;
734+
int lcs_len = 0;
735735
float similarity = 0;
736736

737737
for (server_slot & slot : slots) {
@@ -746,20 +746,21 @@ struct server_context {
746746
}
747747

748748
// length of the Longest Common Subsequence between the current slot's prompt and the input prompt
749-
int lcs_len = longest_common_subsequence(slot.cache_tokens, task.prompt_tokens);
749+
int cur_lcs_len = longest_common_subsequence(slot.cache_tokens, task.prompt_tokens);
750750

751751
// fraction of the common subsequence length compared to the current slot's prompt length
752-
similarity = static_cast<float>(lcs_len) / static_cast<int>(slot.cache_tokens.size());
752+
float cur_similarity = static_cast<float>(cur_lcs_len) / static_cast<int>(slot.cache_tokens.size());
753753

754754
// select the current slot if the criteria match
755-
if (lcs_len > max_lcs_len && similarity > slot_prompt_similarity) {
756-
max_lcs_len = lcs_len;
755+
if (cur_lcs_len > lcs_len && cur_similarity > slot_prompt_similarity) {
756+
lcs_len = cur_lcs_len;
757+
similarity = cur_similarity;
757758
ret = &slot;
758759
}
759760
}
760761

761762
if (ret != nullptr) {
762-
SLT_DBG(*ret, "selected slot by lcs similarity, max_lcs_len = %d, similarity = %f\n", max_lcs_len, similarity);
763+
SLT_DBG(*ret, "selected slot by lcs similarity, lcs_len = %d, similarity = %f\n", lcs_len, similarity);
763764
}
764765
}
765766

0 commit comments

Comments
 (0)