modelfusion 0.92.0 → 0.92.1
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/core/api/ApiCallError.cjs +9 -1
- package/core/api/ApiCallError.d.ts +4 -1
- package/core/api/ApiCallError.js +9 -1
- package/model-provider/ollama/OllamaError.cjs +25 -24
- package/model-provider/ollama/OllamaError.d.ts +1 -11
- package/model-provider/ollama/OllamaError.js +24 -22
- package/model-provider/ollama/OllamaTextGenerationModel.cjs +38 -1
- package/model-provider/ollama/OllamaTextGenerationModel.d.ts +5 -1
- package/model-provider/ollama/OllamaTextGenerationModel.js +39 -2
- package/model-provider/ollama/OllamaTextGenerationModel.test.cjs +63 -0
- package/model-provider/ollama/OllamaTextGenerationModel.test.d.ts +1 -0
- package/model-provider/ollama/OllamaTextGenerationModel.test.js +61 -0
- package/model-provider/ollama/index.cjs +1 -3
- package/model-provider/ollama/index.d.ts +1 -1
- package/model-provider/ollama/index.js +0 -1
- package/model-provider/openai/OpenAIError.cjs +13 -29
- package/model-provider/openai/OpenAIError.d.ts +2 -11
- package/model-provider/openai/OpenAIError.js +11 -26
- package/model-provider/openai/index.cjs +1 -3
- package/model-provider/openai/index.d.ts +1 -1
- package/model-provider/openai/index.js +0 -1
- package/model-provider/whispercpp/WhisperCppTranscriptionModel.cjs +5 -8
- package/model-provider/whispercpp/WhisperCppTranscriptionModel.js +5 -8
- package/package.json +5 -4
- package/util/AsyncQueue.test.cjs +20 -21
- package/util/AsyncQueue.test.js +9 -10
- package/util/isDeepEqualData.test.cjs +14 -15
- package/util/isDeepEqualData.test.js +14 -15
- package/util/runSafe.test.cjs +12 -13
- package/util/runSafe.test.js +6 -7
package/util/runSafe.test.cjs
CHANGED
@@ -1,58 +1,57 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const vitest_1 = require("vitest");
|
4
3
|
const runSafe_js_1 = require("./runSafe.cjs");
|
5
|
-
(
|
4
|
+
it("should catch thrown error in sync function", async () => {
|
6
5
|
const error = new Error("test error");
|
7
6
|
const result = await (0, runSafe_js_1.runSafe)(() => {
|
8
7
|
throw error;
|
9
8
|
});
|
10
|
-
|
9
|
+
expect(result).toEqual({
|
11
10
|
ok: false,
|
12
11
|
error,
|
13
12
|
});
|
14
13
|
});
|
15
|
-
(
|
14
|
+
it("should catch thrown string in sync function", async () => {
|
16
15
|
const result = await (0, runSafe_js_1.runSafe)(() => {
|
17
16
|
throw "test error";
|
18
17
|
});
|
19
|
-
|
18
|
+
expect(result).toEqual({
|
20
19
|
ok: false,
|
21
20
|
error: "test error",
|
22
21
|
});
|
23
22
|
});
|
24
|
-
(
|
23
|
+
it("should catch thrown error in async function", async () => {
|
25
24
|
const error = new Error("test error");
|
26
25
|
const result = await (0, runSafe_js_1.runSafe)(async () => {
|
27
26
|
throw error;
|
28
27
|
});
|
29
|
-
|
28
|
+
expect(result).toEqual({
|
30
29
|
ok: false,
|
31
30
|
error,
|
32
31
|
});
|
33
32
|
});
|
34
|
-
(
|
33
|
+
it("should catch thrown string in async function", async () => {
|
35
34
|
const result = await (0, runSafe_js_1.runSafe)(async () => {
|
36
35
|
throw "test error";
|
37
36
|
});
|
38
|
-
|
37
|
+
expect(result).toEqual({
|
39
38
|
ok: false,
|
40
39
|
error: "test error",
|
41
40
|
});
|
42
41
|
});
|
43
|
-
(
|
42
|
+
it("should catch rejected Promise", async () => {
|
44
43
|
const error = new Error("test error");
|
45
44
|
const result = await (0, runSafe_js_1.runSafe)(async () => {
|
46
45
|
return Promise.reject(error);
|
47
46
|
});
|
48
|
-
|
47
|
+
expect(result).toEqual({
|
49
48
|
ok: false,
|
50
49
|
error,
|
51
50
|
});
|
52
51
|
});
|
53
|
-
(
|
52
|
+
it("should not throw error", async () => {
|
54
53
|
const result = await (0, runSafe_js_1.runSafe)(async () => "result");
|
55
|
-
|
54
|
+
expect(result).toEqual({
|
56
55
|
ok: true,
|
57
56
|
value: "result",
|
58
57
|
});
|
package/util/runSafe.test.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
import { expect, test } from "vitest";
|
2
1
|
import { runSafe } from "./runSafe.js";
|
3
|
-
|
2
|
+
it("should catch thrown error in sync function", async () => {
|
4
3
|
const error = new Error("test error");
|
5
4
|
const result = await runSafe(() => {
|
6
5
|
throw error;
|
@@ -10,7 +9,7 @@ test("catch thrown error in sync function", async () => {
|
|
10
9
|
error,
|
11
10
|
});
|
12
11
|
});
|
13
|
-
|
12
|
+
it("should catch thrown string in sync function", async () => {
|
14
13
|
const result = await runSafe(() => {
|
15
14
|
throw "test error";
|
16
15
|
});
|
@@ -19,7 +18,7 @@ test("catch thrown string in sync function", async () => {
|
|
19
18
|
error: "test error",
|
20
19
|
});
|
21
20
|
});
|
22
|
-
|
21
|
+
it("should catch thrown error in async function", async () => {
|
23
22
|
const error = new Error("test error");
|
24
23
|
const result = await runSafe(async () => {
|
25
24
|
throw error;
|
@@ -29,7 +28,7 @@ test("catch thrown error in async function", async () => {
|
|
29
28
|
error,
|
30
29
|
});
|
31
30
|
});
|
32
|
-
|
31
|
+
it("should catch thrown string in async function", async () => {
|
33
32
|
const result = await runSafe(async () => {
|
34
33
|
throw "test error";
|
35
34
|
});
|
@@ -38,7 +37,7 @@ test("catch thrown string in async function", async () => {
|
|
38
37
|
error: "test error",
|
39
38
|
});
|
40
39
|
});
|
41
|
-
|
40
|
+
it("should catch rejected Promise", async () => {
|
42
41
|
const error = new Error("test error");
|
43
42
|
const result = await runSafe(async () => {
|
44
43
|
return Promise.reject(error);
|
@@ -48,7 +47,7 @@ test("catch rejected Promise", async () => {
|
|
48
47
|
error,
|
49
48
|
});
|
50
49
|
});
|
51
|
-
|
50
|
+
it("should not throw error", async () => {
|
52
51
|
const result = await runSafe(async () => "result");
|
53
52
|
expect(result).toEqual({
|
54
53
|
ok: true,
|