mirror of
https://github.com/OMGeeky/gpt-pilot.git
synced 2025-12-30 16:13:32 +01:00
33 lines
965 B
Python
33 lines
965 B
Python
class MockQuestionary:
|
|
def __init__(self, answers=None, initial_state='project_description'):
|
|
if answers is None:
|
|
answers = []
|
|
self.answers = iter(answers)
|
|
self.state = initial_state
|
|
|
|
class Style:
|
|
def __init__(self, *args, **kwargs):
|
|
pass
|
|
|
|
def text(self, question: str, style=None):
|
|
print('AI: ' + question)
|
|
if question.startswith('User Story'):
|
|
self.state = 'user_stories'
|
|
elif question.endswith('write "DONE"'):
|
|
self.state = 'DONE'
|
|
return self
|
|
|
|
def ask(self):
|
|
return self.unsafe_ask()
|
|
|
|
def unsafe_ask(self):
|
|
if self.state == 'user_stories':
|
|
answer = ''
|
|
elif self.state == 'DONE':
|
|
answer = 'DONE'
|
|
else: # if self.state == 'project_description':
|
|
answer = next(self.answers, '')
|
|
|
|
print('User:', answer)
|
|
return answer
|