Split on more than `"\n`

pull/1/head
Drake 2 years ago
parent 827107f337
commit cf6e88648e

@ -81,7 +81,7 @@ class HuggingFaceAI {
const ctx = this.memory.slice(this.memoryLen * -2);
const prompt = `${this.prefix}\n${ctx.join("\n")}\n${username}: "${message}"\n${this.name}: "`;
const res = await this.#query(prompt);
const botMsg = res[0].generated_text.split('"\n')[0];
const botMsg = res[0].generated_text.split(/"[.?!\n]?/gm)[0];
this.memory.push(`${username}: "${message}"`);
this.memory.push(`${this.name}: "${botMsg}"`);
console.log(`${this.name}: "${botMsg}"`);

Loading…
Cancel
Save