Просмотр исходного кода

AssistantOwnerAccessScope -> AssistantAccessScope

Shun Miyazawa 1 год назад
Родитель
Сommit
0c224e5cbb

+ 8 - 8
apps/app/src/features/openai/interfaces/ai-assistant.ts

@@ -6,22 +6,22 @@ import type { VectorStore } from '../server/models/vector-store';
 *  Objects
 */
 export const AiAssistantShareScope = {
-  PUBLIC: 'public',
-  ONLY_ME: 'onlyMe',
-  USER_GROUP: 'userGroup',
+  PUBLIC_ONLY: 'publicOnly',
+  OWNER: 'owner',
+  GROUPS: 'groups',
 } as const;
 
-export const AiAssistantOwnerAccessScope = {
-  PUBLIC: 'public',
-  ONLY_ME: 'onlyMe',
-  USER_GROUP: 'userGroup',
+export const AiAssistantAccessScope = {
+  PUBLIC_ONLY: 'publicOnly',
+  OWNER: 'owner',
+  GROUPS: 'groups',
 } as const;
 
 /*
 *  Interfaces
 */
 export type AiAssistantShareScope = typeof AiAssistantShareScope[keyof typeof AiAssistantShareScope];
-export type AiAssistantOwnerAccessScope = typeof AiAssistantOwnerAccessScope[keyof typeof AiAssistantOwnerAccessScope];
+export type AiAssistantOwnerAccessScope = typeof AiAssistantAccessScope[keyof typeof AiAssistantAccessScope];
 
 export interface AiAssistant {
   name: string;

+ 2 - 2
apps/app/src/features/openai/server/models/ai-assistant.ts

@@ -3,7 +3,7 @@ import { type Model, type Document, Schema } from 'mongoose';
 
 import { getOrCreateModel } from '~/server/util/mongoose-utils';
 
-import { type AiAssistant, AiAssistantShareScope, AiAssistantOwnerAccessScope } from '../../interfaces/ai-assistant';
+import { type AiAssistant, AiAssistantShareScope, AiAssistantAccessScope } from '../../interfaces/ai-assistant';
 
 export interface AiAssistantDocument extends AiAssistant, Document {}
 
@@ -79,7 +79,7 @@ const schema = new Schema<AiAssistantDocument>(
     },
     ownerAccessScope: {
       type: String,
-      enum: Object.values(AiAssistantOwnerAccessScope),
+      enum: Object.values(AiAssistantAccessScope),
       required: true,
     },
   },

+ 2 - 2
apps/app/src/features/openai/server/routes/ai-assistant.ts

@@ -9,7 +9,7 @@ import { apiV3FormValidator } from '~/server/middlewares/apiv3-form-validator';
 import type { ApiV3Response } from '~/server/routes/apiv3/interfaces/apiv3-response';
 import loggerFactory from '~/utils/logger';
 
-import { type AiAssistant, AiAssistantShareScope, AiAssistantOwnerAccessScope } from '../../interfaces/ai-assistant';
+import { type AiAssistant, AiAssistantShareScope, AiAssistantAccessScope } from '../../interfaces/ai-assistant';
 import { getOpenaiService } from '../services/openai';
 
 import { certifyAiService } from './middlewares/certify-ai-service';
@@ -89,7 +89,7 @@ export const createAiAssistantFactory: CreateAssistantFactory = (crowi) => {
       .withMessage('Invalid shareScope value'),
 
     body('ownerAccessScope')
-      .isIn(Object.values(AiAssistantOwnerAccessScope))
+      .isIn(Object.values(AiAssistantAccessScope))
       .withMessage('Invalid ownerAccessScope value'),
   ];