mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-19 08:28:10 +02:00
feat: user defined custom tools as part of workflow execution (#94)
* feat: add custom tools functionality * Show tools in nodes * integrate tool calling with pipeline engine
This commit is contained in:
parent
cc2d3e70d2
commit
3e55af9256
65 changed files with 5483 additions and 6673 deletions
92
api/alembic/versions/ebc80cea7965_add_tools_model.py
Normal file
92
api/alembic/versions/ebc80cea7965_add_tools_model.py
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
"""add tools model
|
||||
|
||||
Revision ID: ebc80cea7965
|
||||
Revises: 36b5dbf670e4
|
||||
Create Date: 2026-01-01 10:13:50.807135
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "ebc80cea7965"
|
||||
down_revision: Union[str, None] = "36b5dbf670e4"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
sa.Enum("active", "archived", "draft", name="tool_status").create(op.get_bind())
|
||||
sa.Enum("http_api", "native", "integration", name="tool_category").create(
|
||||
op.get_bind()
|
||||
)
|
||||
op.create_table(
|
||||
"tools",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("tool_uuid", sa.String(length=36), nullable=False),
|
||||
sa.Column("organization_id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sa.String(length=255), nullable=False),
|
||||
sa.Column("description", sa.String(), nullable=True),
|
||||
sa.Column(
|
||||
"category",
|
||||
postgresql.ENUM(
|
||||
"http_api",
|
||||
"native",
|
||||
"integration",
|
||||
name="tool_category",
|
||||
create_type=False,
|
||||
),
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column("icon", sa.String(length=50), nullable=True),
|
||||
sa.Column("icon_color", sa.String(length=7), nullable=True),
|
||||
sa.Column(
|
||||
"status",
|
||||
postgresql.ENUM(
|
||||
"active", "archived", "draft", name="tool_status", create_type=False
|
||||
),
|
||||
server_default=sa.text("'active'::tool_status"),
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column("definition", sa.JSON(), nullable=False),
|
||||
sa.Column("created_by", sa.Integer(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["created_by"],
|
||||
["users.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["organization_id"], ["organizations.id"], ondelete="CASCADE"
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("organization_id", "name", name="unique_org_tool_name"),
|
||||
)
|
||||
op.create_index("ix_tools_category", "tools", ["category"], unique=False)
|
||||
op.create_index(
|
||||
"ix_tools_organization_id", "tools", ["organization_id"], unique=False
|
||||
)
|
||||
op.create_index("ix_tools_status", "tools", ["status"], unique=False)
|
||||
op.create_index(op.f("ix_tools_tool_uuid"), "tools", ["tool_uuid"], unique=True)
|
||||
op.create_index("ix_tools_uuid", "tools", ["tool_uuid"], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index("ix_tools_uuid", table_name="tools")
|
||||
op.drop_index(op.f("ix_tools_tool_uuid"), table_name="tools")
|
||||
op.drop_index("ix_tools_status", table_name="tools")
|
||||
op.drop_index("ix_tools_organization_id", table_name="tools")
|
||||
op.drop_index("ix_tools_category", table_name="tools")
|
||||
op.drop_table("tools")
|
||||
sa.Enum("http_api", "native", "integration", name="tool_category").drop(
|
||||
op.get_bind()
|
||||
)
|
||||
sa.Enum("active", "archived", "draft", name="tool_status").drop(op.get_bind())
|
||||
# ### end Alembic commands ###
|
||||
Loading…
Add table
Add a link
Reference in a new issue