gorilla-llm / gorilla-cli

LLMs for your CLI
https://gorilla.cs.berkeley.edu/
Apache License 2.0
1.28k stars 75 forks source link

Fix The issue when user exits it only shows cancelled by user Process exited #22

Closed mohidmeer closed 1 year ago

mohidmeer commented 1 year ago

When User exits via keyboard Interupt

Whenever user exits the process via keyboard interupt like CTRL+C (NoneType is passed which) it shows error in terminal as Follow

Before

image

After Fix

image

mohidmeer commented 1 year ago

@ShishirPatil I saw this after the PR in issues someone already mentioned it #12 here

ShishirPatil commented 1 year ago

Thanks for this PR @mohidmeer I think this might need a refactor for Linux and Mac systems? I still seem to get the traceback..

image
mohidmeer commented 1 year ago

@ShishirPatil I used exit(); if NoneType is passed i should exit

mohidmeer commented 1 year ago

@ShishirPatil if selected_command==None: print('Process Exited') exit();

mohidmeer commented 1 year ago

Updated and verified on linux and windows

@ShishirPatil image image

ShishirPatil commented 1 year ago

@ShishirPatil if selected_command==None: print('Process Exited') exit();

Thanks for this @mohidmeer But you see the subsequent code requires that selected_command and exit_condition are populated to complete the request. You are write that the exit() will side-step it, but a) there is no log for what heppens then, so we can't tell if the command was successfully executed or if there is a syntax bug to fix, and b) using exit() in the middle of the file is considered bad practice unless otherwise strictly necessary! Hence, I suggested the below. Thoughts?

        if selected_command is not None:
            exit_condition = execute_command(selected_command)
        else:
            selected_command = "Cancelled"
            exit_condition = "Cancelled"
mohidmeer commented 1 year ago

I understand now @ShishirPatil thanks for explanation you want to complete the life cycle of script Instead of abruptly exiting the code