-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
231 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,7 @@ | |
"apps.polls", | ||
"apps.topicprio", | ||
"apps.debate", | ||
"apps.ai_reports", | ||
) | ||
|
||
MIDDLEWARE = ( | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from django.contrib import admin | ||
|
||
from .models import AiReport | ||
|
||
|
||
@admin.register(AiReport) | ||
class AiReportAdmin(admin.ModelAdmin): | ||
model = AiReport | ||
fields = [ | ||
"is_pending", | ||
"category", | ||
"explanation", | ||
"confidence", | ||
] | ||
raw_id_fields = ("comment",) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class AiReportsConfig(AppConfig): | ||
name = "apps.ai_reports" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Generated by Django 3.2.19 on 2023-07-27 15:31 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import django.utils.timezone | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [ | ||
("a4comments", "0013_set_project"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="AiReport", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"created", | ||
models.DateTimeField( | ||
default=django.utils.timezone.now, | ||
editable=False, | ||
verbose_name="Created", | ||
), | ||
), | ||
( | ||
"modified", | ||
models.DateTimeField( | ||
blank=True, editable=False, null=True, verbose_name="Modified" | ||
), | ||
), | ||
("is_pending", models.BooleanField(default=True)), | ||
("category", models.CharField(max_length=50)), | ||
("explanation", models.TextField()), | ||
("confidence", models.FloatField(default=0)), | ||
( | ||
"comment", | ||
models.OneToOneField( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="ai_report", | ||
to="a4comments.comment", | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from django.db import models | ||
|
||
from adhocracy4.comments.models import Comment | ||
from adhocracy4.models.base import TimeStampedModel | ||
|
||
|
||
class AiReport(TimeStampedModel): | ||
is_pending = models.BooleanField(default=True) | ||
category = models.CharField(max_length=50) | ||
explanation = models.TextField() | ||
confidence = models.FloatField(default=0) | ||
comment = models.OneToOneField( | ||
Comment, | ||
on_delete=models.CASCADE, | ||
related_name="ai_report", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Added | ||
|
||
- new filter category for comments in moderator dashboard: "reported by ai" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from pytest_factoryboy import register | ||
|
||
from .factories import AiReportFactory | ||
|
||
register(AiReportFactory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import random | ||
|
||
import factory | ||
|
||
from apps.ai_reports.models import AiReport | ||
from tests.factories import CommentFactory | ||
|
||
|
||
class AiReportFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = AiReport | ||
|
||
category = factory.Faker("word") | ||
explanation = factory.Faker("sentence", nb_words=6) | ||
confidence = random.random() | ||
comment = factory.SubFactory(CommentFactory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
from pytest_factoryboy import register | ||
|
||
from tests.ai_reports.factories import AiReportFactory | ||
from tests.ideas.factories import IdeaFactory | ||
from tests.moderatorfeedback.factories import ModeratorCommentFeedbackFactory | ||
|
||
register(IdeaFactory) | ||
register(ModeratorCommentFeedbackFactory) | ||
register(AiReportFactory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.