mirror of
https://github.com/open-webui/open-webui
synced 2025-06-13 01:43:37 +00:00
This commit introduces the initial Agent Creation Playground feature and ensures it supports all model types available in Open WebUI, not just Ollama models. Key changes include: Frontend: - Created a new Agent Creation form at `/agents/create`. - Added a link to the playground in the sidebar (admin only). - The form now fetches and displays all available models from the `/api/models` endpoint. - Updated UI to correctly handle generalized model IDs. Backend: - Modified the `Agent` model to store a generic `model_id` (foreign key to the `models` table) instead of a specific `llm_model`. - Updated API endpoints and Pydantic schemas accordingly. - Created database migrations to reflect schema changes. - Verified that the existing `/api/models` endpoint can be used to list all models for the creation form. Testing: - Added Cypress E2E tests for the agent creation form. - Tests verify that different model types can be selected and that the correct `model_id` and other agent details are submitted to the backend. This provides a foundation for you to define agents using any model integrated with your Open WebUI instance.
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
"""create_agents_table
|
|
|
|
Revision ID: 019
|
|
Revises: 018
|
|
Create Date: 2024-03-15 10:00:00.000000
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '019'
|
|
down_revision: Union[str, None] = '018'
|
|
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! ###
|
|
op.create_table('agent',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(), nullable=False),
|
|
sa.Column('role', sa.String(), nullable=False),
|
|
sa.Column('system_message', sa.String(), nullable=True),
|
|
sa.Column('llm_model', sa.String(), nullable=False),
|
|
sa.Column('skills', sa.JSON(), nullable=True),
|
|
sa.Column('user_id', sa.String(), nullable=False),
|
|
sa.Column('timestamp', sa.DateTime(), nullable=True),
|
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_agent_id'), 'agent', ['id'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_agent_id'), table_name='agent')
|
|
op.drop_table('agent')
|
|
# ### end Alembic commands ###
|