{
 "id": "chat-answer",
 "name": "Answer with citations",
 "purpose": "One assistant turn: the question, an answer still being written with numbered citations, the sources it cites with page numbers, and copy, retry and rating actions.",
 "use_when": [
  "for an assistant's answer that cites its sources",
  "a research or support assistant whose claims must be checked against named documents and pages"
 ],
 "avoid_when": [
  "a whole conversation with many turns and a reply box: use chat-thread with ai-composer",
  "a short inline suggestion the person accepts or rejects: use ai-suggestion",
  "a multi-step agent run with progress per step: use agent-steps"
 ],
 "type": "ai",
 "style": "editorial",
 "width": "medium",
 "tags": {
  "audience": "work",
  "industries": [
   "productivity",
   "education",
   "saas"
  ],
  "keywords": [
   "ai",
   "chat",
   "citations",
   "sources",
   "streaming"
  ]
 },
 "root": ".odl-chat-answer",
 "parts": [
  {
   "name": "question",
   "selector": ".odl-ask",
   "what": "what the person asked, right-aligned",
   "slot": "text"
  },
  {
   "name": "avatar",
   "selector": ".odl-avatar",
   "what": "the assistant's icon, hidden in a narrow box",
   "slot": "none"
  },
  {
   "name": "byline",
   "selector": ".odl-who",
   "what": "assistant name, mode and source count, and how long it took",
   "slot": "text"
  },
  {
   "name": "answer",
   "selector": ".odl-text p",
   "what": "one paragraph of the answer, with numbered citation links",
   "slot": "rich"
  },
  {
   "name": "citation",
   "selector": ".odl-cite",
   "what": "a numbered link that moves focus to its source",
   "slot": "action"
  },
  {
   "name": "sources",
   "selector": ".odl-src",
   "what": "one cited source: number, title, details and pages",
   "slot": "list"
  },
  {
   "name": "copy",
   "selector": ".odl-copy",
   "what": "copies the answer text",
   "slot": "action"
  },
  {
   "name": "retry",
   "selector": ".odl-actions button",
   "what": "asks for the answer again",
   "slot": "action"
  },
  {
   "name": "rating",
   "selector": ".odl-vote",
   "what": "good or bad answer, one at a time",
   "slot": "action"
  },
  {
   "name": "note",
   "selector": "output",
   "what": "a short status after copy or rating",
   "slot": "text"
  }
 ],
 "data": {
  "type": "object",
  "required": [
   "question",
   "answer"
  ],
  "properties": {
   "question": {
    "type": "string",
    "maxLength": 200,
    "part": "question"
   },
   "assistant": {
    "type": "string",
    "maxLength": 20,
    "part": "byline"
   },
   "byline": {
    "type": "array",
    "minItems": 0,
    "maxItems": 2,
    "part": "byline",
    "items": {
     "type": "object",
     "required": [
      "text"
     ],
     "properties": {
      "text": {
       "type": "string",
       "maxLength": 28
      }
     }
    }
   },
   "answer": {
    "type": "array",
    "minItems": 1,
    "maxItems": 4,
    "part": "answer",
    "items": {
     "type": "object",
     "required": [
      "text"
     ],
     "properties": {
      "text": {
       "type": "string",
       "maxLength": 500
      },
      "cites": {
       "type": "array",
       "minItems": 0,
       "maxItems": 3,
       "items": {
        "type": "object",
        "properties": {
         "number": {
          "type": "integer",
          "minimum": 1
         }
        }
       },
       "part": "citation"
      }
     }
    }
   },
   "sources": {
    "type": "array",
    "minItems": 1,
    "maxItems": 6,
    "part": "sources",
    "items": {
     "type": "object",
     "required": [
      "title"
     ],
     "properties": {
      "title": {
       "type": "string",
       "maxLength": 48
      },
      "detail": {
       "type": "string",
       "maxLength": 56
      },
      "pages": {
       "type": "string",
       "maxLength": 16
      },
      "number": {
       "type": "string",
       "maxLength": 80
      }
     }
    }
   }
  }
 },
 "states": {
  "shown": [
   "streaming",
   "citation focused",
   "copied",
   "rated up",
   "rated down",
   "hover",
   "focus"
  ],
  "edge": {
   "empty": {
    "status": "handled",
    "evidence": "data-od-list",
    "how": "the Smart UI renderer puts one plain 'Nothing to show yet.' line in an empty list"
   },
   "loading": {
    "status": "handled",
    "evidence": "data-od-slot",
    "how": "the Smart UI renderer draws each marked slot as a quiet block of its size while the data arrives; the static file shows the filled part"
   },
   "error": {
    "status": "handled",
    "how": "if the browser refuses to copy, the status line says so",
    "evidence": "Could not copy"
   },
   "disabled": {
    "status": "not_built",
    "how": "set disabled on the action buttons while the answer is still being written"
   },
   "overflow": {
    "status": "not_built",
    "how": "a long answer and source list grow the card; past about six sources, show the first few and a 'Show all sources' button"
   },
   "long_text": {
    "status": "handled",
    "how": "paragraphs and source titles wrap, page numbers never wrap, and a citation stays on the line with the word before it",
    "evidence": ".odl-chat-answer .odl-nw { white-space: nowrap; }"
   },
   "missing_image": {
    "status": "none",
    "how": "the part has no photo"
   }
  }
 },
 "tokens": [
  "--ds-border-width-default",
  "--ds-color-bg-accent-subtle",
  "--ds-color-bg-neutral-subtle",
  "--ds-color-border-accent",
  "--ds-color-border-focus",
  "--ds-color-border-subtle",
  "--ds-color-icon-accent",
  "--ds-color-surface-base",
  "--ds-color-surface-raised",
  "--ds-color-text-accent",
  "--ds-color-text-primary",
  "--ds-color-text-secondary",
  "--ds-color-text-tertiary",
  "--ds-focus-ring-offset",
  "--ds-focus-ring-width",
  "--ds-font-weight-heading",
  "--ds-font-weight-label",
  "--ds-icon-stroke-md",
  "--ds-motion-duration-medium",
  "--ds-motion-duration-short",
  "--ds-motion-easing-standard",
  "--ds-radius-container",
  "--ds-radius-control",
  "--ds-radius-control-sm",
  "--ds-radius-full",
  "--ds-radius-nested",
  "--ds-radius-person",
  "--ds-size-control-lg",
  "--ds-size-control-md",
  "--ds-size-control-sm",
  "--ds-size-icon-sm",
  "--ds-size-target-min",
  "--ds-space-16",
  "--ds-space-2",
  "--ds-space-inline-md",
  "--ds-space-inline-sm",
  "--ds-space-inline-xs",
  "--ds-space-inset-lg",
  "--ds-space-inset-md",
  "--ds-space-inset-sm",
  "--ds-space-inset-xl",
  "--ds-space-inset-xs",
  "--ds-space-stack-lg",
  "--ds-space-stack-md",
  "--ds-space-stack-sm",
  "--ds-space-stack-xl",
  "--ds-space-stack-xs",
  "--ds-text-body-md",
  "--ds-text-body-sm",
  "--ds-text-label-lg",
  "--ds-text-label-md",
  "--ds-text-label-sm"
 ],
 "a11y": {
  "summary": "The turn is aria-busy while writing and says so in a status; each citation link names its source and page and moves focus to it; every action button has a name and the ratings use aria-pressed.",
  "roles": [
   "article",
   "group",
   "region"
  ],
  "keyboard": [
   "Tab reaches each citation link, then Copy, Retry, Good answer and Bad answer",
   "Enter on a citation moves focus to its source, which lights up briefly",
   "Enter or Space presses the focused button; the two ratings act as toggles and only one can be on"
  ],
  "controls": {
   "button": 4,
   "input": 0,
   "link": 3,
   "select": 0,
   "textarea": 0,
   "summary": 0
  },
  "focus_visible": true,
  "reduced_motion": true,
  "min_target": true
 },
 "files": {
  "html": "components/chat-answer/component.html",
  "bytes": 14307,
  "script": true
 },
 "source": "brand/showcase/components/07-ai-composer",
 "photos": 0,
 "urls": {
  "html": "https://opendesigner.dev/library/chat-answer.html",
  "json": "https://opendesigner.dev/library/chat-answer.json",
  "page": "https://opendesigner.dev/library/chat-answer/"
 },
 "get": {
  "curl": "curl -fsSLo chat-answer.html https://opendesigner.dev/library/chat-answer.html",
  "opendesigner": "python3 path/to/skills/opendesigner/scripts/library.py add chat-answer --from https://opendesigner.dev",
  "prompt": "Add the OpenDesigner component chat-answer to this project: https://opendesigner.dev/library/chat-answer.html. Keep its markup and states; map its --ds-* variables to my tokens."
 }
}
