> 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/features/conversation-availability/customise-chat-prompts.md).

# 自定义聊天输入框提示

更改随附聊天输入框在每种对话可用状态下显示的所有提示字符串，包括角色名称。

随包提供的聊天字段， `ChatTranscriptUI`会为每种对话可用状态显示不同的占位文本，并在被指向的角色真正能听到玩家之前会自行禁用。所有这些字符串都是组件上的序列化字段，因此项目可以在 Inspector 中重新措辞，而无需触碰代码。

### 前置条件

* 随包提供的聊天预制体，带有 `ChatTranscriptUI` ，在场景中。参见 [添加聊天 UI](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/getting-started/add-chat-ui.md).

### 编辑提示字段

选中 `GameObject` 携带 `ChatTranscriptUI` 并打开 **输入可用性** 部分的 Inspector。每个字段对应一种可用状态：

| Inspector 字段 | 默认值          | 显示于                     |
| ------------ | ------------ | ----------------------- |
| 无角色提示        | `没有可交谈的角色`   | `无角色`                   |
| 离线提示         | `未连接`        | `离线`                    |
| 连接中提示        | `连接中…`       | `连接中`，且尚未指向任何角色         |
| 连接到角色提示      | `正在连接到 {0}…` | `连接中`，且已经有一个角色被指向       |
| 慢速连接提示       | `仍在连接到 {0}…` | `连接中` 已持续时间超过“慢速连接提示秒数” |
| 准备提示         | `{0} 正在准备…`  | `准备中`                   |
| 就绪提示         | `消息 {0}`     | `Ready`                 |
| 回答提示         | `{0} 正在说话…`  | `Answering`             |
| 不可用提示        | `{0} 不可用`    | `Unavailable`           |

`{0}` 会被替换为被指向角色的显示名称。带有 `{0}` 被移除后会以纯文本显示，而不是抛出异常。

### 调整慢速连接提示

**慢速连接提示秒数** 控制该字段在 `连接中` 切换到慢速连接提示之前会等待多久——默认 35 秒。多角色连接的耗时测得为 26–34 秒，因此默认值就设在其上方：在正常等待期间触发的提示会让玩家学会不信任它，而在成功前几秒才触发的提示则纯属噪音。将该字段设为 `0` 即可永不显示慢速连接提示。

### 完全关闭此门控

**按可用性门控输入** 默认启用，并会在被指向的角色能够接收消息之前禁用该字段。将其关闭只影响呈现—— `ConvaiPlayer.TrySendTextMessage` 无论如何，仍然会拒绝过早发送的消息，因此玩家会通过被拒绝而不是通过字段关闭来得知。只有当你的 UI 已经以其他方式显示该状态时，才关闭它。

### 显示消息被拒绝的原因

**提示文本** 是一个可选的 `TMP_Text` 引用。分配后，它会显示发送失败返回的拒绝原因，然后在 **拒绝提示秒数** （默认 4 秒）。如果不为“提示文本”分配值，则只会将拒绝发送到 Console。将“拒绝提示秒数”设为 `0` 即可即使分配了“提示文本”也将拒绝保留在 Console 中。

### 验证更改

进入播放模式并逐个检查这些状态——断开连接、连接中，以及在角色确认前的已连接——确认每种状态都显示你设置的提示。在字段打开之前输入一条消息，并确认拒绝提示（如果已分配）显示的是你预期的措辞。

### 下一步

{% content-ref url="/pages/66ee7fe1bbd8fe5aba610cee8f0dfd2573443acf" %}
[根据可用性控制 UI](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-availability/gate-your-ui.md)
{% endcontent-ref %}

{% content-ref url="/pages/02dc08633f6e63036db73a9046518a4e7acce30b" %}
[玩家输入故障排查](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-availability/troubleshooting.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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/conversation-availability/customise-chat-prompts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
