Refactor code for improved readability and consistency across templates and frontend logic
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -1,35 +1,44 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Text Generation — AI Allucanget{% endblock %}
|
||||
{% block content %}
|
||||
{% extends "base.html" %} {% block title %}Text Generation — AI Allucanget{%
|
||||
endblock %} {% block content %}
|
||||
<div class="card">
|
||||
<h1>Text Generation</h1>
|
||||
<form method="post">
|
||||
<label for="model">Model</label>
|
||||
<input id="model" name="model" type="text" required
|
||||
placeholder="e.g. openai/gpt-4o"
|
||||
value="{{ request.form.get('model', '') }}">
|
||||
<input
|
||||
id="model"
|
||||
name="model"
|
||||
type="text"
|
||||
required
|
||||
placeholder="e.g. openai/gpt-4o"
|
||||
value="{{ request.form.get('model', '') }}"
|
||||
/>
|
||||
|
||||
<label for="prompt">Prompt</label>
|
||||
<textarea id="prompt" name="prompt" rows="5" required
|
||||
placeholder="Describe what you want…">{{ request.form.get('prompt', '') }}</textarea>
|
||||
<textarea
|
||||
id="prompt"
|
||||
name="prompt"
|
||||
rows="5"
|
||||
required
|
||||
placeholder="Describe what you want…"
|
||||
>
|
||||
{{ request.form.get('prompt', '') }}</textarea
|
||||
>
|
||||
|
||||
<button type="submit">Generate text</button>
|
||||
</form>
|
||||
|
||||
{% if error %}
|
||||
<div class="alert alert-error mt-2">{{ error }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if result %}
|
||||
<div class="result">
|
||||
<h2>Result</h2>
|
||||
<pre>{{ result.content }}</pre>
|
||||
{% if result.usage %}
|
||||
<p class="text-muted mt-1" style="font-size:0.8rem;">
|
||||
Tokens: {{ result.usage.get('total_tokens', '—') }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="alert alert-error mt-2">{{ error }}</div>
|
||||
{% endif %} {% if result %}
|
||||
<div class="result">
|
||||
<h2>Result</h2>
|
||||
<pre>{{ result.content }}</pre>
|
||||
{% if result.usage %}
|
||||
<p class="text-muted mt-1" style="font-size: 0.8rem">
|
||||
Tokens: {{ result.usage.get('total_tokens', '—') }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user