Skip to content

Commit

Permalink
Merge pull request #620 from Pythagora-io/project-name-fix
Browse files Browse the repository at this point in the history
project name fix
  • Loading branch information
senko committed Feb 3, 2024
2 parents 019caf9 + 539b413 commit 2673d1b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions pilot/const/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
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
14 changes: 11 additions & 3 deletions pilot/helpers/agents/ProductOwner.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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'
Expand Down Expand Up @@ -42,9 +43,16 @@ def get_project_description(self):
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)

Expand Down

0 comments on commit 2673d1b

Please sign in to comment.