mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-24 22:09:08 +08:00
feat(server): add doc embedding switch for workspace (#11760)
fix AI-33
This commit is contained in:
@@ -60,6 +60,7 @@ test('should update workspace', async t => {
|
||||
public: true,
|
||||
enableAi: true,
|
||||
enableUrlPreview: true,
|
||||
enableDocEmbedding: false,
|
||||
};
|
||||
await t.context.workspace.update(workspace.id, data);
|
||||
const workspace1 = await t.context.workspace.get(workspace.id);
|
||||
|
||||
@@ -88,6 +88,9 @@ export class WorkspaceType extends WorkspaceFeatureType {
|
||||
@Field({ description: 'Enable url previous when sharing' })
|
||||
enableUrlPreview!: boolean;
|
||||
|
||||
@Field({ description: 'Enable doc embedding' })
|
||||
enableDocEmbedding!: boolean;
|
||||
|
||||
@Field(() => [InviteUserType], {
|
||||
description: 'Members of workspace',
|
||||
})
|
||||
@@ -133,7 +136,7 @@ export class InvitationType {
|
||||
@InputType()
|
||||
export class UpdateWorkspaceInput extends PickType(
|
||||
PartialType(WorkspaceType),
|
||||
['public', 'enableAi', 'enableUrlPreview'],
|
||||
['public', 'enableAi', 'enableUrlPreview', 'enableDocEmbedding'],
|
||||
InputType
|
||||
) {
|
||||
@Field(() => ID)
|
||||
|
||||
@@ -16,7 +16,12 @@ declare global {
|
||||
export type { Workspace };
|
||||
export type UpdateWorkspaceInput = Pick<
|
||||
Partial<Workspace>,
|
||||
'public' | 'enableAi' | 'enableUrlPreview' | 'name' | 'avatarKey'
|
||||
| 'public'
|
||||
| 'enableAi'
|
||||
| 'enableUrlPreview'
|
||||
| 'enableDocEmbedding'
|
||||
| 'name'
|
||||
| 'avatarKey'
|
||||
>;
|
||||
|
||||
@Injectable()
|
||||
@@ -88,5 +93,10 @@ export class WorkspaceModel extends BaseModel {
|
||||
const workspace = await this.get(workspaceId);
|
||||
return workspace?.enableUrlPreview ?? false;
|
||||
}
|
||||
|
||||
async allowEmbedding(workspaceId: string) {
|
||||
const workspace = await this.get(workspaceId);
|
||||
return workspace?.enableDocEmbedding ?? false;
|
||||
}
|
||||
// #endregion
|
||||
}
|
||||
|
||||
@@ -1493,6 +1493,9 @@ input UpdateWorkspaceInput {
|
||||
"""Enable AI"""
|
||||
enableAi: Boolean
|
||||
|
||||
"""Enable doc embedding"""
|
||||
enableDocEmbedding: Boolean
|
||||
|
||||
"""Enable url previous when sharing"""
|
||||
enableUrlPreview: Boolean
|
||||
id: ID!
|
||||
@@ -1702,6 +1705,9 @@ type WorkspaceType {
|
||||
"""Enable AI"""
|
||||
enableAi: Boolean!
|
||||
|
||||
"""Enable doc embedding"""
|
||||
enableDocEmbedding: Boolean!
|
||||
|
||||
"""Enable url previous when sharing"""
|
||||
enableUrlPreview: Boolean!
|
||||
histories(before: DateTime, guid: String!, take: Int): [DocHistoryType!]!
|
||||
|
||||
Reference in New Issue
Block a user