Skip to content

Conversation

TeoZosa
Copy link
Contributor

@TeoZosa TeoZosa commented Aug 21, 2025

Warning

(unintentionally) Duplicates #15462. Will close once that is merged.


Fixes Web UI compatibility after #15444.
Thanks to @h9j6k for catching this:

can't access property "delta", ie.choices[0] is undefined in a browser pop-up error msg when using llama-server

Closes:


TODO: rebuild the WebUI static files (I don't have reliable network at the moment; will get to this once that's resolved)

@TeoZosa TeoZosa force-pushed the server/fix/chat-completion-chunk-empty-choices-access-in-web-ui branch from 5081a85 to 8753070 Compare August 21, 2025 02:19
throw new Error(chunk.error?.message || 'Unknown error');
}
const addedContent = chunk.choices[0].delta.content;
const addedContent = chunk.choices?.[0].delta.content;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only PR change. Returning undefined if choices is an empty array (aligning to the behavior of returning undefined if delta doesn't have a content field).

@TeoZosa TeoZosa changed the title server: fix web UI access of final chunk with empty choices array [WIP] server: fix web UI access of final chunk with empty choices array Aug 21, 2025
@TeoZosa TeoZosa marked this pull request as draft August 21, 2025 02:39
@TeoZosa
Copy link
Contributor Author

TeoZosa commented Aug 21, 2025

Closed in favor of:

@TeoZosa TeoZosa closed this Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant