-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from OVINC-CN/feat_model_config
feat: use db to config models and prices #24
- Loading branch information
Showing
9 changed files
with
195 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
apps/chat/migrations/0004_alter_chatlog_model_alter_modelpermission_model_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# pylint: disable=R0801,C0103 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("chat", "0003_remove_content"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="chatlog", | ||
name="model", | ||
field=models.CharField(blank=True, db_index=True, max_length=64, null=True, verbose_name="Model"), | ||
), | ||
migrations.AlterField( | ||
model_name="modelpermission", | ||
name="model", | ||
field=models.CharField(blank=True, db_index=True, max_length=64, null=True, verbose_name="Model"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# pylint: disable=R0801,C0103 | ||
|
||
import ovinc_client.core.models | ||
import ovinc_client.core.utils | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("chat", "0004_alter_chatlog_model_alter_modelpermission_model_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="AIModel", | ||
fields=[ | ||
( | ||
"id", | ||
ovinc_client.core.models.UniqIDField( | ||
default=ovinc_client.core.utils.uniq_id_without_time, | ||
max_length=32, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"provider", | ||
models.CharField( | ||
choices=[ | ||
("openai", "Open AI"), | ||
("google", "Google"), | ||
("baidu", "Baidu"), | ||
("tencent", "Tencent"), | ||
], | ||
db_index=True, | ||
max_length=64, | ||
verbose_name="Provider", | ||
), | ||
), | ||
("model", models.CharField(db_index=True, max_length=64, verbose_name="Model")), | ||
("name", models.CharField(max_length=64, verbose_name="Model Name")), | ||
("is_enabled", models.BooleanField(db_index=True, default=True, verbose_name="Enabled")), | ||
("prompt_price", models.DecimalField(decimal_places=10, max_digits=20, verbose_name="Prompt Price")), | ||
( | ||
"completion_price", | ||
models.DecimalField(decimal_places=10, max_digits=20, verbose_name="Completion Price"), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "AI Model", | ||
"verbose_name_plural": "AI Model", | ||
"ordering": ["provider", "name"], | ||
"unique_together": {("provider", "model")}, | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.