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