From 1beffbde0f044135e8071081d9aa3b69711e0bff Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 12 May 2023 15:17:50 -0700 Subject: [PATCH] better --- examples/hello-world-flask.md | 130 +--------------------------------- 1 file changed, 2 insertions(+), 128 deletions(-) diff --git a/examples/hello-world-flask.md b/examples/hello-world-flask.md index d163d3ac5..6768455f1 100644 --- a/examples/hello-world-flask.md +++ b/examples/hello-world-flask.md @@ -1,5 +1,5 @@ -# New session started at 2023-05-12 15:13:22 +# New session started at 2023-05-12 15:17:30 _This tool will almost certainly fail to work with gpt-3.5-turbo_ _Creating /Users/gauthier/tmp/flask/app.py_ _Loading /Users/gauthier/tmp/flask/app.py_ @@ -30,130 +30,4 @@ def hello(): This code creates a Flask app and adds a `/hello` endpoint that returns "Hello, World!" when accessed. _Applied edit to app.py_ -_d45ebc3 aider: Added a /hello endpoint that returns "Hello, World!" when accessed._ ---- -#### add an endpoint like /add/3/5 which returns the sum of the 2 numbers - -Ok, here are the changes: - -```python -app.py -<<<<<<< ORIGINAL -======= -from flask import Flask - -app = Flask(__name__) - -@app.route('/hello') -def hello(): - return 'Hello, World!' - -@app.route('/add//') -def add(a, b): - return str(a + b) ->>>>>>> UPDATED -``` - -This code adds a `/add//` endpoint that takes two integers as parameters and returns their sum when accessed. - -_Applied edit to app.py_ -_e1faf37 aider: Added an endpoint `/add//` that takes two integers as parameters and returns their sum when accessed._ ---- -#### add /fibonacci/X - -Sure, here are the changes: - -```python -app.py -<<<<<<< ORIGINAL -======= -from flask import Flask - -app = Flask(__name__) - -@app.route('/hello') -def hello(): - return 'Hello, World!' - -@app.route('/add//') -def add(a, b): - return str(a + b) - -@app.route('/fibonacci/') -def fibonacci(n): - if n <= 0: - return "Invalid input" - elif n == 1: - return "0" - elif n == 2: - return "0, 1" - else: - fib = [0, 1] - for i in range(2, n): - fib.append(fib[i-1] + fib[i-2]) - return ', '.join(str(x) for x in fib) ->>>>>>> UPDATED -``` - -This code adds a `/fibonacci/` endpoint that takes an integer `n` as parameter and returns the first `n` numbers of the Fibonacci sequence when accessed. If `n` is less than or equal to 0, it returns "Invalid input". If `n` is 1, it returns "0". If `n` is 2, it returns "0, 1". - -_Applied edit to app.py_ -_9b3d336 aider: Added /fibonacci/ endpoint to return the first n numbers of the Fibonacci sequence._ ---- -#### remove the hello endpoint - -Ok, here are the changes: - -```python -app.py -<<<<<<< ORIGINAL -from flask import Flask - -app = Flask(__name__) - -@app.route('/add//') -def add(a, b): - return str(a + b) - -@app.route('/fibonacci/') -def fibonacci(n): - if n <= 0: - return "Invalid input" - elif n == 1: - return "0" - elif n == 2: - return "0, 1" - else: - fib = [0, 1] - for i in range(2, n): - fib.append(fib[i-1] + fib[i-2]) - return ', '.join(str(x) for x in fib) -======= -from flask import Flask - -app = Flask(__name__) - -@app.route('/add//') -def add(a, b): - return str(a + b) - -@app.route('/fibonacci/') -def fibonacci(n): - if n <= 0: - return "Invalid input" - elif n == 1: - return "0" - elif n == 2: - return "0, 1" - else: - fib = [0, 1] - for i in range(2, n): - fib.append(fib[i-1] + fib[i-2]) - return ', '.join(str(x) for x in fib) ->>>>>>> UPDATED -``` - -This code removes the `/hello` endpoint from the Flask app. - -_Applied edit to app.py_ -_27f80dc aider: Removed the `/hello` endpoint from the Flask app._ +_8f7db45 aider: Added a /hello endpoint that returns "Hello, World!" when accessed._