SimpleChatTC:Get body also for Not Ok responses from ai server

Rather a chat with gpt-oss generated a assistant response which
included chat-content, chat-reasoning and chat-toolcall all in the
same response. On responding to same with tool call result, the
server http handshake responded with a 500 Internal server error,
So added this to get more details in this case, as well as in
general for future.
This commit is contained in:
hanishkvc 2025-11-08 01:51:52 +05:30
parent 0628226ea1
commit 272e2689f7
2 changed files with 4 additions and 1 deletions

View File

@ -674,6 +674,8 @@ sliding window based drop off or even before they kick in, this can help in many
rss files, because it will return empty content, because there wont be any html content to strip the tags rss files, because it will return empty content, because there wont be any html content to strip the tags
and unwanted blocks before returning. and unwanted blocks before returning.
* capture the body of ai server not ok responses, to help debug as well as to show same to user.
#### ToDo #### ToDo

View File

@ -732,7 +732,8 @@ class SimpleChat {
}); });
if (resp.status >= 300) { if (resp.status >= 300) {
throw new ChatHSError(`HandleChatHS:GotResponse:NotOk:${resp.status}:${resp.statusText}`); let respBody = await resp.text();
throw new ChatHSError(`HandleChatHS:GotResponse:NotOk:${resp.status}:${resp.statusText}:${respBody}`);
} }
return this.handle_response(resp, apiEP, elDivChat); return this.handle_response(resp, apiEP, elDivChat);