情绪
启用情绪检测,以在对话中接收角色的情绪状态。启用情绪检测,以在每次回复时一并接收角色的情绪状态。
连接时启用
const client = useConvaiClient({
apiKey: '...',
characterId: '...',
enableEmotion: true,
});订阅 emotionChange
emotionChangeclient.on('emotionChange', (emotion) => {
if (emotion === null) {
// 对话重置 — 清除任何情绪 UI
return;
}
console.log(emotion.emotion); // 例如:“Trust”、“Grief”、“Joy”
console.log(emotion.scale); // 整数强度:1(低)→ 3(高)
});React
通过 state.emotion
state.emotion原生 JS
微调检测
"llm" 配置
"llm" 配置字段
类型
说明
"nrclex" 配置
"nrclex" 配置字段
类型
默认值
说明
API 参考
enableEmotion (连接选项)
enableEmotion (连接选项)字段
类型
默认值
说明
emotionChange 事件
emotionChange 事件字段
类型
说明
state.emotion
state.emotion最后更新于
这有帮助吗?