Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple script edition/creation #498

Open
manucarbonell opened this issue Feb 26, 2024 · 0 comments
Open

multiple script edition/creation #498

manucarbonell opened this issue Feb 26, 2024 · 0 comments

Comments

@manucarbonell
Copy link

Adding the option to modify or create multiple scripts in a given project with a single prompt. It works as follows:

Existing scripts:

example/calculate.py
from add import add

def calculate(x,y):
  result = add(x,y)*add(x,y)
  return result
example/add.py
def add(x,y):
   return x+y

Run sgpt with --multiscript-code option

sgpt --multiscript-code --project-path example/ "can you extract the multiplication in calculate as an import from an external script?"

Resulting modified and created scripts:

example/calculate.py
from add import add
from multiply import multiply

def calculate(x, y):
    result = multiply(add(x, y), add(x, y))
    return result

print(calculate(2, 3))
example/add.py
def add(x,y):
   return x+y
example/multiply.py
def multiply(x, y):
    return x * y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant