mirror of
https://github.com/OMGeeky/gpt-pilot.git
synced 2026-02-23 15:49:50 +01:00
Refactored saving previous steps and made steps be loaded by looking at the current step as well
This commit is contained in:
@@ -6,11 +6,11 @@ from database.models.app import App
|
||||
|
||||
class CommandRuns(BaseModel):
|
||||
id = AutoField()
|
||||
app = ForeignKeyField(App)
|
||||
app = ForeignKeyField(App, on_delete='CASCADE')
|
||||
hash_id = CharField(null=False)
|
||||
command = TextField(null=True)
|
||||
cli_response = TextField(null=True)
|
||||
previous_command_run = ForeignKeyField('self', null=True, column_name='previous_command_run')
|
||||
previous_step = ForeignKeyField('self', null=True, column_name='previous_step')
|
||||
|
||||
class Meta:
|
||||
db_table = 'command_runs'
|
||||
|
||||
@@ -7,7 +7,7 @@ from database.models.app import App
|
||||
|
||||
|
||||
class ProgressStep(BaseModel):
|
||||
app = ForeignKeyField(App, primary_key=True)
|
||||
app = ForeignKeyField(App, primary_key=True, on_delete='CASCADE')
|
||||
step = CharField()
|
||||
data = BinaryJSONField(null=True)
|
||||
messages = BinaryJSONField(null=True)
|
||||
|
||||
@@ -8,11 +8,11 @@ from database.models.app import App
|
||||
|
||||
class DevelopmentSteps(BaseModel):
|
||||
id = AutoField() # This will serve as the primary key
|
||||
app = ForeignKeyField(App)
|
||||
app = ForeignKeyField(App, on_delete='CASCADE')
|
||||
hash_id = CharField(null=False)
|
||||
messages = BinaryJSONField(null=True)
|
||||
llm_response = BinaryJSONField(null=False)
|
||||
previous_dev_step = ForeignKeyField('self', null=True, column_name='previous_dev_step')
|
||||
previous_step = ForeignKeyField('self', null=True, column_name='previous_step')
|
||||
|
||||
class Meta:
|
||||
db_table = 'development_steps'
|
||||
|
||||
@@ -4,7 +4,7 @@ from database.models.components.base_models import BaseModel
|
||||
from database.models.development_steps import DevelopmentSteps
|
||||
|
||||
class FileSnapshot(BaseModel):
|
||||
development_step = ForeignKeyField(DevelopmentSteps, backref='files')
|
||||
development_step = ForeignKeyField(DevelopmentSteps, backref='files', on_delete='CASCADE')
|
||||
name = CharField()
|
||||
content = TextField()
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from database.models.development_steps import DevelopmentSteps
|
||||
from database.models.app import App
|
||||
|
||||
class File(BaseModel):
|
||||
app = ForeignKeyField(App)
|
||||
app = ForeignKeyField(App, on_delete='CASCADE')
|
||||
name = CharField()
|
||||
path = CharField()
|
||||
description = TextField()
|
||||
|
||||
@@ -6,11 +6,11 @@ from database.models.app import App
|
||||
|
||||
class UserInputs(BaseModel):
|
||||
id = AutoField()
|
||||
app = ForeignKeyField(App)
|
||||
app = ForeignKeyField(App, on_delete='CASCADE')
|
||||
hash_id = CharField(null=False)
|
||||
query = TextField(null=True)
|
||||
user_input = TextField(null=True)
|
||||
previous_user_input = ForeignKeyField('self', null=True, column_name='previous_user_input')
|
||||
previous_step = ForeignKeyField('self', null=True, column_name='previous_step')
|
||||
|
||||
class Meta:
|
||||
db_table = 'user_inputs'
|
||||
|
||||
Reference in New Issue
Block a user