useStreamingText
@astryxdesign/core v0.7.1 · useStreamingText
参数
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
targetText | MaybeRefOrGetter<string> | — | 要显示出来的完整文字。有新分片到达时,把累积后的文字更新到这里。 |
isStreaming | MaybeRefOrGetter<boolean> | false | 现在是不是还在流式输出。为 false 时直接返回完整的 targetText。 |
options | MaybeRefOrGetter<UseStreamingTextOptions> | — | 显示节奏的配置,可以不传。 |
options.speed | 'natural' | 'fast' | 'instant' | 'natural' | 显示节奏的档位。natural 每个动效节拍往前推一小段;fast 的节拍快一倍,落后的量追得更快;instant 不带动画,直接给全文。 |
返回值
| 名称 | 类型 | 说明 |
|---|---|---|
displayedText | ComputedRef<string> | 该渲染出来的那一段。流式过程中会稳稳地往完整的 targetText 长;不在流式时就是 targetText 本身。 |