mirror of
https://github.com/open-webui/open-webui
synced 2025-02-21 12:29:29 +00:00
refac: migration
This commit is contained in:
parent
7d159ca723
commit
363ab562c3
@ -40,11 +40,17 @@ def migrate(migrator: Migrator, database: pw.Database, *, fake=False):
|
|||||||
@migrator.create_model
|
@migrator.create_model
|
||||||
class Model(pw.Model):
|
class Model(pw.Model):
|
||||||
id = pw.TextField(unique=True)
|
id = pw.TextField(unique=True)
|
||||||
meta = pw.TextField()
|
user_id = pw.TextField()
|
||||||
base_model_id = pw.TextField(null=True)
|
base_model_id = pw.TextField(null=True)
|
||||||
|
|
||||||
name = pw.TextField()
|
name = pw.TextField()
|
||||||
|
|
||||||
|
meta = pw.TextField()
|
||||||
params = pw.TextField()
|
params = pw.TextField()
|
||||||
|
|
||||||
|
created_at = (pw.BigIntegerField(null=False),)
|
||||||
|
updated_at = (pw.BigIntegerField(null=False),)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
table_name = "model"
|
table_name = "model"
|
||||||
|
|
||||||
|
@ -45,10 +45,7 @@ class Model(pw.Model):
|
|||||||
The model's id as used in the API. If set to an existing model, it will override the model.
|
The model's id as used in the API. If set to an existing model, it will override the model.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
meta = JSONField()
|
user_id = pw.TextField()
|
||||||
"""
|
|
||||||
Holds a JSON encoded blob of metadata, see `ModelMeta`.
|
|
||||||
"""
|
|
||||||
|
|
||||||
base_model_id = pw.TextField(null=True)
|
base_model_id = pw.TextField(null=True)
|
||||||
"""
|
"""
|
||||||
@ -66,16 +63,24 @@ class Model(pw.Model):
|
|||||||
Holds a JSON encoded blob of parameters, see `ModelParams`.
|
Holds a JSON encoded blob of parameters, see `ModelParams`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
meta = JSONField()
|
||||||
|
"""
|
||||||
|
Holds a JSON encoded blob of metadata, see `ModelMeta`.
|
||||||
|
"""
|
||||||
|
|
||||||
|
updated_at: int # timestamp in epoch
|
||||||
|
created_at: int # timestamp in epoch
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
database = DB
|
database = DB
|
||||||
|
|
||||||
|
|
||||||
class ModelModel(BaseModel):
|
class ModelModel(BaseModel):
|
||||||
id: str
|
id: str
|
||||||
meta: ModelMeta
|
|
||||||
base_model_id: Optional[str] = None
|
base_model_id: Optional[str] = None
|
||||||
name: str
|
name: str
|
||||||
params: ModelParams
|
params: ModelParams
|
||||||
|
meta: ModelMeta
|
||||||
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
|
Loading…
Reference in New Issue
Block a user