Bläddra i källkod

improve validation

Yuki Takei 1 år sedan
förälder
incheckning
45668c2963
1 ändrade filer med 5 tillägg och 1 borttagningar
  1. 5 1
      apps/app/src/server/routes/apiv3/openai/message.ts

+ 5 - 1
apps/app/src/server/routes/apiv3/openai/message.ts

@@ -31,7 +31,11 @@ export const postMessageHandlersFactory: PostMessageHandlersFactory = (crowi) =>
   const loginRequiredStrictly = require('../../../middlewares/login-required')(crowi);
 
   const validator: ValidationChain[] = [
-    body('userMessage').isString().withMessage('userMessage must be string'),
+    body('userMessage')
+      .isString()
+      .withMessage('userMessage must be string')
+      .notEmpty()
+      .withMessage('userMessage must be set'),
     body('threadId').isString().withMessage('threadId must be string'),
   ];