Add empty tool calls to streaming processors
This commit is contained in:
parent
e8b9720425
commit
3335dbf1a7
|
@ -188,7 +188,7 @@ export async function generateKoboldWithStreaming(generate_data, signal) {
|
||||||
if (data?.token) {
|
if (data?.token) {
|
||||||
text += data.token;
|
text += data.token;
|
||||||
}
|
}
|
||||||
yield { text, swipes: [] };
|
yield { text, swipes: [], toolCalls: [] };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -746,7 +746,7 @@ export async function generateNovelWithStreaming(generate_data, signal) {
|
||||||
text += data.token;
|
text += data.token;
|
||||||
}
|
}
|
||||||
|
|
||||||
yield { text, swipes: [], logprobs: parseNovelAILogprobs(data.logprobs) };
|
yield { text, swipes: [], logprobs: parseNovelAILogprobs(data.logprobs), toolCalls: [] };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -916,6 +916,7 @@ async function generateTextGenWithStreaming(generate_data, signal) {
|
||||||
/** @type {import('./logprobs.js').TokenLogprobs | null} */
|
/** @type {import('./logprobs.js').TokenLogprobs | null} */
|
||||||
let logprobs = null;
|
let logprobs = null;
|
||||||
const swipes = [];
|
const swipes = [];
|
||||||
|
const toolCalls = [];
|
||||||
while (true) {
|
while (true) {
|
||||||
const { done, value } = await reader.read();
|
const { done, value } = await reader.read();
|
||||||
if (done) return;
|
if (done) return;
|
||||||
|
@ -934,7 +935,7 @@ async function generateTextGenWithStreaming(generate_data, signal) {
|
||||||
logprobs = parseTextgenLogprobs(newText, data.choices?.[0]?.logprobs || data?.completion_probabilities);
|
logprobs = parseTextgenLogprobs(newText, data.choices?.[0]?.logprobs || data?.completion_probabilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
yield { text, swipes, logprobs };
|
yield { text, swipes, logprobs, toolCalls };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue