Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 77 additions & 24 deletions doc/gui/0_gui.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,17 @@ not fifteen. Historical messages keep their original-piece lineage and are not
converted again.

**Convert once, reuse for all** is the default request-converter mode.
For single sends and shared repeats in the GUI, use **Add converted value** to apply
conversions before sending. Selected but unapplied pipelines are not run.
Completed conversions are added to the sendable prompt automatically. Single sends
and shared repeats use that exact value. Selected pipelines that have not run are not run on send.
**Convert independently for each** runs selected but unapplied request pipelines
separately on each conversation's original inputs when the count is greater than 1.
An explicitly applied preview, including manual edits, is reused exactly
in either mode. Converter order, repeated stages, and original/converted values
The repetition control is disabled after a manual conversion edit or a partial
conversion, including marked text regions. Hover over the disabled control for
the reason. Send once, or reset the conversions before repeating.
Repetitions also require a target that can replay the existing history. Configured
history adapters and provider restoration count as replay support. A fresh
request with no history can be repeated without editable-history support.
Converter order, repeated stages, and original/converted values
are preserved. API response converters always run independently per conversation.

Compact progress links open each conversation in the ordinary chat and sidebar.
Expand Down Expand Up @@ -316,12 +321,12 @@ Choose markers that are unlikely to appear in prompts or replies. If response
converters are configured, an unmatched marker in a reply raises before that reply
is stored. Longer markers reduce accidental matches but do not eliminate them.

Click **Add converted value** to apply the final result, then **Send**. The exact
applied value is sent and stored alongside the unchanged original; the backend does
Completed conversion results appear in the sendable prompt automatically. Select
**Send** when the result is ready. The exact value is sent and stored alongside the unchanged original; the backend does
not rerun the pipeline. The exact ordered list of applied converters is retained
as provenance, including duplicates and converters that change the data type, and
reloading the conversation shows the same original and converted values. You can
also edit only the top working input and apply it as a manual conversion without
also edit only the top working input as a manual conversion without
adding or running a registered converter.

API clients submit this list as `applied_converter_ids` on each preconverted
Expand All @@ -347,8 +352,9 @@ CoPyRIT renders different response types inline:

#### Editing Conversations

Select **Edit Conversation**, beside the target dropdown in the chat ribbon, to make a local draft.
Anyone who can view a conversation can edit a draft. The original messages stay
Select **Edit Conversation**, beside the target dropdown in the chat ribbon, or
double-click the message area to make a local draft. An unsent prompt also appears
in the editor. Anyone who can view a conversation can edit a draft. Sent messages stay
unchanged. Insert or delete messages at any position, change their roles, and use
the prompt area for text and attachments. The role selector is inside each prompt.
Use the small **Insert message** control between messages and the **X** at the
Expand All @@ -363,8 +369,20 @@ the call ID, name, and JSON arguments. **Add tool response** inserts a separate
`simulated_tool` message after it and copies the call ID. A response needs a preceding,
unanswered call. Tool content is stored, not executed.

During editing, targets without editable history are disabled. The target must
also accept every effective history data type, including audio, video, and tool
Opening the editor does not require editable-history support. Saving copied
history requires native support, a configured history adapter, or provider restoration, including for
`assistant`, `simulated_assistant`, and tool turns. Empty history needs neither.
An initial system/developer setup is also allowed when the target supports
system prompts and multiple turns. The final user prompt returns to the composer
and is not treated as replayed history.
The normal prompt box keeps its original and converted values separate. Its
converter pipeline, working input, and stage edits remain available in the same
tab when you save or leave the editor. Saving does not run converters again.
Changing the selected messages in the editor does not discard their stage edits.
If a final user message has multiple text pieces, the prompt box combines them
and shows a notice because one text input cannot retain separate per-piece stages.

The target must also accept every effective data type, including audio, video, and tool
pieces. A converted piece is checked using its converted data type. The
requirements update when pieces are added or removed. An incompatible current
target shows a warning; select a compatible target or clear the selection to
Expand All @@ -377,21 +395,31 @@ compatible target is selected. History validation checks native input support;
it does not run message normalizers or change the saved content.

Click the objective to edit it, or select **Add objective** on an empty chat.
Changes made during conversation editing stay local until you save.
Changes made during conversation editing stay local until you save or leave the editor.
Unsaved-change protection includes target-only changes. Canceling a draft leaves
the normal prompt box and its conversions unchanged.
The draft can have an objective and no messages or target. Sending is disabled
while you edit. **Save conversation** opens a destination dialog:

- **Same attack** adds a related conversation without replacing the main one.
This option is disabled for another operator's attack or a target conflict.
- **New attack** creates a separate manual attack. A target is optional. For an
unbound attack, select a target from the chat dropdown before the first send.
That first send binds the attack and its conversations to the selected target.

While editing, **Save to new attack** in the ribbon opens the same dialog with
**New attack** selected. It works for unsaved drafts and converted conversations.
The save confirmation disappears when you send the next prompt.
while you edit. **Save** creates a new related conversation in the current attack,
without a destination dialog. For a chat without a saved attack, it creates a new attack.
Saving to the current attack is disabled for another operator's attack or a target conflict.
It is also disabled when the original target cannot replay the retained history.
Selecting another target does not unlock the original attack: use **Save to new attack**
with a compatible target, or clear the target and choose a compatible one before sending.

