add basic starting prompt
This commit is contained in:
parent
428da090a6
commit
6072c791d5
@ -18,9 +18,13 @@
|
||||
<body>
|
||||
|
||||
{% if request.method == "POST" %}
|
||||
{{ response|safe }}
|
||||
{{ 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