mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
fix(server): crashes due to req.body being undefined
This commit is contained in:
parent
b3270ae7c8
commit
59296f3045
@ -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';
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user