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: AiAssistantModel #9494

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

Conversation

miya
Copy link
Member

@miya miya commented Dec 17, 2024

Task

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

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

changeset-bot bot commented Dec 17, 2024

⚠️ No Changeset found

Latest commit: c5c8529

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

type: String,
enum: Object.values(AiAssistantSharingScope),
required: true,
},
Copy link
Member Author

Choose a reason for hiding this comment

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

共有範囲

type: String,
enum: Object.values(AiAssistantLearningScope),
required: true,
},
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 に保存する権限の範囲を指定
    • アシスタント作成者が閲覧可能な範囲が指定できる

Copy link
Member

Choose a reason for hiding this comment

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

名前変えたほうがいいかも。e-learning のためのフィールドと勘違いする。
かといって「実行ユーザー」というのが適当とも思わないんだけどね

あとこれは enum だけではなく UserGroup への参照が必要なのではないか?

required: true,
index: true,
},
}],
Copy link
Member Author

Choose a reason for hiding this comment

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

Page mode を踏襲

type: [{
type: {
type: String,
enum: Object.values(GroupType),
required: true,
default: 'UserGroup',
},
item: {
type: Schema.Types.ObjectId,
refPath: 'grantedGroups.type',
required: true,
index: true,
},
}],
validate: [function(arr) {
if (arr == null) return true;
const uniqueItemValues = new Set(arr.map(e => e.item));
return arr.length === uniqueItemValues.size;
}, 'grantedGroups contains non unique item'],
default: [],
required: true,
},

default: false,
required: true,
},
},
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 model を踏襲

isDeleted: {
type: Boolean,
default: false,
required: true,
},

vectorStoreId: {
type: String,
required: true,
},
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 model を踏襲

vectorStoreId: {
type: String,
required: true,
unique: true,
},

schema.methods.markAsDeleted = async function(): Promise<void> {
this.isDeleted = true;
await this.save();
};
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 model 踏襲

schema.methods.markAsDeleted = async function(): Promise<void> {
this.isDeleted = true;
await this.save();
};

interface AiAssistant {
name: string;
description?: string
instruction?: string
Copy link
Member

Choose a reason for hiding this comment

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

特化型アシスタントになったことで、実際使う時の instruction はシステム側で入れると思うんだよね
ナレッジアシスタントとかエディタアシスタントのそれぞれの役割になるように

ユーザーが指定できるのはサブの instruction になるので、additionalInstruction にしておいた方がいいかも

あと description も instruction も not optional でいいと思う。初期値は空文字列にすればいいので。

instruction?: string
vectorStoreId: string // VectorStoreId of OpenAI Specify (https://platform.openai.com/docs/api-reference/vector-stores/object)
types: AiAssistantType[]
creator: Ref<IUser>
Copy link
Member

Choose a reason for hiding this comment

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

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.

修正済み

types: AiAssistantType[]
creator: Ref<IUser>
grantedGroups?: IGrantedGroup[];
pages: Ref<IPage>[]
Copy link
Member

Choose a reason for hiding this comment

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

pages って何用途だろ?
個別にページへの参照を追加できるというのも thread 作ったときに便利そうではあるが、vector store 利用との一貫性はないので今使い分けをするのかきちんと設計しておきたい

type: String,
enum: Object.values(AiAssistantLearningScope),
required: true,
},
Copy link
Member

Choose a reason for hiding this comment

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

名前変えたほうがいいかも。e-learning のためのフィールドと勘違いする。
かといって「実行ユーザー」というのが適当とも思わないんだけどね

あとこれは enum だけではなく UserGroup への参照が必要なのではないか?

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