mirror of
https://github.com/open-webui/open-webui
synced 2025-01-30 14:29:55 +00:00
fix: missing openai usage information
This commit is contained in:
parent
534c18c94c
commit
283234d51d
@ -1128,7 +1128,6 @@
|
|||||||
|
|
||||||
if (res && res.ok && res.body) {
|
if (res && res.ok && res.body) {
|
||||||
const textStream = await createOpenAITextStream(res.body, $settings.splitLargeChunks);
|
const textStream = await createOpenAITextStream(res.body, $settings.splitLargeChunks);
|
||||||
let lastUsage = null;
|
|
||||||
|
|
||||||
for await (const update of textStream) {
|
for await (const update of textStream) {
|
||||||
const { value, done, citations, error, usage } = update;
|
const { value, done, citations, error, usage } = update;
|
||||||
@ -1154,7 +1153,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (usage) {
|
if (usage) {
|
||||||
lastUsage = usage;
|
responseMessage.info = { ...usage, openai: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (citations) {
|
if (citations) {
|
||||||
@ -1208,10 +1207,6 @@
|
|||||||
document.getElementById(`speak-button-${responseMessage.id}`)?.click();
|
document.getElementById(`speak-button-${responseMessage.id}`)?.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastUsage) {
|
|
||||||
responseMessage.info = { ...lastUsage, openai: true };
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($chatId == _chatId) {
|
if ($chatId == _chatId) {
|
||||||
if ($settings.saveChatHistory ?? true) {
|
if ($settings.saveChatHistory ?? true) {
|
||||||
chat = await updateChatById(localStorage.token, _chatId, {
|
chat = await updateChatById(localStorage.token, _chatId, {
|
||||||
|
Loading…
Reference in New Issue
Block a user