Skip to content

Commit f373400

Browse files
committed
server : fix prompt similarity calculation
1 parent e3b1bd6 commit f373400

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/server/server.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,8 +2366,8 @@ struct server_context {
23662366
// length of the Longest Common Subsequence between the current slot's prompt and the input prompt
23672367
int cur_lcs_len = slot.cache_tokens.get_common_prefix(task.prompt_tokens);
23682368

2369-
// fraction of the common subsequence length compared to the current slot's prompt length
2370-
float cur_similarity = static_cast<float>(cur_lcs_len) / static_cast<int>(slot.cache_tokens.size());
2369+
// fraction of the common subsequence length
2370+
float cur_similarity = float(cur_lcs_len) / task.prompt_tokens.size();
23712371

23722372
// select the current slot if the criteria match
23732373
if (cur_lcs_len > lcs_len && cur_similarity > slot_prompt_similarity) {

0 commit comments

Comments
 (0)