|
@@ -2,6 +2,7 @@ import { type IUserHasId } from '@growi/core';
|
|
|
import { ErrorV3 } from '@growi/core/dist/models';
|
|
import { ErrorV3 } from '@growi/core/dist/models';
|
|
|
import type { Request, RequestHandler } from 'express';
|
|
import type { Request, RequestHandler } from 'express';
|
|
|
|
|
|
|
|
|
|
+import { SCOPE } from '~/interfaces/scope';
|
|
|
import type Crowi from '~/server/crowi';
|
|
import type Crowi from '~/server/crowi';
|
|
|
import { accessTokenParser } from '~/server/middlewares/access-token-parser';
|
|
import { accessTokenParser } from '~/server/middlewares/access-token-parser';
|
|
|
import { apiV3FormValidator } from '~/server/middlewares/apiv3-form-validator';
|
|
import { apiV3FormValidator } from '~/server/middlewares/apiv3-form-validator';
|
|
@@ -28,7 +29,7 @@ export const createAiAssistantFactory: CreateAssistantFactory = (crowi) => {
|
|
|
const loginRequiredStrictly = require('~/server/middlewares/login-required')(crowi);
|
|
const loginRequiredStrictly = require('~/server/middlewares/login-required')(crowi);
|
|
|
|
|
|
|
|
return [
|
|
return [
|
|
|
- accessTokenParser, loginRequiredStrictly, certifyAiService, upsertAiAssistantValidator, apiV3FormValidator,
|
|
|
|
|
|
|
+ accessTokenParser([SCOPE.WRITE.BASE.AI_ASSISTANT]), loginRequiredStrictly, certifyAiService, upsertAiAssistantValidator, apiV3FormValidator,
|
|
|
async(req: Req, res: ApiV3Response) => {
|
|
async(req: Req, res: ApiV3Response) => {
|
|
|
const openaiService = getOpenaiService();
|
|
const openaiService = getOpenaiService();
|
|
|
if (openaiService == null) {
|
|
if (openaiService == null) {
|