🐛 remove stop token from hf response
This commit is contained in:
parent
2c395fb66b
commit
8366aef668
1 changed files with 6 additions and 1 deletions
|
|
@ -35,7 +35,12 @@ class HuggingFaceInferenceAPI extends BaseLLM {
|
|||
}),
|
||||
});
|
||||
for await (const chunk of streamSse(response)) {
|
||||
yield chunk?.token?.text || "";
|
||||
let text = chunk?.token?.text ?? "";
|
||||
if (text.endsWith("</s>")) {
|
||||
yield text.slice(0, -5);
|
||||
} else {
|
||||
yield text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue