add basic starting prompt
This commit is contained in:
parent
428da090a6
commit
6072c791d5
@ -19,8 +19,12 @@
|
||||
|
||||
{% if request.method == "POST" %}
|
||||
{{ response|safe }}
|
||||
{% else %}
|
||||
{{ response|safe }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
<form action="" method="post">
|
||||
{{ form.as_p }}
|
||||
<input type="submit" value="Submit">
|
||||
|
28
epb_site/epb_site/views.py
Normal file
28
epb_site/epb_site/views.py
Normal file
@ -0,0 +1,28 @@
|
||||
# appname/views.py
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponse
|
||||
from .models import Statement
|
||||
from django.shortcuts import redirect
|
||||
from . import gemini
|
||||
import markdown
|
||||
|
||||
def home(request):
|
||||
if request.method == 'POST':
|
||||
response = gemini.chat_session.send_message(request.POST['input']).text
|
||||
md = markdown.Markdown()
|
||||
response = md.convert(response)
|
||||
|
||||
# formatted_response = re.sub('\*\*', r'\n\n', response)
|
||||
|
||||
form = Statement()
|
||||
return render(request, 'home.html', {'form': form, 'response': response})
|
||||
else:
|
||||
form = Statement()
|
||||
return render(request, 'home.html', {'form': form, 'response': 'Enter some basic data to begin:'})
|
||||
|
||||
def about(request):
|
||||
return HttpResponse("This is the about page")
|
||||
|
||||
# def statement(request):
|
||||
# form = Statement()
|
||||
# return render(request, 'home.html', {'form': form})
|
Loading…
Reference in New Issue
Block a user