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

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

<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> 我会逐字说出这句话！ \</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.
