Chat

完整的聊天结构:面板、会话、消息、输入框、提交、建议和正在输入指示器。附件以可移除的小卡片显示在输入框上方。

可用框架
  • Angular: 可用
  • Vue: 可用
  • React: 可用
  • React Native: 暂不可用

用法

Ask about this meeting

Answers use the planning meeting transcript
What did Ada and Leo decide about the onboarding checklist?
They agreed to cut the checklist from twelve steps to five and to ship the shorter version behind a feature flag first. Leo owns the rollout.
Planning meetingmeetings.example.com/planning

导入

ts
import {
  SoneChatAttachmentComponent,
  SoneChatComposerComponent,
  SoneChatComposerInputDirective,
  SoneChatComposerSubmitComponent,
  SoneChatComposerToolsDirective,
  SoneChatMessageComponent,
  SoneChatMessageContentDirective,
  SoneChatPaneActionsDirective,
  SoneChatPaneDescriptionDirective,
  SoneChatPaneDirective,
  SoneChatPaneHeaderDirective,
  SoneChatPaneHeadingDirective,
  SoneChatPaneTitleDirective,
  SoneChatThreadComponent,
  SoneSuggestionChipsComponent,
  SoneTypingIndicatorComponent,
} from "@surface-one/angular/chat";

API 参考

SoneChatAttachmentComponent组件

`<sone-chat-attachment>` — a linked or uploaded item in the composer: a grey card with a mark (the projected content: a favicon, a file icon, a `<sone-mark>`), the `title` and its `url` (or a size), and — when `removable` — a small round remove button (“Remove {title}”) that emits `remove`. Put it inside `<sone-chat-composer>`, which lines attachments up above the field.

选择器
sone-chat-attachment
输入
名称类型 默认值
title

What it is: a page title, a file name.

string""
url

Where it is (or its size), under the title.

string | nullnull
removable

Shows the remove button.

booleanfalse
输出
名称类型
remove

The remove button was pressed.

void

SoneChatComposerComponent组件

选择器
sone-chat-composer
输入
名称类型 默认值
layoutChatComposerLayout"inline"
输出
名称类型
submittedvoid

SoneChatComposerInputDirective指令

选择器
textarea[soneChatComposerInput]
输出
名称类型
draftInputstring

SoneChatComposerSubmitComponent组件

选择器
sone-chat-composer-submit
输入
名称类型 默认值
pendingbooleanfalse
disabledbooleanfalse

SoneChatComposerToolsDirective指令

选择器
[soneChatComposerTools]

SoneChatMessageComponent组件

选择器
sone-chat-message
输入
名称类型 默认值
from必填ChatMessageFrom—
variantBubbleVariant | nullnull

SoneChatMessageContentDirective指令

选择器
[soneChatMessageContent]
输入
名称类型 默认值
labelstring | undefinedundefined

SoneChatPaneActionsDirective指令

选择器
[soneChatPaneActions]

SoneChatPaneDescriptionDirective指令

选择器
[soneChatPaneDescription]

SoneChatPaneDirective指令

选择器
[soneChatPane]
输入
名称类型 默认值
barebooleanfalse

SoneChatPaneHeaderDirective指令

选择器
[soneChatPaneHeader]

SoneChatPaneHeadingDirective指令

选择器
[soneChatPaneHeading]

SoneChatPaneTitleDirective指令

选择器
[soneChatPaneTitle]

SoneChatThreadComponent组件

选择器
sone-chat-thread
输入
名称类型 默认值
label—$localize`Conversation`

SoneSuggestionChipsComponent组件

选择器
sone-suggestion-chips
输入
名称类型 默认值
suggestionsreadonly string[][]
disabledbooleanfalse
label—$localize`Suggested questions`
输出
名称类型
pickedstring

SoneTypingIndicatorComponent组件

选择器
sone-typing-indicator
输入
名称类型 默认值
label—$localize`Thinking`