save request errors to a log file
This commit is contained in:
@@ -127,7 +127,6 @@ async function run(options: RunOptions = {}) {
|
|||||||
|
|
||||||
const server = await createServer(servicePort);
|
const server = await createServer(servicePort);
|
||||||
server.useMiddleware((req, res, next) => {
|
server.useMiddleware((req, res, next) => {
|
||||||
console.log("Middleware triggered for request:", req.body.model);
|
|
||||||
req.config = config;
|
req.config = config;
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
@@ -153,7 +152,7 @@ async function run(options: RunOptions = {}) {
|
|||||||
const completion: any = await provider.chat.completions.create(req.body);
|
const completion: any = await provider.chat.completions.create(req.body);
|
||||||
await streamOpenAIResponse(res, completion, req.body.model, req.body);
|
await streamOpenAIResponse(res, completion, req.body.model, req.body);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Error in OpenAI API call:", e);
|
log("Error in OpenAI API call:", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
server.start();
|
server.start();
|
||||||
|
|||||||
Reference in New Issue
Block a user