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.
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.jsonKeep the monthly copies under their own prefix so the 14-day rule never touches them.
Yes. The built-in job keeps the newest Backup:RetentionCount dumps, 14 by default, and deletes older ones after each run.
<pk-user-turn>
<span pkUserTurnTop>lifecycle.json</span>
How long should I keep daily Postgres backups…?
</pk-user-turn>
<pk-assistant-turn
modelName="Claude Sonnet 5.5"
[iconUrl]="providerIconUrl({ id: 'anthropic/claude-sonnet-5.5' })"
[copyText]="reply"
>
<pk-markdown class="prose dark:prose-invert max-w-none" [content]="reply" />
<button pkAssistantTurnActions hlmBtn variant="ghost" size="icon-sm" aria-label="Regenerate">
<ng-icon name="lucideRefreshCw" />
</button>
<span pkAssistantTurnMeta>14 credits · 1.2k tokens</span>
</pk-assistant-turn>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.
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.
<pk-assistant-turn
modelName="Claude Sonnet 5.5"
[iconUrl]="icon"
[streaming]="streaming()"
[copyText]="text()"
>
<pk-markdown [content]="text()" />
<span pkAssistantTurnMeta>9 credits · 640 tokens</span>
</pk-assistant-turn>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 buttonComponent API
PkUserTurn
| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | '' | 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
| Prop | Type | Default | Description |
|---|---|---|---|
| modelName | string | '' | Name of the model that answered, shown above the reply. No header without it. |
| iconUrl | string | undefined | undefined | Brand icon for the model, e.g. from providerIconUrl(). Monochrome icons invert in dark mode. |
| copyText | string | '' | The text the copy button puts on the clipboard; no copy button without it. |
| streaming | boolean | false | Holds back the action row while the reply is still arriving. |
| class | string | '' | Extra classes for the host. |
PkAssistantTurn content projection
| Prop | Type | Default | Description |
|---|---|---|---|
| (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. |