Add empty tool calls to streaming processors

This commit is contained in:
Cohee 2024-10-02 01:59:53 +03:00
parent e8b9720425
commit 3335dbf1a7
3 changed files with 4 additions and 3 deletions

View File

@ -188,7 +188,7 @@ export async function generateKoboldWithStreaming(generate_data, signal) {
if (data?.token) {
text += data.token;
}
yield { text, swipes: [] };
yield { text, swipes: [], toolCalls: [] };
}
};
}

View File

@ -746,7 +746,7 @@ export async function generateNovelWithStreaming(generate_data, signal) {
text += data.token;
}
yield { text, swipes: [], logprobs: parseNovelAILogprobs(data.logprobs) };
yield { text, swipes: [], logprobs: parseNovelAILogprobs(data.logprobs), toolCalls: [] };
}
};
}

View File

@ -916,6 +916,7 @@ async function generateTextGenWithStreaming(generate_data, signal) {
/** @type {import('./logprobs.js').TokenLogprobs | null} */
let logprobs = null;
const swipes = [];
const toolCalls = [];
while (true) {
const { done, value } = await reader.read();
if (done) return;
@ -934,7 +935,7 @@ async function generateTextGenWithStreaming(generate_data, signal) {
logprobs = parseTextgenLogprobs(newText, data.choices?.[0]?.logprobs || data?.completion_probabilities);
}
yield { text, swipes, logprobs };
yield { text, swipes, logprobs, toolCalls };
}
};
}