-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Implement AI Assistant creation api #9497
base: feat/growi-ai-next
Are you sure you want to change the base?
feat: Implement AI Assistant creation api #9497
Conversation
|
…tant-creation-api
…tant-creation-api
grantedGroups?: IGrantedGroup[] | ||
shareScope: AiAssistantShareScope | ||
ownerAccessScope: AiAssistantOwnerAccessScope | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apps/app/src/features/openai/interfaces/ai-assistant.ts に移動
KNOWLEDGE: 'knowledge', | ||
// EDITOR: 'editor', | ||
// LEARNING: 'learning', | ||
} as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/Web会議室/20250107_GROWI AI Next スコープ決め でアシスタントのデータにこの情報は含めないということになったため削除
const dumyVectorStoreId = '676e0d9863442b736e7ecf09'; | ||
const aiAssistant = await AiAssistantModel.create({ ...data, vectorStore: dumyVectorStoreId }); | ||
return aiAssistant; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- AiAssistantDocument の作成ロジック
- 特化型の VectorStore を作成するロジックは 特化型の VectorStore を作成できる で実装予定
- AiAssistantModel 作成には vectorStore が必須なのでダミーな vectorStore を入れている
|
||
type CreateAssistantFactory = (crowi: Crowi) => RequestHandler[]; | ||
|
||
type ReqBody = Omit<AiAssistant, 'vectorStore' | 'owner'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vectorStore
は OpenaiService で作成するため omitowner
は req.user を入れるため omit
PUBLIC: 'public', | ||
ONLY_ME: 'onlyMe', | ||
USER_GROUP: 'userGroup', | ||
} as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const AiAssistantAccessScope = {
PUBLIC_ONLY: 'publicOnly',
OWNER: 'owner
GROUPS: 'groups',
} as const;
publicOnly, owner の場合は grantedGroups は undefined、
groups の場合のみ grantedGroups に値が入ると思う。
そうすると grantedUsers は不要ではないか?
grantedGroups?: IGrantedGroup[] | ||
shareScope: AiAssistantShareScope | ||
ownerAccessScope: AiAssistantOwnerAccessScope | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{
accessScope: AiAssistantAccessScope.public | AiAssistantAccessScope.owner
} |
{
accessScope: AiAssistantAccessScope.groups
grantedGroups: IGrantedGroup[]
}
みたいにできないかな?
interface のまま定義できたかどうか自信ないけれど (type になっちゃうかも?)
|
||
import('./create-ai-assistant').then(({ createAiAssistantFactory }) => { | ||
router.post('/assistant', createAiAssistantFactory(crowi)); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
REST 的に post が create の意味を持つから、/create-ai-assistant
は /ai-assistant
等、リソースを意味するものにしていいと思う
Task