Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: system default model name length (#4245) (#4246)

GalvinYang6b99075dc89c
diff --git a/api/migrations/versions/47cc7df8c4f3_modify_default_model_name_length.py b/api/migrations/versions/47cc7df8c4f3_modify_default_model_name_length.py
new file mode 100644
index 00000000000..b37928d3c08
--- /dev/null
+++ b/api/migrations/versions/47cc7df8c4f3_modify_default_model_name_length.py
@@ -0,0 +1,39 @@
+"""modify default model name length
+
+Revision ID: 47cc7df8c4f3
+Revises: 3c7cac9521c6
+Create Date: 2024-05-10 09:48:09.046298
+
+"""
+import sqlalchemy as sa
+from alembic import op
+
+import models as models
+
+# revision identifiers, used by Alembic.
+revision = '47cc7df8c4f3'
+down_revision = '3c7cac9521c6'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ with op.batch_alter_table('tenant_default_models', schema=None) as batch_op:
+ batch_op.alter_column('model_name',
+ existing_type=sa.VARCHAR(length=40),
+ type_=sa.String(length=255),
+ existing_nullable=False)
+
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ with op.batch_alter_table('tenant_default_models', schema=None) as batch_op:
+ batch_op.alter_column('model_name',
+ existing_type=sa.String(length=255),
+ type_=sa.VARCHAR(length=40),
+ existing_nullable=False)
+
+ # ### end Alembic commands ###
diff --git a/api/models/provider.py b/api/models/provider.py
index 413e8f9d677..eb6ec4beb46 100644
--- a/api/models/provider.py
+++ b/api/models/provider.py
@@ -113,7 +113,7 @@ class TenantDefaultModel(db.Model):
id = db.Column(StringUUID, server_default=db.text('uuid_generate_v4()'))
tenant_id = db.Column(StringUUID, nullable=False)
provider_name = db.Column(db.String(40), nullable=False)
- model_name = db.Column(db.String(40), nullable=False)
+ model_name = db.Column(db.String(255), nullable=False)
model_type = db.Column(db.String(40), nullable=False)
created_at = db.Column(db.DateTime, nullable=False, server_default=db.text('CURRENT_TIMESTAMP(0)'))
updated_at = db.Column(db.DateTime, nullable=False, server_default=db.text('CURRENT_TIMESTAMP(0)'))