Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
363ab562
Commit
363ab562
authored
May 23, 2024
by
Timothy J. Baek
Browse files
refac: migration
parent
7d159ca7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
backend/apps/web/internal/migrations/009_add_models.py
backend/apps/web/internal/migrations/009_add_models.py
+7
-1
backend/apps/web/models/models.py
backend/apps/web/models/models.py
+10
-5
No files found.
backend/apps/web/internal/migrations/009_add_models.py
View file @
363ab562
...
@@ -40,11 +40,17 @@ def migrate(migrator: Migrator, database: pw.Database, *, fake=False):
...
@@ -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"
...
...
backend/apps/web/models/models.py
View file @
363ab562
...
@@ -45,10 +45,7 @@ class Model(pw.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):
...
@@ -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
####################
####################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment