fix(server): crashes due to req.body being undefined

This commit is contained in:
Elian Doran 2025-06-12 15:01:35 +03:00
parent b3270ae7c8
commit 59296f3045
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View File

@ -48,7 +48,7 @@ import OpenAI from "openai";
*/ */
async function listModels(req: Request, res: Response) { async function listModels(req: Request, res: Response) {
try { try {
const { baseUrl } = req.body; const { baseUrl } = req.body ?? {};
// Use provided base URL or default from options // Use provided base URL or default from options
const openaiBaseUrl = baseUrl || await options.getOption('openaiBaseUrl') || 'https://api.openai.com/v1'; const openaiBaseUrl = baseUrl || await options.getOption('openaiBaseUrl') || 'https://api.openai.com/v1';

View File

@ -118,7 +118,7 @@ function getRelationBundles(req: Request) {
function getBundle(req: Request) { function getBundle(req: Request) {
const note = becca.getNoteOrThrow(req.params.noteId); const note = becca.getNoteOrThrow(req.params.noteId);
const { script, params } = req.body; const { script, params } = req.body ?? {};
return scriptService.getScriptBundleForFrontend(note, script, params); return scriptService.getScriptBundleForFrontend(note, script, params);
} }