feat: bot authoring form with bot_authored event

This commit is contained in:
Joseph Doherty
2026-04-26 12:17:06 -04:00
parent a5339fc1d2
commit 44ea627a8a
9 changed files with 411 additions and 2 deletions
+18
View File
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}chat{% endblock %}</title>
<link rel="stylesheet" href="/static/app.css">
<script src="https://unpkg.com/htmx.org@1.9.12" defer></script>
</head>
<body>
<header class="topbar">
<a class="brand" href="/bots">chat</a>
</header>
<main class="container">
{% block content %}{% endblock %}
</main>
</body>
</html>
+57
View File
@@ -0,0 +1,57 @@
{% extends "base.html" %}
{% block title %}New bot - chat{% endblock %}
{% block content %}
<h1>New bot</h1>
{% if error %}
<p class="error">{{ error }}</p>
{% endif %}
<form method="post" action="/bots/new" class="bot-form">
<label>
<span>id</span>
<input type="text" name="id" required value="{{ values.id|default('', true) }}">
<small>slug-like identifier (e.g. <code>bot_a</code>, <code>alice_office</code>)</small>
</label>
<label>
<span>name</span>
<input type="text" name="name" required value="{{ values.name|default('', true) }}">
</label>
<label>
<span>persona</span>
<textarea name="persona" rows="4" required>{{ values.persona|default('', true) }}</textarea>
<small>a short description, ~3-5 lines</small>
</label>
<label>
<span>voice samples</span>
<textarea name="voice_samples" rows="6">{{ values.voice_samples|default('', true) }}</textarea>
<small>1-3 samples, separated by a line containing only <code>---</code></small>
</label>
<label>
<span>traits</span>
<textarea name="traits" rows="3">{{ values.traits|default('', true) }}</textarea>
<small>comma- or newline-separated; 3-15 typical</small>
</label>
<label>
<span>backstory</span>
<textarea name="backstory" rows="6">{{ values.backstory|default('', true) }}</textarea>
<small>100-500 words target</small>
</label>
<label>
<span>initial relationship to you</span>
<textarea name="initial_relationship_to_you" rows="3" required>{{ values.initial_relationship_to_you|default('', true) }}</textarea>
</label>
<label>
<span>kickoff prose</span>
<textarea name="kickoff_prose" rows="4" required>{{ values.kickoff_prose|default('', true) }}</textarea>
<small>a short opening scene; parsed in the next step</small>
</label>
<button type="submit">Save bot</button>
</form>
{% endblock %}
+17
View File
@@ -0,0 +1,17 @@
{% extends "base.html" %}
{% block title %}Bots - chat{% endblock %}
{% block content %}
<header class="page-header">
<h1>Bots</h1>
<a class="btn" href="/bots/new">+ New bot</a>
</header>
{% if bots %}
<ul class="bot-list">
{% for bot in bots %}
<li><a href="/bots/{{ bot.id }}">{{ bot.name }}</a></li>
{% endfor %}
</ul>
{% else %}
<p class="muted">No bots yet. <a href="/bots/new">Create your first bot.</a></p>
{% endif %}
{% endblock %}