fix for openai token limit error (#350)

This commit is contained in:
Abror Aliboyev authored and GitHub committed 2023-04-01 22:46:32 -06:00
1 parent 8f3a3ae3e7
commit 462ca9bb04
1 file changed
+1 -1
+1 -1
View File
@@ -35,7 +35,7 @@ const handler = async (req: Request): Promise<Response> => {
const message = messages[i];
const tokens = encoding.encode(message.content);
if (tokenCount + tokens.length > model.tokenLimit) {
if (tokenCount + tokens.length + 1000 > model.tokenLimit) {
break;
}
tokenCount += tokens.length;