fix error
This commit is contained in:
@@ -121,11 +121,9 @@ export class OllamaChat extends ChatCommand {
|
|||||||
try {
|
try {
|
||||||
for await (const chunk of stream) {
|
for await (const chunk of stream) {
|
||||||
if (!getOllamaRequest(uuid).done) {
|
if (!getOllamaRequest(uuid).done) {
|
||||||
const content = chunk.message.content;
|
currentText += chunk.message.content;
|
||||||
currentText += content;
|
|
||||||
|
|
||||||
const length = currentText.length;
|
if (currentText.length > 4096) {
|
||||||
if (length > 4096) {
|
|
||||||
currentText = currentText.slice(0, 4093) + "...";
|
currentText = currentText.slice(0, 4093) + "...";
|
||||||
shouldBreak = true;
|
shouldBreak = true;
|
||||||
}
|
}
|
||||||
@@ -137,7 +135,7 @@ export class OllamaChat extends ChatCommand {
|
|||||||
isOver = true;
|
isOver = true;
|
||||||
|
|
||||||
console.log("messageText", currentText);
|
console.log("messageText", currentText);
|
||||||
console.log("length", length);
|
console.log("length", currentText.length);
|
||||||
|
|
||||||
if (shouldBreak) {
|
if (shouldBreak) {
|
||||||
console.log("break", true);
|
console.log("break", true);
|
||||||
@@ -166,7 +164,7 @@ export class OllamaChat extends ChatCommand {
|
|||||||
await editor.stop();
|
await editor.stop();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.message === "This operation was aborted") return;
|
if (error.message.toLowerCase().includes("aborted")) return;
|
||||||
|
|
||||||
console.error(error);
|
console.error(error);
|
||||||
await replyToMessage(waitMessage, `Произошла ошибка!\n${error.toString()}`).catch(logError);
|
await replyToMessage(waitMessage, `Произошла ошибка!\n${error.toString()}`).catch(logError);
|
||||||
|
|||||||
Reference in New Issue
Block a user