ngx-prompt-kit

Chat Turn

ngx-prompt-kit original — not part of ibelick/prompt-kit

The two halves of a conversation: pk-user-turn is a right-aligned spartan hlm-bubble that keeps line breaks, and pk-assistant-turn shows which model answered, the reply, and a row with a copy button, extra actions and details such as cost.

Examples

Conversation

Assistant replies render through pk-markdown. The model icon comes from providerIconUrl(), and [pkAssistantTurnMeta] holds what the reply cost.

lifecycle.json
How long should I keep daily Postgres backups for a small SaaS, and how do I prune old ones from S3?
Claude Sonnet 5.5

For a small SaaS, a common starting point is 14 daily, 8 weekly and 12 monthly backups.

The simplest way to prune in S3 is a lifecycle rule rather than a script:

aws s3api put-bucket-lifecycle-configuration \
  --bucket tessaly-backups \
  --lifecycle-configuration file://lifecycle.json

Keep the monthly copies under their own prefix so the 14-day rule never touches them.

14 credits · 1.2k tokens
Can Tessaly's built-in backup job do that instead?
GPT-5

Yes. The built-in job keeps the newest Backup:RetentionCount dumps, 14 by default, and deletes older ones after each run.

20 credits · 310 tokens

Streaming

While [streaming] is true the action row is held back, since there is nothing final to copy yet. It appears once the reply is done.

What changes if I raise the retention count?
Claude Sonnet 5.5

Here is what changes when you raise the retention count:

  • Storage grows linearly, roughly one dump per day.
  • Restore options go further back, which helps with late-noticed bad deploys.
  • Nothing else changes: the prune step still runs after every backup.

For most teams, 30 is a comfortable ceiling.

9 credits · 640 tokens

Installation

Add the chat-turn component (and the cn() utility) to your project.

ng generate ngx-prompt-kit:chat-turn

It is built on spartan/ui, so add these helm components too: bubble, button.

ng g @spartan-ng/cli:ui bubble button

Component API

PkUserTurn

PropTypeDefaultDescription
classstring '' Extra classes for the host (a right-aligned column).
(content)text — The message, in a bubble up to 76% wide that keeps line breaks as typed.
[pkUserTurnTop]element — Above the bubble, e.g. attachment chips.

PkAssistantTurn

PropTypeDefaultDescription
modelNamestring '' Name of the model that answered, shown above the reply. No header without it.
iconUrlstring | undefined undefined Brand icon for the model, e.g. from providerIconUrl(). Monochrome icons invert in dark mode.
copyTextstring '' The text the copy button puts on the clipboard; no copy button without it.
streamingboolean false Holds back the action row while the reply is still arriving.
classstring '' Extra classes for the host.

PkAssistantTurn content projection

PropTypeDefaultDescription
(content)element — The reply, e.g. a pk-markdown.
[pkAssistantTurnActions]element — Extra actions in the row under the reply, after copy (e.g. regenerate, branch nav).
[pkAssistantTurnMeta]element — Details at the end of the row, e.g. what the reply cost.