Chat History
保存済みのアシスタントとの会話。タイトルで絞り込み、開き、サイドバーでは日付ごとにグループ化。読み込み中・空・エラーの状態つき。
Angular: 対応 Vue: 対応 React: 対応 React Native: 未対応
使い方
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--space-5)">
<div style="display: flex; flex-direction: column; gap: var(--space-2); height: 24rem">
<sone-search-field [(value)]="query" size="sm" placeholder="Search chats" ariaLabel="Search chats" />
<sone-chat-history
variant="sidebar"
label="Chats"
[threads]="threads"
[now]="now"
[query]="query()"
[activeThreadId]="active()"
(selected)="active.set($event)"
/>
</div>
<div style="display: flex; flex-direction: column; height: 24rem">
<sone-chat-history
label="Recent conversations"
[threads]="threads"
[activeThreadId]="active()"
loadingThreadId="t3"
(selected)="active.set($event)"
/>
</div>
</div>インポート
import {
SoneChatHistoryComponent,
} from "@surface-one/angular/chat-history";API リファレンス
SoneChatHistoryComponentコンポーネント
`<sone-chat-history>` — the browser of saved assistant conversations: first load, load error (with Retry), empty, the list, refreshing (cached rows stay — stale while revalidate) and a non-blocking `notice`. Presentational: the owner loads the threads and reacts to `(selected)` / `(retryRequested)`. `query` filters the titles; `variant="sidebar"` groups compact rows by age (Today, Yesterday, …).
| 名前 | 型 | デフォルト |
|---|---|---|
threads | readonly SoneChatHistoryThread[] | [] |
loadingThe history is loading: a spinner well at first, a "Refreshing…" line over cached rows. | boolean | false |
errorWhy loading failed: a well with Retry, or an alert above cached rows. | string | null | null |
noticeA non-blocking message above the list (a row action that failed). | string | null | null |
activeThreadIdThe open conversation: `aria-current` and the active fill. | string | null | null |
loadingThreadIdThe conversation being opened: its row is disabled and busy, with a spinner. | string | null | null |
variant | SoneChatHistoryVariant | "list" |
queryFilters the rows by title (case-insensitive). | string | "" |
now"Today" for the `sidebar` groups; `null` = the current time. | Date | null | null |
labelThe region's accessible name. | — | $localize`Conversation history` |
emptyTitle | — | $localize`No conversations yet` |
emptyDescription | — | $localize`Conversations you start will appear here.` |
| 名前 | 型 |
|---|---|
selectedThe id of the conversation to open. | string |
retryRequestedRetry the failed load. | void |