Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sestinj committed Jan 16, 2024
2 parents c2c4984 + 982c0cd commit dbbccef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/llm/llms/Ollama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class Ollama extends BaseLLM {
buffer += value;
// Split the buffer into individual JSON chunks
const chunks = buffer.split("\n");

for (let i = 0; i < chunks.length; i++) {
const chunk = chunks[i];
if (chunk.trim() !== "") {
Expand Down Expand Up @@ -161,6 +162,7 @@ class Ollama extends BaseLLM {
buffer += value;
// Split the buffer into individual JSON chunks
const chunks = buffer.split("\n");
buffer = chunks.pop() ?? '';
for (let i = 0; i < chunks.length; i++) {
const chunk = chunks[i];
if (chunk.trim() !== "") {
Expand All @@ -179,8 +181,6 @@ class Ollama extends BaseLLM {
}
}
}
// Assign the last chunk to the buffer
buffer = chunks[chunks.length - 1];
}
}
}
Expand Down

0 comments on commit dbbccef

Please sign in to comment.