Skip to content

Commit

Permalink
disable dubgging & understanding flow
Browse files Browse the repository at this point in the history
  • Loading branch information
LarynQi committed Jan 23, 2025
1 parent 0d409b5 commit f2fcd98
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions client/protocols/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class HelpProtocol(models.Protocol):
"d": "I would like debugging help with my code.",
"p": "I would like help understanding the problem."
}
NO_HELP_TYPE_OPTIONS = {'y'}
DISABLE_HELP_OPTIONS = {"never"}
HELP_KEY = 'jfv97pd8ogybhilq3;orfuwyhiulae'
AG_PREFIX = "————————————————————————\nThe following is an automated report from an autograding tool that may indicate a failed test case or a syntax error. Consider it in your response.\n\n"
Expand All @@ -48,7 +49,10 @@ class HelpProtocol(models.Protocol):
DISABLED_CACHE = '.ok_disabled'
UNKNOWN_EMAIL = '<unknown from CLI>'
BOT_PREFIX = '[61A-bot]: '
HELP_PROMPT = BOT_PREFIX + "Would you like to receive debugging help (d) or help understanding the problem (p)? You can also type a specific question.\nPress return/enter to receive no help. Type \"never\" to turn off 61a-bot for this assignment."
HELP_TYPE_PROMPT = BOT_PREFIX + "Would you like to receive debugging help (d) or help understanding the problem (p)? You can also type a specific question.\nPress return/enter to receive no help. Type \"never\" to turn off 61a-bot for this assignment."
NO_HELP_TYPE_PROMPT = BOT_PREFIX + "Would you like to receive 61A-bot feedback on your code (y/N/never)? "
HELP_TYPE_ENABLED = False
HELP_TYPE_DISABLED_MESSAGE = '<help type disabled>'
CS61A_ENDPOINT = 'cs61a'
C88C_ENDPOINT = 'c88c'
CS61A_ID = '61a'
Expand Down Expand Up @@ -84,18 +88,21 @@ def run(self, messages):
email = messages.get('email') or self.UNKNOWN_EMAIL

if ((failed and (not self._get_disabled(email))) or get_help) and (config.get('src', [''])[0][:2] == 'hw'):
print(self.HELP_PROMPT)
if self.HELP_TYPE_ENABLED:
print(self.HELP_TYPE_PROMPT)
else:
print(self.NO_HELP_TYPE_PROMPT)
res = input("> ").lower().strip()
print()
if res and res not in self.DISABLE_HELP_OPTIONS:
if ((res and self.HELP_TYPE_ENABLED) or (res in self.NO_HELP_TYPE_OPTIONS and not self.HELP_TYPE_ENABLED)) and (res not in self.DISABLE_HELP_OPTIONS):
self._set_disabled(email, disabled=False)
filename = config['src'][0]
code = open(filename, 'r').read()
autograder_output = messages.get('autograder_output', '')
consent = self._get_consent(email)
context = self._get_context(email)
curr_message = {'role': 'user', 'content': code}
student_query = self.HELP_OPTIONS.get(res, res)
student_query = self.HELP_OPTIONS.get(res, res) if self.HELP_TYPE_ENABLED else self.HELP_TYPE_DISABLED_MESSAGE
help_payload = {
'email': email,
'promptLabel': 'Get_help',
Expand Down

0 comments on commit f2fcd98

Please sign in to comment.