Filling the composer and waiting for Enter made the card a form to review rather than a thing to press. One click, one reply. That changes what a prompt has to be. The built-ins ended mid-sentence -- "My plan: " -- because nothing was sent until the person finished the thought; sent cold they are a model guessing at material nobody gave it. All three are rewritten to ask for what they need, so the first reply is the right question instead. There is a test that they end as complete sentences, since the failure is silent and only visible in the answer. requestSubmit, not submit: it fires the submit event, which is what htmx listens for. Same call the Enter key already makes. Version bumped because app.js is what changed, and the service worker caches it -- without the bump the first load after this would still only fill the box. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
"""Starting points offered on the new-chat screen."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from sqlalchemy import Boolean, Integer, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from lembas.db.base import Base, Timestamps, UUIDPrimaryKey
|
|
|
|
|
|
class Suggestion(UUIDPrimaryKey, Timestamps, Base):
|
|
"""One card on the empty chat screen.
|
|
|
|
Instance-wide rather than per-user: these are what an administrator wants
|
|
people to start with, the same way the instance system prompt is. There is
|
|
no owner_id and therefore nothing for `sharing` to decide.
|
|
"""
|
|
|
|
__tablename__ = "suggestions"
|
|
|
|
name: Mapped[str] = mapped_column(String(120), nullable=False)
|
|
description: Mapped[str] = mapped_column(String(300), default="")
|
|
# Sent as the first message the moment the card is clicked, so it has to
|
|
# stand on its own -- there is no chance to add anything to it first. The
|
|
# built-ins ask for what they need rather than assuming material.
|
|
prompt: Mapped[str] = mapped_column(Text, default="")
|
|
|
|
enabled: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
|
position: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
|
|
|
def __repr__(self) -> str:
|
|
return f"<Suggestion {self.name}>"
|