> 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).

### 编辑提示字段

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

| Inspector 字段中设置 Character ID | 默认值           | 显示于                          |
| ---------------------------- | ------------- | ---------------------------- |
| 无角色提示                        | `没有可对话的角色`    | `NoCharacter`                |
| 离线提示                         | `未连接`         | `Offline`                    |
| 连接中提示                        | `正在连接……`      | `Connecting`，且尚未指向任何角色       |
| 连接到角色提示                      | `正在连接到 {0}……` | `Connecting`，且已经指向某个角色       |
| 连接缓慢提示                       | `仍在连接到 {0}……` | `Connecting` 持续时间超过了慢速连接提示秒数 |
| 准备中提示                        | `{0} 正在准备……`  | `Preparing`                  |
| 就绪提示                         | `消息 {0}`      | `就绪`                         |
| 应答提示                         | `{0} 正在说话……`  | `Answering`                  |
| 不可用提示                        | `{0} 不可用`     | `Unavailable`                |

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

### 调整慢速连接提示

**慢速连接提示秒数** 控制字段在……中等待多长时间 `Connecting` 然后切换到慢速连接提示——默认是 35 秒。多角色连接的测量时间为 26–34 秒，因此默认值刚好略高于此：在正常等待期间触发的提示会让玩家学会不信任它，而在成功前几秒才触发的提示则纯属噪音。将该字段设置为 `0` 即可永不显示慢速连接提示。

### 完全关闭门控

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

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

**通知文本** 是一个可选的 `TMP_Text` 引用。分配后，它会显示发送失败返回的拒绝原因，然后在……之后自行清空 **拒绝通知秒数** （默认 4 秒）。如果不分配 Notice Text，则拒绝只会发送到 Console。将 Refusal Notice Seconds 设为 `0` 即可在即使已分配 Notice Text 的情况下仍将拒绝保留在 Console 中。

### 验证更改

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

### 下一步

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