句子
句子是角色的一部分。它用于构建对话。
构建句子:
import { Sentence } from 'narraleaf-react';
const character = new Character("character 1");
const sentence = new Sentence([
"Hello, ",
Word.color("world", "#f00") // words can be colored,
], {
character,
});
或
const sentence = new Sentence("Hello, world");
或
const sentence = new Sentence([
"Hello, ", persis.get("playerName"), "!"
]);
公共方法
constructor
text: SentencePrompt
- 参见 SentencePromptconfig?: Partial<SentenceUserConfig>
- SentenceUserConfig
copy
Copy the sentence
const sentence = new Sentence("你好,世界");
const sentence2 = sentence.copy();
- Returns:
Sentence