anbaric-state-machine 1.14.0 → 1.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anbaric-state-machine",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.2",
|
|
4
4
|
"description": "This is the state machine library that one can use to add state management to an application. It will, by default, be locally runnable but can deployed to the Anbaric Cloud via the CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "chris@anbaric.ai",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"typescript": "^7.0.2"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"anbaric-impl-cloud": "^1.14.
|
|
19
|
-
"anbaric-tsapi": "^1.14.
|
|
18
|
+
"anbaric-impl-cloud": "^1.14.2",
|
|
19
|
+
"anbaric-tsapi": "^1.14.2"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"src"
|
|
@@ -57,11 +57,11 @@ class OpenAIClient extends Agent.Client {
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
if (!response.ok) {
|
|
60
|
-
const problem = await response.json().catch(() => ({}));
|
|
60
|
+
const problem = await response.json().catch(() => ({})) as { error? : { message? : string } };
|
|
61
61
|
throw new Error(`The OpenAI request failed with status ${response.status}${problem.error?.message ? `: ${problem.error.message}` : ""}`);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
const body = await response.json();
|
|
64
|
+
const body = await response.json() as { choices? : Array<{ message? : { content? : string } }> };
|
|
65
65
|
const content = body.choices?.[0]?.message?.content;
|
|
66
66
|
if (typeof content !== "string") throw new Error("The OpenAI response carried no structured content");
|
|
67
67
|
return JSON.parse(content);
|