mirror of
https://github.com/Pythagora-io/gpt-pilot.git
synced 2026-01-10 13:37:55 -05:00
don't allow project name longer than 50 characters
This commit is contained in:
@@ -2,3 +2,4 @@ CHECK_AND_CONTINUE = 'Is everything working? Let me know if something needs to b
|
||||
WHEN_USER_DONE = 'Once you have completed, enter "continue"'
|
||||
AFFIRMATIVE_ANSWERS = ['', 'y', 'yes', 'ok', 'okay', 'sure', 'absolutely', 'indeed', 'correct', 'affirmative', 'Use GPT Pilot\'s code']
|
||||
NEGATIVE_ANSWERS = ['n', 'no', 'skip', 'negative', 'not now', 'cancel', 'decline', 'stop', 'Keep my changes']
|
||||
MAX_PROJECT_NAME_LENGTH = 50
|
||||
|
||||
@@ -9,6 +9,7 @@ from utils.files import setup_workspace
|
||||
from prompts.prompts import ask_for_app_type, ask_for_main_app_definition, get_additional_info_from_openai, \
|
||||
generate_messages_from_description, ask_user, get_prompt
|
||||
from const.llm import END_RESPONSE
|
||||
from const.messages import MAX_PROJECT_NAME_LENGTH
|
||||
|
||||
PROJECT_DESCRIPTION_STEP = 'project_description'
|
||||
USER_STORIES_STEP = 'user_stories'
|
||||
@@ -42,9 +43,16 @@ class ProductOwner(Agent):
|
||||
if 'app_type' not in self.project.args:
|
||||
self.project.args['app_type'] = ask_for_app_type()
|
||||
if 'name' not in self.project.args:
|
||||
question = 'What is the project name?'
|
||||
print(question, type='ipc')
|
||||
self.project.args['name'] = clean_filename(ask_user(self.project, question))
|
||||
while True:
|
||||
question = 'What is the project name?'
|
||||
print(question, type='ipc')
|
||||
project_name = ask_user(self.project, question)
|
||||
if len(project_name) <= MAX_PROJECT_NAME_LENGTH:
|
||||
break
|
||||
else:
|
||||
print(f"Hold your horses cowboy! Please, give project NAME with max {MAX_PROJECT_NAME_LENGTH} characters.")
|
||||
|
||||
self.project.args['name'] = clean_filename(project_name)
|
||||
|
||||
self.project.app = save_app(self.project)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user