@intuned/browser-dev 0.1.12-dev.0 → 0.1.13-dev.0
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.
|
@@ -477,13 +477,15 @@ var _validateDataUsingSchema = require("../validateDataUsingSchema");
|
|
|
477
477
|
(0, _extendedTest.expect)(attachmentProps.suggestedFileName).toBeDefined();
|
|
478
478
|
(0, _extendedTest.expect)(baseSchema.required).toBeDefined();
|
|
479
479
|
(0, _extendedTest.expect)(baseSchema.required).toContain("fileName");
|
|
480
|
-
(0, _extendedTest.expect)(baseSchema.required).toContain("bucket");
|
|
481
|
-
(0, _extendedTest.expect)(baseSchema.required).toContain("region");
|
|
480
|
+
(0, _extendedTest.expect)(baseSchema.required).not.toContain("bucket");
|
|
481
|
+
(0, _extendedTest.expect)(baseSchema.required).not.toContain("region");
|
|
482
482
|
(0, _extendedTest.expect)(baseSchema.required).toContain("key");
|
|
483
483
|
(0, _extendedTest.expect)(baseSchema.required).toContain("suggestedFileName");
|
|
484
|
+
(0, _extendedTest.expect)(attachmentProps.bucket).toBeDefined();
|
|
485
|
+
(0, _extendedTest.expect)(attachmentProps.region).toBeDefined();
|
|
484
486
|
const signedUrlSchema = result.$defs.attachment.anyOf[0];
|
|
485
487
|
(0, _extendedTest.expect)(signedUrlSchema.type).toBe("object");
|
|
486
|
-
(0, _extendedTest.expect)(signedUrlSchema.properties.
|
|
488
|
+
(0, _extendedTest.expect)(signedUrlSchema.properties.signedUrl).toBeDefined();
|
|
487
489
|
});
|
|
488
490
|
});
|
|
489
491
|
});
|
|
@@ -88,16 +88,15 @@ class APIGateway {
|
|
|
88
88
|
const modelLower = model.toLowerCase();
|
|
89
89
|
return (0, _getModelProvider.getModelProvider)(modelLower);
|
|
90
90
|
}
|
|
91
|
-
buildGatewayUrl(
|
|
91
|
+
buildGatewayUrl() {
|
|
92
92
|
var _this$config$function;
|
|
93
93
|
if (!this.config) {
|
|
94
94
|
throw new Error("Gateway configuration not initialized");
|
|
95
95
|
}
|
|
96
96
|
const baseDomain = (_this$config$function = this.config.functionsDomain) === null || _this$config$function === void 0 ? void 0 : _this$config$function.replace(/\/$/, "");
|
|
97
|
-
return `${baseDomain}/api/${this.config.workspaceId}/functions/${this.config.integrationId}
|
|
97
|
+
return `${baseDomain}/api/${this.config.workspaceId}/functions/${this.config.integrationId}/intuned-ai-gateway`;
|
|
98
98
|
}
|
|
99
99
|
getModelConfig(extraHeaders) {
|
|
100
|
-
const provider = this.detectProvider(this.model);
|
|
101
100
|
if (!this.useGateway && this.apiKey) {
|
|
102
101
|
return {
|
|
103
102
|
model: this.model,
|
|
@@ -106,7 +105,7 @@ class APIGateway {
|
|
|
106
105
|
baseUrl: undefined
|
|
107
106
|
};
|
|
108
107
|
}
|
|
109
|
-
const baseUrl = this.buildGatewayUrl(
|
|
108
|
+
const baseUrl = this.buildGatewayUrl();
|
|
110
109
|
return {
|
|
111
110
|
model: this.model,
|
|
112
111
|
apiKey: "--THIS_VALUE_WILL_BE_REPLACED_BY_INTUNED_BE--",
|
|
@@ -118,8 +118,8 @@ const mockLoadRuntime = _vitest.vi.mocked(_loadRuntime.loadRuntime);
|
|
|
118
118
|
model: "claude-3-sonnet"
|
|
119
119
|
});
|
|
120
120
|
await gateway["ensureInitialized"]();
|
|
121
|
-
const result = gateway["buildGatewayUrl"](
|
|
122
|
-
(0, _extendedTest.expect)(result).toBe("https://functions.example.com/api/workspace123/functions/integration456/
|
|
121
|
+
const result = gateway["buildGatewayUrl"]();
|
|
122
|
+
(0, _extendedTest.expect)(result).toBe("https://functions.example.com/api/workspace123/functions/integration456/intuned-ai-gateway");
|
|
123
123
|
});
|
|
124
124
|
(0, _extendedTest.it)("should build correct URL for google_vertexai", async () => {
|
|
125
125
|
mockGetModelProvider.mockReturnValue("google_vertexai");
|
|
@@ -130,8 +130,8 @@ const mockLoadRuntime = _vitest.vi.mocked(_loadRuntime.loadRuntime);
|
|
|
130
130
|
model: "gemini-pro"
|
|
131
131
|
});
|
|
132
132
|
await gateway["ensureInitialized"]();
|
|
133
|
-
const result = gateway["buildGatewayUrl"](
|
|
134
|
-
(0, _extendedTest.expect)(result).toBe("https://functions.example.com/api/workspace123/functions/integration456/
|
|
133
|
+
const result = gateway["buildGatewayUrl"]();
|
|
134
|
+
(0, _extendedTest.expect)(result).toBe("https://functions.example.com/api/workspace123/functions/integration456/intuned-ai-gateway");
|
|
135
135
|
});
|
|
136
136
|
(0, _extendedTest.it)("should build correct URL for other providers", async () => {
|
|
137
137
|
mockGetModelProvider.mockReturnValue("openai");
|
|
@@ -142,8 +142,8 @@ const mockLoadRuntime = _vitest.vi.mocked(_loadRuntime.loadRuntime);
|
|
|
142
142
|
model: "gpt-4"
|
|
143
143
|
});
|
|
144
144
|
await gateway["ensureInitialized"]();
|
|
145
|
-
const result = gateway["buildGatewayUrl"](
|
|
146
|
-
(0, _extendedTest.expect)(result).toBe("https://functions.example.com/api/workspace123/functions/integration456/
|
|
145
|
+
const result = gateway["buildGatewayUrl"]();
|
|
146
|
+
(0, _extendedTest.expect)(result).toBe("https://functions.example.com/api/workspace123/functions/integration456/intuned-ai-gateway");
|
|
147
147
|
});
|
|
148
148
|
(0, _extendedTest.it)("should strip trailing slash from domain", async () => {
|
|
149
149
|
process.env.FUNCTIONS_DOMAIN = "https://functions.example.com/";
|
|
@@ -155,8 +155,8 @@ const mockLoadRuntime = _vitest.vi.mocked(_loadRuntime.loadRuntime);
|
|
|
155
155
|
model: "gpt-4"
|
|
156
156
|
});
|
|
157
157
|
await newGateway["ensureInitialized"]();
|
|
158
|
-
const result = newGateway["buildGatewayUrl"](
|
|
159
|
-
(0, _extendedTest.expect)(result).toBe("https://functions.example.com/api/workspace123/functions/integration456/
|
|
158
|
+
const result = newGateway["buildGatewayUrl"]();
|
|
159
|
+
(0, _extendedTest.expect)(result).toBe("https://functions.example.com/api/workspace123/functions/integration456/intuned-ai-gateway");
|
|
160
160
|
});
|
|
161
161
|
});
|
|
162
162
|
(0, _extendedTest.describe)("ensureInitialized", () => {
|
|
@@ -236,7 +236,7 @@ const mockLoadRuntime = _vitest.vi.mocked(_loadRuntime.loadRuntime);
|
|
|
236
236
|
apiKey: "--THIS_VALUE_WILL_BE_REPLACED_BY_INTUNED_BE--",
|
|
237
237
|
headers: undefined,
|
|
238
238
|
model: "claude-3-sonnet",
|
|
239
|
-
baseUrl: "https://functions.example.com/api/workspace123/functions/integration456/
|
|
239
|
+
baseUrl: "https://functions.example.com/api/workspace123/functions/integration456/intuned-ai-gateway"
|
|
240
240
|
});
|
|
241
241
|
(0, _extendedTest.expect)(result).toBe(mockInstance);
|
|
242
242
|
});
|