Revert "add separate counter for development steps in model"

This reverts commit a7cd3d338a.
pull/1160/head
Zvonimir Sabljic 3 years ago
parent 23648a6b8a
commit aed2544bb6

@ -12,7 +12,7 @@ OPENROUTER_API_KEY=
# In case of Azure/OpenRouter endpoint, change this to your deployed model name
MODEL_NAME=gpt-4-1106-preview
# MODEL_NAME=gpt-4
# MODEL_NAME=gpt-3.5-turbo-16k
# MODEL_NAME=openai/gpt-3.5-turbo-16k
MAX_TOKENS=8192
# Folders which shouldn't be tracked in workspace (useful to ignore folders created by compiler)

@ -1,6 +1,6 @@
from playhouse.shortcuts import model_to_dict
from utils.style import color_yellow, color_red
from peewee import DoesNotExist, IntegrityError, fn
from peewee import DoesNotExist, IntegrityError
from functools import reduce
import operator
import psycopg2
@ -272,12 +272,6 @@ def hash_and_save_step(Model, app_id, unique_data_fields, data_fields, message):
def save_development_step(project, prompt_path, prompt_data, messages, llm_response, exception=None):
last_step_record = (DevelopmentSteps
.select(fn.MAX(DevelopmentSteps.dev_step_number))
.where(DevelopmentSteps.app == project.args['app_id'])
.scalar() or 0)
dev_step_number = last_step_record + 1
data_fields = {
'messages': messages,
'llm_response': llm_response,
@ -285,8 +279,7 @@ def save_development_step(project, prompt_path, prompt_data, messages, llm_respo
'prompt_data': {} if prompt_data is None else {k: v for k, v in prompt_data.items() if
k not in PROMPT_DATA_TO_IGNORE and not callable(v)},
'llm_req_num': project.llm_req_num,
'token_limit_exception_raised': exception,
'dev_step_number': dev_step_number
'token_limit_exception_raised': exception
}
unique_data = {

@ -7,8 +7,6 @@ from playhouse.postgres_ext import BinaryJSONField
class DevelopmentSteps(BaseModel):
# todo this needs refactoring. previous_step is self-referential foreign key and id is auto-incrementing primary
# key for all apps because of that dev_step_number is added to keep track of dev steps for each app individually
id = AutoField() # This will serve as the primary key
app = ForeignKeyField(App, on_delete='CASCADE')
prompt_path = TextField(null=True)
@ -25,7 +23,6 @@ class DevelopmentSteps(BaseModel):
prompt_data = JSONField(null=True)
previous_step = ForeignKeyField('self', null=True, column_name='previous_step')
dev_step_number = IntegerField()
high_level_step = CharField(null=True)
class Meta:

@ -59,7 +59,7 @@ class AgentConvo:
development_step = get_saved_development_step(self.agent.project)
if development_step is not None and self.agent.project.skip_steps:
# if we do, use it
print(color_yellow(f'Restoring development step with id {development_step.dev_step_number}'))
print(color_yellow(f'Restoring development step with id {development_step.id}'))
self.agent.project.checkpoints['last_development_step'] = development_step
self.agent.project.restore_files(development_step.id)
response = development_step.llm_response
@ -240,7 +240,7 @@ class AgentConvo:
print_msg = capitalize_first_word_with_underscores(self.high_level_step)
if self.log_to_user:
if self.agent.project.checkpoints['last_development_step'] is not None:
dev_step_msg = f'\nDev step {str(self.agent.project.checkpoints["last_development_step"].dev_step_number)}\n'
dev_step_msg = f'\nDev step {str(self.agent.project.checkpoints["last_development_step"])}\n'
print(color_yellow_bold(dev_step_msg), end='')
logger.info(dev_step_msg)
print(f"\n{content}\n", type='local')

@ -103,7 +103,7 @@ def test_create_tables(database):
def test_file_snapshot(content, expected_content):
user = User.create(email="", password="")
app = App.create(user=user)
step = DevelopmentSteps.create(app=app, llm_response={}, dev_step_number=1)
step = DevelopmentSteps.create(app=app, llm_response={})
file = File.create(app=app, name="test", path="test", full_path="test")
fs = FileSnapshot.create(

Loading…
Cancel
Save