> 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/convai-playground/character-customization/narrative-design.md).

# 叙事设计

通过章节、决策和触发器构建以目标为导向的对话流程，在不使用僵化对话树的情况下推动故事发展。

## 简介

叙事设计让你能够通过高层级目标引导角色，同时保持对话灵活。你无需硬编码对话树，而是定义目标和决策点，再让角色动态回应。这种方法适用于许多领域，例如游戏、学习与培训模拟、旅游、零售助手以及客户支持服务亭。你可以在此处进一步了解叙事设计背后的考量： [此处。](https://convai.com/blog/convai-narrative-design)

<figure><img src="https://2402152281-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FG33UnzJMZjwWw3eyEah7%2Fimage.png?alt=media&amp;token=efa57c25-f9ac-47bc-bc7a-54cf1da70c5d" alt=""><figcaption></figcaption></figure>

***

## 视频

观看这组视频，了解如何在 Convai Playground 中创建叙事设计图。\
演示以导游场景为例，逐步展示如何设计、连接并实现自己的叙事设计流程。

{% embed url="<https://www.youtube.com/playlist?list=PLD3AIwsrrHJ0>" %}

***

## 访问叙事设计

在 Convai Playground 中打开你的角色，然后从左侧边栏选择“**叙事设计**”。你将看到一个图编辑器，可通过节点连接流程。

***

## 叙事图

叙事图由四个构建模块组成：

## 章节

一个章节包含：

* **目标** – 角色在叙事的这一部分试图达成的目标。\
  \&#xNAN;*示例：* 虚拟导游的目标可以是欢迎用户，并询问是否要开始游览。
* **决策** – 根据用户交互做出的选择，可将角色引导至不同章节。\
  \&#xNAN;*示例：* 如果用户表示“是”，愿意参加游览，下一章节可能会开始游览路线；如果表示“否”，角色则可以提供其他信息。

{% hint style="warning" %}
确保决策清晰明确；否则，可能无法触发预期的章节。
{% endhint %}

每个章节都有一个 **唯一 ID**.

<figure><img src="https://2402152281-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2Fxdr7NdK2gFoNeaeuQSYz%2Fimage.png?alt=media&amp;token=a862667f-65d4-4712-b540-33882324867d" alt=""><figcaption></figcaption></figure>

***

## 触发器

触发器是应用发出的简单信号，用于指示某个条件已满足。触发器触发后，图会推进到下一个已连接的章节。

每个触发器都有一个 **唯一 ID**.

**示例**

* **基于位置（空间）：** 应用检测到用户进入某个区域后，触发与该章节关联的触发器。
* **基于时间：** 应用中的计时器到期后触发该触发器。
* **基于事件：** 应用内发生某个事件，例如“安全演示已完成”，此时由你触发该触发器。

<figure><img src="https://2402152281-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FsZhlHBZdkCXSk87ozZgb%2Fimage.png?alt=media&amp;token=bf23ed47-cd6c-4b75-b6ab-8767cb5da904" alt=""><figcaption></figcaption></figure>

***

## 示例场景

为了更好地了解叙事设计在实践中的运作方式，下面介绍两个可在 Convai Playground 中直接体验的示例角色。\
打开每个链接，前往 **叙事设计** 选项卡，并查看由章节和触发器构成的图结构。

### 工厂导览员 – [查看角色](https://convai.com/pipeline/dashboard/character?id=8cd9fa0c-384b-11ef-a852-42010a7be00e)

这是一个设定在制造工厂中的培训模拟场景。\
该角色使用基于位置的触发器（例如进入传送带区域或装配线区域），引导用户参观工作场所、讲解安全规程并推进导览。\
适用于 **工业培训** 和 **入职培训模拟**.

<figure><img src="https://2402152281-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FG33UnzJMZjwWw3eyEah7%2Fimage.png?alt=media&amp;token=efa57c25-f9ac-47bc-bc7a-54cf1da70c5d" alt=""><figcaption></figcaption></figure>

### 房地产住宅导览员 – [查看角色](https://convai.com/pipeline/dashboard/character?id=4d31ce84-8c6a-11ef-bc7a-42010a7be011)

这是一个房地产模拟场景，角色将引导潜在买家参观房产中的不同房间。\
与工厂示例类似，它使用 **基于位置的触发器** ——例如，用户进入特定房间（如厨房、浴室或卧室）时，叙事图中相应的章节便会触发。\
这样，角色就能根据用户在房产中的移动动态调整对话。\
适用于 **虚拟房产导览**, **销售演示文稿**，以及 **客户 onboarding**.

<figure><img src="https://2402152281-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FH0VcZJAW28XYuiL9cikA%2Fimage.png?alt=media&amp;token=6bccaddd-c70f-460a-b494-361870bbfc6f" alt=""><figcaption></figcaption></figure>

***

## 语法说明

这些特殊字符可以添加到叙事设计图中的节点，以控制特定结果和行为。

| 特殊字符     | 示例                                           | 用途                                |
| -------- | -------------------------------------------- | --------------------------------- |
| \<speak> | \<speak> I'll say this exact line! \</speak> | 强制角色严格按照标签内的短语作答，不进行改述，也不添加额外上下文。 |
| \*       |                                              | 强制立即转到下一个节点，跳过后续的决策检查。            |


---

# 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/convai-playground/character-customization/narrative-design.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.
