Skip to content

Commit ae5a72a

Browse files
committed
feat: 投稿したコンテンツのAIによる学習を軽減するオプションを追加
Resolve #10819
1 parent baa4585 commit ae5a72a

File tree

16 files changed

+61
-2
lines changed

16 files changed

+61
-2
lines changed

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@
1212
1313
-->
1414

15+
## 13.x.x (unreleased)
16+
17+
### General
18+
- 投稿したコンテンツのAIによる学習を軽減するオプションを追加
19+
20+
### Client
21+
-
22+
23+
### Server
24+
-
25+
1526
## 13.12.1
1627

1728
### Client

locales/ja-JP.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,8 @@ thisChannelArchived: "このチャンネルはアーカイブされています
10381038
displayOfNote: "ノートの表示"
10391039
initialAccountSetting: "初期設定"
10401040
youFollowing: "フォロー中"
1041+
preventAiLarning: "AIによる学習を防止"
1042+
preventAiLarningDescription: "投稿したノート、添付した画像などのコンテンツを学習の対象にしないようAIに要求します。これはnoaiフラグをHTMLレスポンスに含めることによって実現されます。"
10411043

10421044
_initialAccountSetting:
10431045
accountCreated: "アカウントの作成が完了しました!"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export class PreventAiLarning1683682889948 {
2+
name = 'PreventAiLarning1683682889948'
3+
4+
async up(queryRunner) {
5+
await queryRunner.query(`ALTER TABLE "user_profile" ADD "preventAiLarning" boolean NOT NULL DEFAULT true`);
6+
}
7+
8+
async down(queryRunner) {
9+
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "preventAiLarning"`);
10+
}
11+
}

packages/backend/src/core/entities/UserEntityService.ts

+1
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ export class UserEntityService implements OnModuleInit {
445445
carefulBot: profile!.carefulBot,
446446
autoAcceptFollowed: profile!.autoAcceptFollowed,
447447
noCrawle: profile!.noCrawle,
448+
preventAiLarning: profile!.preventAiLarning,
448449
isExplorable: user.isExplorable,
449450
isDeleted: user.isDeleted,
450451
hideOnlineStatus: user.hideOnlineStatus,

packages/backend/src/models/entities/UserProfile.ts

+5
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ export class UserProfile {
147147
})
148148
public noCrawle: boolean;
149149

150+
@Column('boolean', {
151+
default: true,
152+
})
153+
public preventAiLarning: boolean;
154+
150155
@Column('boolean', {
151156
default: false,
152157
})

packages/backend/src/models/json-schema/user.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,11 @@ export const packedMeDetailedOnlySchema = {
302302
},
303303
noCrawle: {
304304
type: 'boolean',
305-
nullable: true, optional: false,
305+
nullable: false, optional: false,
306+
},
307+
preventAiLarning: {
308+
type: 'boolean',
309+
nullable: false, optional: false,
306310
},
307311
isExplorable: {
308312
type: 'boolean',

packages/backend/src/server/api/endpoints/admin/show-user.ts

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
6868
emailVerified: profile.emailVerified,
6969
autoAcceptFollowed: profile.autoAcceptFollowed,
7070
noCrawle: profile.noCrawle,
71+
preventAiLarning: profile.preventAiLarning,
7172
alwaysMarkNsfw: profile.alwaysMarkNsfw,
7273
autoSensitive: profile.autoSensitive,
7374
carefulBot: profile.carefulBot,

packages/backend/src/server/api/endpoints/i/update.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const meta = {
9898
message: 'This feature is restricted by your role.',
9999
code: 'RESTRICTED_BY_ROLE',
100100
id: '8feff0ba-5ab5-585b-31f4-4df816663fad',
101-
}
101+
},
102102
},
103103

104104
res: {
@@ -138,6 +138,7 @@ export const paramDef = {
138138
carefulBot: { type: 'boolean' },
139139
autoAcceptFollowed: { type: 'boolean' },
140140
noCrawle: { type: 'boolean' },
141+
preventAiLarning: { type: 'boolean' },
141142
isBot: { type: 'boolean' },
142143
isCat: { type: 'boolean' },
143144
showTimelineReplies: { type: 'boolean' },
@@ -242,6 +243,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
242243
if (typeof ps.carefulBot === 'boolean') profileUpdates.carefulBot = ps.carefulBot;
243244
if (typeof ps.autoAcceptFollowed === 'boolean') profileUpdates.autoAcceptFollowed = ps.autoAcceptFollowed;
244245
if (typeof ps.noCrawle === 'boolean') profileUpdates.noCrawle = ps.noCrawle;
246+
if (typeof ps.preventAiLarning === 'boolean') profileUpdates.preventAiLarning = ps.preventAiLarning;
245247
if (typeof ps.isCat === 'boolean') updates.isCat = ps.isCat;
246248
if (typeof ps.injectFeaturedNote === 'boolean') profileUpdates.injectFeaturedNote = ps.injectFeaturedNote;
247249
if (typeof ps.receiveAnnouncementEmail === 'boolean') profileUpdates.receiveAnnouncementEmail = ps.receiveAnnouncementEmail;

packages/backend/src/server/web/views/clip.pug

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ block og
2121
block meta
2222
if profile.noCrawle
2323
meta(name='robots' content='noindex')
24+
if profile.preventAiLarning
25+
meta(name='robots' content='noai')
2426

2527
meta(name='misskey:user-username' content=user.username)
2628
meta(name='misskey:user-id' content=user.id)

packages/backend/src/server/web/views/flash.pug

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ block og
2121
block meta
2222
if profile.noCrawle
2323
meta(name='robots' content='noindex')
24+
if profile.preventAiLarning
25+
meta(name='robots' content='noai')
2426

2527
meta(name='misskey:user-username' content=user.username)
2628
meta(name='misskey:user-id' content=user.id)

packages/backend/src/server/web/views/gallery-post.pug

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ block og
2121
block meta
2222
if user.host || profile.noCrawle
2323
meta(name='robots' content='noindex')
24+
if profile.preventAiLarning
25+
meta(name='robots' content='noai')
2426

2527
meta(name='misskey:user-username' content=user.username)
2628
meta(name='misskey:user-id' content=user.id)

packages/backend/src/server/web/views/note.pug

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ block og
2222
block meta
2323
if user.host || isRenote || profile.noCrawle
2424
meta(name='robots' content='noindex')
25+
if profile.preventAiLarning
26+
meta(name='robots' content='noai')
2527

2628
meta(name='misskey:user-username' content=user.username)
2729
meta(name='misskey:user-id' content=user.id)

packages/backend/src/server/web/views/page.pug

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ block og
2121
block meta
2222
if profile.noCrawle
2323
meta(name='robots' content='noindex')
24+
if profile.preventAiLarning
25+
meta(name='robots' content='noai')
2426

2527
meta(name='misskey:user-username' content=user.username)
2628
meta(name='misskey:user-id' content=user.id)

packages/backend/src/server/web/views/user.pug

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ block og
2020
block meta
2121
if user.host || profile.noCrawle
2222
meta(name='robots' content='noindex')
23+
if profile.preventAiLarning
24+
meta(name='robots' content='noai')
2325

2426
meta(name='misskey:user-username' content=user.username)
2527
meta(name='misskey:user-id' content=user.id)

packages/backend/test/e2e/users.ts

+4
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ describe('ユーザー', () => {
145145
carefulBot: user.carefulBot,
146146
autoAcceptFollowed: user.autoAcceptFollowed,
147147
noCrawle: user.noCrawle,
148+
preventAiLarning: user.preventAiLarning,
148149
isExplorable: user.isExplorable,
149150
isDeleted: user.isDeleted,
150151
hideOnlineStatus: user.hideOnlineStatus,
@@ -390,6 +391,7 @@ describe('ユーザー', () => {
390391
assert.strictEqual(response.carefulBot, false);
391392
assert.strictEqual(response.autoAcceptFollowed, true);
392393
assert.strictEqual(response.noCrawle, false);
394+
assert.strictEqual(response.preventAiLarning, true);
393395
assert.strictEqual(response.isExplorable, true);
394396
assert.strictEqual(response.isDeleted, false);
395397
assert.strictEqual(response.hideOnlineStatus, false);
@@ -462,6 +464,8 @@ describe('ユーザー', () => {
462464
{ parameters: (): object => ({ autoAcceptFollowed: false }) },
463465
{ parameters: (): object => ({ noCrawle: true }) },
464466
{ parameters: (): object => ({ noCrawle: false }) },
467+
{ parameters: (): object => ({ preventAiLarning: false }) },
468+
{ parameters: (): object => ({ preventAiLarning: true }) },
465469
{ parameters: (): object => ({ isBot: true }) },
466470
{ parameters: (): object => ({ isBot: false }) },
467471
{ parameters: (): object => ({ isCat: true }) },

packages/frontend/src/pages/settings/privacy.vue

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
{{ i18n.ts.noCrawle }}
2525
<template #caption>{{ i18n.ts.noCrawleDescription }}</template>
2626
</MkSwitch>
27+
<MkSwitch v-model="preventAiLarning" @update:model-value="save()">
28+
{{ i18n.ts.preventAiLarning }}<span class="_beta">{{ i18n.ts.beta }}</span>
29+
<template #caption>{{ i18n.ts.preventAiLarningDescription }}</template>
30+
</MkSwitch>
2731
<MkSwitch v-model="isExplorable" @update:model-value="save()">
2832
{{ i18n.ts.makeExplorable }}
2933
<template #caption>{{ i18n.ts.makeExplorableDescription }}</template>
@@ -71,6 +75,7 @@ import { definePageMetadata } from '@/scripts/page-metadata';
7175
let isLocked = $ref($i.isLocked);
7276
let autoAcceptFollowed = $ref($i.autoAcceptFollowed);
7377
let noCrawle = $ref($i.noCrawle);
78+
let preventAiLarning = $ref($i.preventAiLarning);
7479
let isExplorable = $ref($i.isExplorable);
7580
let hideOnlineStatus = $ref($i.hideOnlineStatus);
7681
let publicReactions = $ref($i.publicReactions);
@@ -86,6 +91,7 @@ function save() {
8691
isLocked: !!isLocked,
8792
autoAcceptFollowed: !!autoAcceptFollowed,
8893
noCrawle: !!noCrawle,
94+
preventAiLarning: !!preventAiLarning,
8995
isExplorable: !!isExplorable,
9096
hideOnlineStatus: !!hideOnlineStatus,
9197
publicReactions: !!publicReactions,

0 commit comments

Comments
 (0)