> For the complete documentation index, see [llms.txt](https://docs.convai.com/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/embodiment/conversation-flow/configure.md).

# 配置对话流程

将 Conversation Flow 模块添加到角色，或让 Convai 自动创建它，然后分配一个配置文件来调整其时序。

添加 `ConvaiConversationFlowController` 手动添加到角色上，或让 Convai 自动添加，然后分配一个 `ConvaiConversationFlowProfile` 以更改它在对话状态之间移动的速度。如果你想直接控制模块的时序，而不是依赖其内置默认值，就使用此页面。

***

### 前提条件

* 一个 `ConvaiCharacter` 在你的场景中。
* 可选但推荐：先添加一个可读取对话状态——凝视、身体动画、肢体语言或情绪——的具身化模块，这样调整 Conversation Flow 才会有可见效果。单独的 Conversation Flow 不会改变角色外观；它只跟踪状态，供其他模块读取。

{% hint style="info" %}
你很少需要在这一步用到此页面。如果你的角色已经带有 Body Animation，并且 `自动创建 Conversation Flow` 已启用（默认设置），Convai 会在首次需要时为你添加控制器。直接跳到 [分配配置文件](#assign-a-profile) 如果你的情况是这样。
{% endhint %}

***

### 添加控制器

{% stepper %}
{% step %}

#### 选择角色

在层级中，选择 `游戏对象` 所携带的 `ConvaiCharacter` 组件上。
{% endstep %}

{% step %}

#### 添加 Conversation Flow 组件

在检查器中，选择 **添加组件**，然后 **Convai > 具身化 > Conversation Flow**。这会添加 `ConvaiConversationFlowController`.

Convai 还会自动添加该模块所需的共享基础设施——一个 `EmbodimentContext` ——你无需手动添加。
{% endstep %}

{% step %}

#### 保留配置文件未分配，以开始

在未分配配置文件的情况下，组件的 **Profile** 部分会显示一个 **使用 SDK 默认值** 提示，控制器将按内置的时间值运行，这些值可以正常工作。只有在你想更改节奏时才分配配置文件。
{% endstep %}
{% endstepper %}

***

### 分配配置文件

{% stepper %}
{% step %}

#### 创建配置文件资源

选择 **资源 > 创建 > Convai > 具身化 > Conversation Flow 配置文件**。这会创建一个 `ConvaiConversationFlowProfile` 资源。
{% endstep %}

{% step %}

#### 将其分配给控制器

选中角色，并将配置文件资源拖到组件的 **流程配置** 字段中 **Profile** 部分。
{% endstep %}

{% step %}

#### 调整时间字段

打开配置文件资源，并调整其下的字段 **过渡**, **对话节拍**以及 **能量** ——例如，降低 **思考最长保持时间** 以让角色更快回复，或提高 **返回空闲延迟** 以让角色在回合之间保持更久的关注。参见 [Conversation flow 参考](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/embodiment/conversation-flow/reference.md) 了解每个字段、其范围以及默认值。
{% endstep %}
{% endstepper %}

一个配置文件资源可以被多个角色共享。编辑它会更改所有分配给它的角色的时间设置。

***

### 验证设置

进入 Play 模式，选择角色，并展开 **实时** 部分，在 `ConvaiConversationFlowController` 组件上（或打开 **Convai > 具身编辑器**，选择 **实时** 选项卡）。开始一次对话，并确认 **状态** 会随着对话进行而在 `倾听中`, `思考中`以及 `说话中` 之间切换，而不是停留在 `空闲`.

{% hint style="success" %}
**预期结果：** **状态** 会从 `空闲` 在你开始说话后不久，以及 **在状态中的时间** 重置为 `0.0 秒` 每次它发生变化时。
{% endhint %}

***

### 故障排查

如果 **状态** 从不离开 `空闲`，或者角色在某个状态中停留的时间长于配置文件值所暗示的时长，请参见 [排查 conversation flow 问题](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/embodiment/conversation-flow/troubleshooting.md).

***

### 下一步

{% content-ref url="/pages/9e0bce5334a303fb17ac4d76c2afd5652c1d4ca4" %}
[对话流程参考](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/embodiment/conversation-flow/reference.md)
{% endcontent-ref %}

{% content-ref url="/pages/8922153d9c96476ab1f2a88254d25a41d45588ff" %}
[排查对话流程问题](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/embodiment/conversation-flow/troubleshooting.md)
{% endcontent-ref %}

{% content-ref url="/pages/260c8f480c6e05ba6ea9db729322298e970606cc" %}
[具身化预设](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/embodiment/embodiment-presets.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/embodiment/conversation-flow/configure.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
