Implement AI workspace and mitigation workflow
This commit is contained in:
@@ -3,7 +3,19 @@ from django.contrib.auth.forms import UserCreationForm
|
||||
from django.forms import ModelForm
|
||||
from mixins.restrictions import RestrictedFormMixin
|
||||
|
||||
from .models import NotificationSettings, User, AI, PersonIdentifier, Person, Group, Persona, Manipulation, ChatSession, Message, QueuedMessage
|
||||
from .models import (
|
||||
AI,
|
||||
ChatSession,
|
||||
Group,
|
||||
Manipulation,
|
||||
Message,
|
||||
NotificationSettings,
|
||||
Person,
|
||||
Persona,
|
||||
PersonIdentifier,
|
||||
QueuedMessage,
|
||||
User,
|
||||
)
|
||||
|
||||
# Create your forms here.
|
||||
|
||||
@@ -48,6 +60,7 @@ class CustomUserCreationForm(UserCreationForm):
|
||||
model = User
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
class AIForm(RestrictedFormMixin, forms.ModelForm):
|
||||
class Meta:
|
||||
model = AI
|
||||
@@ -61,6 +74,7 @@ class AIForm(RestrictedFormMixin, forms.ModelForm):
|
||||
"model": "Select the AI model to be used.",
|
||||
}
|
||||
|
||||
|
||||
class PersonIdentifierForm(RestrictedFormMixin, forms.ModelForm):
|
||||
class Meta:
|
||||
model = PersonIdentifier
|
||||
@@ -70,10 +84,21 @@ class PersonIdentifierForm(RestrictedFormMixin, forms.ModelForm):
|
||||
"service": "The platform associated with this identifier (e.g., Signal, Instagram).",
|
||||
}
|
||||
|
||||
|
||||
class PersonForm(RestrictedFormMixin, forms.ModelForm):
|
||||
class Meta:
|
||||
model = Person
|
||||
fields = ("name", "summary", "profile", "revealed", "dislikes", "likes", "sentiment", "timezone", "last_interaction")
|
||||
fields = (
|
||||
"name",
|
||||
"summary",
|
||||
"profile",
|
||||
"revealed",
|
||||
"dislikes",
|
||||
"likes",
|
||||
"sentiment",
|
||||
"timezone",
|
||||
"last_interaction",
|
||||
)
|
||||
help_texts = {
|
||||
"name": "The full name of the person.",
|
||||
"summary": "A brief summary or description of this person.",
|
||||
@@ -86,6 +111,7 @@ class PersonForm(RestrictedFormMixin, forms.ModelForm):
|
||||
"last_interaction": "The date and time of the last recorded interaction.",
|
||||
}
|
||||
|
||||
|
||||
class GroupForm(RestrictedFormMixin, forms.ModelForm):
|
||||
class Meta:
|
||||
model = Group
|
||||
@@ -94,6 +120,7 @@ class GroupForm(RestrictedFormMixin, forms.ModelForm):
|
||||
"name": "The name of the group.",
|
||||
"people": "People who are part of this group.",
|
||||
}
|
||||
|
||||
people = forms.ModelMultipleChoiceField(
|
||||
queryset=Person.objects.all(),
|
||||
widget=forms.CheckboxSelectMultiple,
|
||||
@@ -101,13 +128,27 @@ class GroupForm(RestrictedFormMixin, forms.ModelForm):
|
||||
required=False,
|
||||
)
|
||||
|
||||
|
||||
class PersonaForm(RestrictedFormMixin, forms.ModelForm):
|
||||
class Meta:
|
||||
model = Persona
|
||||
fields = (
|
||||
"alias", "mbti", "mbti_identity", "inner_story", "core_values", "communication_style",
|
||||
"flirting_style", "humor_style", "likes", "dislikes", "tone",
|
||||
"response_tactics", "persuasion_tactics", "boundaries", "trust", "adaptability"
|
||||
"alias",
|
||||
"mbti",
|
||||
"mbti_identity",
|
||||
"inner_story",
|
||||
"core_values",
|
||||
"communication_style",
|
||||
"flirting_style",
|
||||
"humor_style",
|
||||
"likes",
|
||||
"dislikes",
|
||||
"tone",
|
||||
"response_tactics",
|
||||
"persuasion_tactics",
|
||||
"boundaries",
|
||||
"trust",
|
||||
"adaptability",
|
||||
)
|
||||
help_texts = {
|
||||
"alias": "The preferred name or identity for this persona.",
|
||||
@@ -128,6 +169,7 @@ class PersonaForm(RestrictedFormMixin, forms.ModelForm):
|
||||
"adaptability": "How easily this persona shifts tones or styles (0-100).",
|
||||
}
|
||||
|
||||
|
||||
class ManipulationForm(RestrictedFormMixin, forms.ModelForm):
|
||||
class Meta:
|
||||
model = Manipulation
|
||||
@@ -135,7 +177,7 @@ class ManipulationForm(RestrictedFormMixin, forms.ModelForm):
|
||||
help_texts = {
|
||||
"name": "The name of this manipulation strategy.",
|
||||
"group": "The group involved in this manipulation strategy.",
|
||||
#"self": "Group for own UUIDs.",
|
||||
# "self": "Group for own UUIDs.",
|
||||
"ai": "The AI associated with this manipulation.",
|
||||
"persona": "The persona used for this manipulation.",
|
||||
"enabled": "Whether this manipulation is enabled.",
|
||||
@@ -153,6 +195,7 @@ class SessionForm(RestrictedFormMixin, forms.ModelForm):
|
||||
"summary": "Summary of chat transcript.",
|
||||
}
|
||||
|
||||
|
||||
class MessageForm(RestrictedFormMixin, forms.ModelForm):
|
||||
class Meta:
|
||||
model = Message
|
||||
@@ -164,6 +207,7 @@ class MessageForm(RestrictedFormMixin, forms.ModelForm):
|
||||
"custom_author": "For detecting USER and BOT messages.",
|
||||
}
|
||||
|
||||
|
||||
class QueueForm(RestrictedFormMixin, forms.ModelForm):
|
||||
class Meta:
|
||||
model = QueuedMessage
|
||||
@@ -172,4 +216,20 @@ class QueueForm(RestrictedFormMixin, forms.ModelForm):
|
||||
"session": "Chat session this message will be sent in.",
|
||||
"manipulation": "Manipulation that generated the message.",
|
||||
"text": "Content of the proposed message.",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class AIWorkspaceWindowForm(forms.Form):
|
||||
"""Controls the message window size for AI workspace previews."""
|
||||
|
||||
limit = forms.ChoiceField(
|
||||
choices=(
|
||||
("20", "Last 20"),
|
||||
("50", "Last 50"),
|
||||
("100", "Last 100"),
|
||||
),
|
||||
initial="20",
|
||||
required=True,
|
||||
help_text="How many most-recent messages to load for the selected person.",
|
||||
widget=forms.Select(attrs={"class": "is-fullwidth"}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user