Skip to content

Commit

Permalink
Adds a new genai field to signal definition model to store the prompt (
Browse files Browse the repository at this point in the history
  • Loading branch information
mvilanova authored Sep 20, 2024
1 parent ced74f3 commit 1100bf6
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Adds new genai prompt column to signal definition model
Revision ID: 1f4dc687945d
Revises: 19c10c121a22
Create Date: 2024-09-20 10:49:11.303112
"""
from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = '1f4dc687945d'
down_revision = '19c10c121a22'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('signal', sa.Column('genai_prompt', sa.String(), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('signal', 'genai_prompt')
# ### end Alembic commands ###
2 changes: 2 additions & 0 deletions src/dispatch/signal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class Signal(Base, TimeStampMixin, ProjectMixin):
genai_enabled = Column(Boolean, default=True)
genai_model = Column(String)
genai_system_message = Column(String)
genai_prompt = Column(String)

oncall_service_id = Column(Integer, ForeignKey("service.id"))
oncall_service = relationship("Service", foreign_keys=[oncall_service_id])
Expand Down Expand Up @@ -325,6 +326,7 @@ class SignalBase(DispatchBase):
genai_enabled: Optional[bool] = True
genai_model: Optional[str]
genai_system_message: Optional[str]
genai_prompt: Optional[str]


class SignalCreate(SignalBase):
Expand Down
17 changes: 16 additions & 1 deletion src/dispatch/static/dispatch/src/signal/NewEditDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,29 @@
/>
</v-col>
<v-col cols="12">
<v-text-field
<v-textarea
v-model="genai_system_message"
label="System Message"
rows="1"
auto-grow
hint="The system message to set the behavior of the assistant"
persistent-hint
name="systemMessage"
readonly
/>
</v-col>
<v-col cols="12">
<v-textarea
v-model="genai_prompt"
label="Prompt"
rows="1"
auto-grow
hint="The prompt to use for the assistant."
persistent-hint
name="Prompt"
readonly
/>
</v-col>
</v-row>
</v-card-text>
</v-card>
Expand Down Expand Up @@ -381,6 +395,7 @@ export default {
"selected.filters",
"selected.genai_enabled",
"selected.genai_model",
"selected.genai_prompt",
"selected.genai_system_message",
"selected.id",
"selected.lifecycle",
Expand Down
1 change: 1 addition & 0 deletions src/dispatch/static/dispatch/src/signal/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const getDefaultSelectedState = () => {
filters: [],
genai_enabled: false,
genai_model: null,
genai_prompt: null,
genai_system_message: null,
id: null,
lifecycle: null,
Expand Down

0 comments on commit 1100bf6

Please sign in to comment.