Refactored project description to use AgentConvo class

This commit is contained in:
Zvonimir Sabljic
2023-07-31 12:42:46 +02:00
parent 1c53bbf029
commit e35f003bda

View File

@@ -1,16 +1,19 @@
# project_description.py
import json
from termcolor import colored
from helpers.AgentConvo import AgentConvo
from logger.logger import logger
from database.database import save_progress, save_app, get_progress_steps
from utils.utils import execute_step, generate_app_data
from prompts.prompts import ask_for_app_type, ask_for_main_app_definition, get_additional_info_from_openai, \
generate_messages_from_description, execute_chat_prompt
generate_messages_from_description
def get_project_description(args):
current_step = 'project_description'
convo_project_description = AgentConvo(current_step)
# If this app_id already did this step, just get all data from DB and don't ask user again
steps = get_progress_steps(args['app_id'], current_step)
if steps and not execute_step(args['step'], current_step):
@@ -37,10 +40,9 @@ def get_project_description(args):
high_level_messages = get_additional_info_from_openai(
generate_messages_from_description(description, args['app_type']))
high_level_summary, high_level_messages = execute_chat_prompt('utils/summary.prompt',
high_level_summary = convo_project_description.send_message('utils/summary.prompt',
{'conversation': '\n'.join(
[f"{msg['role']}: {msg['content']}" for msg in high_level_messages])},
current_step)
[f"{msg['role']}: {msg['content']}" for msg in high_level_messages])})
save_progress(args['app_id'], current_step,
{"messages": high_level_messages, "summary": high_level_summary, "app_data": generate_app_data(args)