Add full-featured AIChat component

AIChat (elements/ai/AIChat) is a complete LLM chat UI built on new hooks:
- useAIChat: streaming conversation state (send, stop, regenerate,
  edit, feedback); `send` may return a string, async iterable,
  ReadableStream or fetch Response
- useAIChatHistory: saved conversations with optional localStorage
  persistence and generated titles, shown in AIChatSidebar
- useAIChatSpeech: read aloud via browser speech synthesis or a
  custom `speak` returning audio
- useAIChatDictation: voice input via browser recognition or a
  custom `transcribe`

Also adds a model picker, message editing, thumbs up/down, markdown
export, scoped markdown styles in base.css, the twuiReadTextStream,
twuiStripMarkdown and twuiGroupByRecency utils (with tests), and a
playground page. AIPromptBlock is kept and marked deprecated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-26 10:45:46 +01:00
co-authored by Claude Opus 5.5
parent 1f74447d1c
commit 1c607c4bcd
21 changed files with 3933 additions and 1 deletions
+5
View File
@@ -125,13 +125,18 @@ export { default as fileInputToBase64 } from "./utils/form/fileInputToBase64";
export * from "./utils/form/fileInputToBase64";
export { default as imageInputToBase64 } from "./utils/form/imageInputToBase64";
export * from "./utils/form/imageInputToBase64";
export { default as twuiGroupByRecency } from "./utils/group-by-recency";
export * from "./utils/group-by-recency";
export { default as lowerToTitleCase } from "./utils/lower-to-title-case";
export { default as twuiNormalizeText } from "./utils/normalize-text";
export { default as twuiNumberfy } from "./utils/numberfy";
export { default as twuiReadTextStream } from "./utils/read-text-stream";
export * from "./utils/read-text-stream";
export { default as TWUIRoundToNearestMagnitude } from "./utils/round-to-nearest-magnitude";
export { default as twuiSerializeQuery } from "./utils/serialize-query";
export { default as twuiSlugToNormalText } from "./utils/slug-to-normal-text";
export { default as twuiSlugify } from "./utils/slugify";
export { default as twuiStripMarkdown } from "./utils/strip-markdown";
// svgs
export { default as CheckMarkSVG } from "./svgs/CheckMarkSVG";