Click outside the editor or select another conversation to save edits automatically.
If the source conversation has not been sent to a target, this updates the same
conversation. Repeated edit-and-exit cycles do not create extra branches. Sent
history always creates a new conversation. A failed save keeps the editor and its
changes visible. Leaving the page still uses the unsaved-change warning.
If a send already owns the source conversation, automatic save refuses to replace
its history. Wait for that send to finish before saving the draft again.

**Save to new attack** in the ribbon creates a separate manual attack immediately,
without a destination dialog. It works for unsaved drafts and converted conversations.
A target is optional. For an unbound attack, select a target from the chat dropdown
before the first send. That send binds the attack and its conversations to the target.
Save confirmations and other temporary info messages fade after five seconds,
or clear when you send the next prompt. Warnings and errors remain visible.

The objective is shared by all conversations in an attack. Changing it outside
conversation editing, or saving a changed objective to **Same attack**, resets the
Expand All @@ -408,7 +436,8 @@ The converter icon in a prompt selects only that message. Use the checkboxes in
mode, which pairs each **Original message** with its **Converted message**.
A strong divider separates the converter pipeline from the results; lighter
dividers separate message pairs. **Select all** and **Clear** control the
selection. **Add converted values** applies batch results to the draft. Structured
selection. Completed batch results are added to the draft automatically. Editing
one piece does not clear existing conversions on other pieces. Structured
tool content is not passed to text converters.
Single-message conversion keeps editable stage outputs. After a middle-stage
edit, rerun only the remaining stages. Converter IDs record the stages used,
Expand All @@ -426,6 +455,30 @@ Retrying the same failed save or copy reuses its save ID to avoid duplicate resu
A new copy after a confirmed success gets a new ID.
Downloads, original/converted views, and score details remain available.

#### Undoing the Last Send

Use the **Undo last send** arrow, directly below the converter button inside
the **Type prompt here** box, to
restore the most recent single send from this tab. This creates a conversation
branch before that user turn, removes the response from the current view, and
puts the user prompt back in the composer. The original sent conversation stays
in history. Undo does not reverse any action already taken by the target.

The prompt, converter order, working input, generated stages, and manual
middle-stage edits are restored from memory. Undo does not run the converters
again. You can edit a restored stage and convert only the remaining stages.
This also applies after editing and saving a conversation: Undo keeps the edited
history and restores the original/converted prompt and its pipeline as they were
immediately before sending.

The control is hidden when the target cannot replay the history that undo would retain.
Only that retained prefix counts: an otherwise empty first-turn undo remains available
even if the target cannot edit history.
The control is disabled after a reload or runtime change, for repeated or
incomplete sends, or when a new
draft or a changed converter pipeline would be overwritten. Hover over the
disabled control for its reason. Only the most recent send can be undone.

#### Conversations Panel

Click the panel toggle in the ribbon to open the conversations sidebar. This panel shows all conversations within the current attack, including message counts and last-message previews. You can switch between conversations, create new ones, and promote a conversation to be the "main" conversation.
Expand Down
2 changes: 1 addition & 1 deletion frontend/e2e/accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ test.describe("Accessibility", () => {
await expect(input).toBeVisible({ timeout: 5000 });

// Send button should have accessible name
const sendButton = page.getByRole("button", { name: /send/i });
const sendButton = page.getByRole("button", { name: "Send message", exact: true });
await expect(sendButton).toBeVisible();

// New Attack button should have accessible name
Expand Down
8 changes: 5 additions & 3 deletions frontend/e2e/chat-recovery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,9 @@ test.describe("Chat processing recovery @seeded", () => {
const failed = await sendFromComposer(page, "Edit this failed prompt");
const sourceAttackId = failed.attack.attack_result_id;
if (reload) await page.reload();
await page.getByRole("button", { name: "Copy or Branch", exact: true }).last().click();
await expect(page.getByRole("button", { name: "Edit Conversation", exact: true })).toBeEnabled();
await expect(page.getByTestId("message-bubble-2")).toContainText("Edit this failed prompt");
await page.getByTestId("copy-to-input-btn-2").click();
const [savedResponse] = await Promise.all([
page.waitForResponse((response) => response.request().method() === "POST"
&& new URL(response.url()).pathname === "/api/attacks/save-conversation"),
Expand Down Expand Up @@ -720,7 +722,7 @@ test.describe("Chat processing recovery @seeded", () => {
await page.getByTestId(`converter-option-${imageConverterId}`).click();
await panel.getByRole("button", { name: "Convert", exact: true }).click();
await expect(page.getByTestId("converter-preview-result")).toBeVisible();
await panel.getByRole("button", { name: "Add converted value", exact: true }).click();
await expect(page.getByTestId("clear-media-conversion-image")).toBeVisible();
await panel.getByRole("button", { name: "Close converters", exact: true }).click();
localTarget.setProcessingFailure(true);
const failed = await sendFromComposer(page, "Restore the original image");
Expand Down Expand Up @@ -848,7 +850,7 @@ test.describe("Chat processing recovery @seeded", () => {
await expect(panel.getByTestId(`converter-item-${imageConverterId}`)).toBeVisible();
await panel.getByRole("button", { name: "Convert", exact: true }).click();
await expect(page.getByTestId("converter-preview-result")).toBeVisible();
await panel.getByRole("button", { name: "Add converted value", exact: true }).click();
await expect(page.getByTestId("clear-media-conversion-image")).toBeVisible();
await panel.getByRole("button", { name: "Close converters", exact: true }).click();
localTarget.setProcessingFailure(true);
const [originalRequest, first] = await Promise.all([
Expand Down
Loading
Loading