File tree 2 files changed +5
-0
lines changed 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -2217,6 +2217,9 @@ class GenerateResponseState<const Functions extends ChatModelFunctions | undefin
2217
2217
public waitOnPartialCharactersOrWhiteSpaceTokens ( ) {
2218
2218
if ( this . currentText . endsWith ( UNKNOWN_UNICODE_CHAR ) || (
2219
2219
( this . grammar ?. trimWhitespaceSuffix || this . trimWhitespaceSuffix ) && this . currentText ?. trim ( ) === ""
2220
+ ) || (
2221
+ this . currentText === "" && this . locksToReleaseOnValidGeneration . length > 0 &&
2222
+ ! this . llamaChat . model . isSpecialToken ( this . currentToken )
2220
2223
) ) {
2221
2224
if ( this . currentQueuedTokenRelease != null )
2222
2225
this . locksToReleaseOnValidGeneration . push ( this . currentQueuedTokenRelease . createTextIndexLock ( 0 ) ) ;
Original file line number Diff line number Diff line change @@ -664,6 +664,8 @@ export class LlamaCompletion {
664
664
665
665
if ( text . endsWith ( UNKNOWN_UNICODE_CHAR ) || (
666
666
( grammar ?. trimWhitespaceSuffix || trimWhitespaceSuffix ) && text . trim ( ) === ""
667
+ ) || (
668
+ text === "" && locksToReleaseOnValidGeneration . length > 0 && ! model . isSpecialToken ( token )
667
669
) ) {
668
670
locksToReleaseOnValidGeneration . push ( queuedTokenRelease . createTextIndexLock ( 0 ) ) ;
669
671
} else {
You can’t perform that action at this time.
0 commit comments