openai-api-mock 0.1.26 → 0.1.28
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/dist/{index.cjs.js → index.cjs} +4 -4
- package/dist/index.cjs.map +1 -0
- package/dist/{index.es.js → index.js} +4 -4
- package/dist/index.js.map +1 -0
- package/package.json +5 -5
- package/src/index.js +5 -8
- package/vite.config.js +2 -1
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js.map +0 -1
|
@@ -2197,8 +2197,8 @@ function mockOpenAIResponse(force = false, options = {}) {
|
|
|
2197
2197
|
if (env !== "development" && !force) {
|
|
2198
2198
|
return { isActive: false, stopMocking };
|
|
2199
2199
|
}
|
|
2200
|
-
latency > 0 ? nock.
|
|
2201
|
-
|
|
2200
|
+
const mockWithDelay = latency > 0 ? nock(OPEN_AI_BASE_URL).delay(latency) : nock(OPEN_AI_BASE_URL);
|
|
2201
|
+
mockWithDelay.post(CHAT_COMPLETIONS_ENDPOINT).reply(function(uri, requestBody) {
|
|
2202
2202
|
if (logRequests) {
|
|
2203
2203
|
console.log(`[openai-api-mock] Chat request:`, JSON.stringify(requestBody, null, 2));
|
|
2204
2204
|
}
|
|
@@ -2220,7 +2220,7 @@ function mockOpenAIResponse(force = false, options = {}) {
|
|
|
2220
2220
|
return [500, { error: { message: "Internal server error in mock" } }];
|
|
2221
2221
|
}
|
|
2222
2222
|
});
|
|
2223
|
-
|
|
2223
|
+
mockWithDelay.post(IMAGE_GENERATIONS_ENDPOINT).reply(function(uri, requestBody) {
|
|
2224
2224
|
if (logRequests) {
|
|
2225
2225
|
console.log(`[openai-api-mock] Image request:`, JSON.stringify(requestBody, null, 2));
|
|
2226
2226
|
}
|
|
@@ -2262,4 +2262,4 @@ export {
|
|
|
2262
2262
|
mockOpenAIResponse,
|
|
2263
2263
|
stopMocking
|
|
2264
2264
|
};
|
|
2265
|
-
//# sourceMappingURL=index.
|
|
2265
|
+
//# sourceMappingURL=index.js.map
|