File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2217,6 +2217,9 @@ class GenerateResponseState<const Functions extends ChatModelFunctions | undefin
22172217 public waitOnPartialCharactersOrWhiteSpaceTokens ( ) {
22182218 if ( this . currentText . endsWith ( UNKNOWN_UNICODE_CHAR ) || (
22192219 ( this . grammar ?. trimWhitespaceSuffix || this . trimWhitespaceSuffix ) && this . currentText ?. trim ( ) === ""
2220+ ) || (
2221+ this . currentText === "" && this . locksToReleaseOnValidGeneration . length > 0 &&
2222+ ! this . llamaChat . model . isSpecialToken ( this . currentToken )
22202223 ) ) {
22212224 if ( this . currentQueuedTokenRelease != null )
22222225 this . locksToReleaseOnValidGeneration . push ( this . currentQueuedTokenRelease . createTextIndexLock ( 0 ) ) ;
Original file line number Diff line number Diff line change @@ -664,6 +664,8 @@ export class LlamaCompletion {
664664
665665 if ( text . endsWith ( UNKNOWN_UNICODE_CHAR ) || (
666666 ( grammar ?. trimWhitespaceSuffix || trimWhitespaceSuffix ) && text . trim ( ) === ""
667+ ) || (
668+ text === "" && locksToReleaseOnValidGeneration . length > 0 && ! model . isSpecialToken ( token )
667669 ) ) {
668670 locksToReleaseOnValidGeneration . push ( queuedTokenRelease . createTextIndexLock ( 0 ) ) ;
669671 } else {
You can’t perform that action at this time.
0 commit comments