From 721ebaaed3b048f93d14553b31b004fc007fc759 Mon Sep 17 00:00:00 2001 From: Rick Hennigan Date: Mon, 25 Nov 2024 12:47:25 -0500 Subject: [PATCH 1/2] Bugfix: Allow HTTP status code 100 in responses --- Source/Chatbook/LLMUtilities.wl | 2 +- Source/Chatbook/SendChat.wl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Chatbook/LLMUtilities.wl b/Source/Chatbook/LLMUtilities.wl index 2853c5bc..e4923f72 100644 --- a/Source/Chatbook/LLMUtilities.wl +++ b/Source/Chatbook/LLMUtilities.wl @@ -238,7 +238,7 @@ extractBodyChunks0 // endDefinition; (* ::Subsubsection::Closed:: *) (*apiFailureQ*) apiFailureQ // beginDefinition; -apiFailureQ[ Failure[ "APIError", KeyValuePattern[ "StatusCode" -> Except[ 200, _Integer ] ] ] ] := True; +apiFailureQ[ Failure[ "APIError", KeyValuePattern[ "StatusCode" -> Except[ 100|200, _Integer ] ] ] ] := True; apiFailureQ[ _ ] := False; apiFailureQ // endDefinition; diff --git a/Source/Chatbook/SendChat.wl b/Source/Chatbook/SendChat.wl index bb32221f..536a3208 100644 --- a/Source/Chatbook/SendChat.wl +++ b/Source/Chatbook/SendChat.wl @@ -1060,7 +1060,7 @@ writeResult[ settings_, container_, cell_, as_Association ] := Enclose[ $lastFullResponseData = <| "Body" -> body, "Processed" -> processed, "Data" -> data |>; - Which[ MatchQ[ as[ "StatusCode" ], Except[ 200, _Integer ] ] || (processed === "" && AssociationQ @ data), + Which[ MatchQ[ as[ "StatusCode" ], Except[ 100|200, _Integer ] ] || (processed === "" && AssociationQ @ data), writeErrorCell[ cell, $badResponse = Association[ as, "Body" -> body, "BodyJSON" -> data ] ] , processed === body === "", @@ -2793,7 +2793,7 @@ errorBoxes[ as: KeyValuePattern[ "Error" -> "ServerResponseEmpty" ] ] := errorBoxes[ as: KeyValuePattern[ "StatusCode" -> 429 ] ] := ToBoxes @ messageFailure[ "RateLimitReached", as ]; -errorBoxes[ as: KeyValuePattern[ "StatusCode" -> code: Except[ 200 ] ] ] := +errorBoxes[ as: KeyValuePattern[ "StatusCode" -> code: Except[ 100|200 ] ] ] := ToBoxes @ messageFailure[ "UnknownStatusCode", as ]; errorBoxes[ failure_Failure ] := From 70b066b9b2c6882d4aa5a876a7945fb97c425859 Mon Sep 17 00:00:00 2001 From: Rick Hennigan Date: Mon, 25 Nov 2024 12:47:44 -0500 Subject: [PATCH 2/2] Paclet version --- PacletInfo.wl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PacletInfo.wl b/PacletInfo.wl index 9936fde7..351de2cf 100644 --- a/PacletInfo.wl +++ b/PacletInfo.wl @@ -1,7 +1,7 @@ PacletObject[ <| "Name" -> "Wolfram/Chatbook", "PublisherID" -> "Wolfram", - "Version" -> "1.5.2.4", + "Version" -> "1.5.2.5", "WolframVersion" -> "14.1+", "Description" -> "Wolfram Notebooks + LLMs", "License" -> "MIT",