feat: add system tools and state updates
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""add assistant system tools
|
||||
|
||||
Revision ID: 20260804_0010
|
||||
Revises: 20260801_0009
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision: str = "20260804_0010"
|
||||
down_revision: str | Sequence[str] | None = "20260801_0009"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column(
|
||||
"assistants",
|
||||
sa.Column(
|
||||
"system_tools",
|
||||
sa.JSON(),
|
||||
server_default=sa.text("'[]'"),
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("assistants", "system_tools")
|
||||
@@ -0,0 +1,44 @@
|
||||
"""move end conversation tools into the system category
|
||||
|
||||
Revision ID: 20260804_0011
|
||||
Revises: 20260804_0010
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
revision: str = "20260804_0011"
|
||||
down_revision: str | Sequence[str] | None = "20260804_0010"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"""
|
||||
UPDATE tools
|
||||
SET type = 'system',
|
||||
definition = jsonb_set(
|
||||
jsonb_set(definition, '{type}', '"system"'::jsonb),
|
||||
'{config,kind}',
|
||||
'"end_conversation"'::jsonb,
|
||||
true
|
||||
)
|
||||
WHERE type = 'end_call'
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute(
|
||||
"""
|
||||
UPDATE tools
|
||||
SET type = 'end_call',
|
||||
definition = (definition #- '{config,kind}')
|
||||
|| '{"type":"end_call"}'::jsonb
|
||||
WHERE type = 'system'
|
||||
AND definition #>> '{config,kind}' = 'end_conversation'
|
||||
"""
|
||||
)
|
||||
Reference in New Issue
Block a user