[fix] tokenizer
This commit is contained in:
@@ -49,8 +49,10 @@ export class ChatTokenizer {
|
|||||||
this.useName = useName
|
this.useName = useName
|
||||||
}
|
}
|
||||||
async tokenizeChat(data:OpenAIChat) {
|
async tokenizeChat(data:OpenAIChat) {
|
||||||
const encoded = (await encode(data.content)).length
|
let encoded = (await encode(data.content)).length + this.chatAdditonalTokens
|
||||||
+ this.useName === 'name' ? (await encode(data.name)).length : 0 + this.chatAdditonalTokens
|
if(data.name && this.useName ==='name'){
|
||||||
|
encoded += (await encode(data.name)).length
|
||||||
|
}
|
||||||
return encoded
|
return encoded
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user