Skip to content

Commit e14a1e7

Browse files
Update binding.cpp
1 parent fe6042f commit e14a1e7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bindings/binding.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,11 @@ const char* InferToReadbackBuffer(
924924
tokenCount += batch.n_tokens;
925925

926926
if (!buffer.empty()) {
927-
const MatchTrie::MatchInfo matchInfo = matchingTrie.CheckBuffer(buffer);
927+
std::string stripped = buffer;
928+
if (std::isspace(static_cast<unsigned char>(stripped.front()))) {
929+
stripped.erase(0, 1);
930+
}
931+
const MatchTrie::MatchInfo matchInfo = matchingTrie.CheckBuffer(stripped);
928932

929933
switch (matchInfo.result) {
930934
case MatchTrie::MatchResult::NO: {

0 commit comments

Comments
 (0)