-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
25 lines (20 loc) · 798 Bytes
/
server.py
File metadata and controls
25 lines (20 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from urllib.parse import unquote
from pprint import pp
from flask import Flask, send_from_directory, jsonify, render_template
from main import run_conversation, get_diff
app = Flask(__name__, static_folder='./static')
@app.route('/static/<path:filename>')
def send_file(filename):
return send_from_directory(app.static_folder, filename)
@app.route('/')
def home():
return send_from_directory('static', 'index.html')
@app.route('/<author>/<repo>/<base>/<head>')
def begin_workflow(author, repo, base, head):
base_ = unquote(unquote(base))
head_ = unquote(unquote(head))
resp = run_conversation(head)
pp(resp)
return render_template('index.html', repo=repo, author=author, base=base_, head=head_, diff_json=resp)
if __name__ == '__main__':
app.run(port=8080)