Skip to content

Commit

Permalink
Trying to get prompter to redirect correctly on Render
Browse files Browse the repository at this point in the history
  • Loading branch information
bdelucia committed Oct 9, 2024
1 parent a808109 commit cf74905
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Binary file modified __pycache__/views.cpython-312.pyc
Binary file not shown.
6 changes: 3 additions & 3 deletions views.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ def process_prompt():
max_tokens = 100
)

weather_data, rounded_temp, funFact, news_articles = get_api_responses()
response = response.choices[0].message.content.strip()
return render_template('index.html', funFact = funFact, weather_data=weather_data, rounded_temp=rounded_temp, news_articles=news_articles, response=response)
return redirect(url_for('views.home', response=response))

# Renders index.html with passed arguments
@views.route("/")
def home():
weather_data, rounded_temp, funFact, news_articles = get_api_responses()
return render_template("index.html", funFact = funFact, weather_data=weather_data, rounded_temp=rounded_temp, news_articles=news_articles, response=None)
response = request.args.get('response', None)
return render_template("index.html", funFact = funFact, weather_data=weather_data, rounded_temp=rounded_temp, news_articles=news_articles, response=response)

0 comments on commit cf74905

Please sign in to comment.