Files
Dumitru Picalau dac183c8f1 fix(ai-chat): hide leaked step fields, live @ chips, reply times (#97)
- A JSON-mode reply that writes the rest of its step into the message
  ("calls: []", "**calls**: []", '"calls": []}', the calls list itself)
  no longer shows it: engine/ai/step_fields.py cleans new answers and
  utils/chat-step-fields.ts cleans stored chats and live text, kept in step
  by tests/fixtures/step-fields-corpus.json.
- Items picked from the @ menu show as chips in the box while typing
  (ChatInputMarks overlays tinted pills on the textarea text), in the chat,
  the Draft with AI panels and the Pack builder.
- A picked wildcard's note tells the model to write @{Name} in options,
  and a new wildcard that leaves out a reference the user asked for gets a
  warning back so the model fixes it in the same answer.
- @{...} references in a chat reply stay coloured text; chips are for cards.
- Each reply shows how long it took beside Copy (elapsed_ms, kept with the
  chat; time paused on the user is left out). Reopened chats keep their
  format and tool-use badges too.
- The chat's model menu reloads when the provider or server changes.
- Docs: Ask about this page is pinned to the top right of the page, and it
  and the docs starters name the page, so a question sent after moving on
  still asks about it. The pipeline diagram stacks when narrow (docs beside
  an open chat) instead of running off the side.
- Docs: AI chat page.
2026-10-23 00:49:11 +02:00

20 lines
592 B
Python

"""Step fields leaked into a JSON-mode message are not shown."""
import json
from pathlib import Path
import pytest
from engine.ai.step_fields import strip_step_fields
CORPUS = json.loads(
(Path(__file__).parents[2] / "fixtures" / "step-fields-corpus.json").read_text("utf-8"))
@pytest.mark.parametrize("name,text,shown", CORPUS["cases"], ids=[c[0] for c in CORPUS["cases"]])
def test_corpus(name: str, text: str, shown: str) -> None:
assert strip_step_fields(text) == shown
def test_unchanged_text_is_returned_as_is() -> None:
assert strip_step_fields("Hi.\n") == "Hi.\n"