Skip to content
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

Open
wants to merge 13 commits into
base: feat/growi-ai-next
Choose a base branch
from

Conversation

miya
Copy link
Member

@miya miya commented Dec 18, 2024

Task

  • #159151 [GROWI AI Next][特化型アシスタント] 新規作成モーダルから作成ボタンをクリックした時アシスタントデータが作成される
    • #159153 アシスタントを作成するための API の実装

@miya miya requested a review from yuki-takei December 18, 2024 07:08
@miya miya self-assigned this Dec 18, 2024
Copy link

changeset-bot bot commented Dec 18, 2024

⚠️ No Changeset found

Latest commit: abda9dc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

grantedGroups?: IGrantedGroup[]
shareScope: AiAssistantShareScope
ownerAccessScope: AiAssistantOwnerAccessScope
}
Copy link
Member Author

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;
Copy link
Member Author

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;
}
Copy link
Member Author

@miya miya Jan 9, 2025

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'>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • vectorStore は OpenaiService で作成するため omit
  • owner は req.user を入れるため omit

PUBLIC: 'public',
ONLY_ME: 'onlyMe',
USER_GROUP: 'userGroup',
} as const;
Copy link
Member

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
}
Copy link
Member

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));
});
Copy link
Member

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 等、リソースを意味するものにしていいと思う

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants