# AI稳定输出正则

完成正则创建后，保证AI稳定输出目标格式，正则功能才能稳定生效

#### AI输出结构

需要确保AI输出结构能稳定输出，我们推荐采用[**官方支持模版**](/documentation/zheng-ze-xiang-qing/chuang-jian-zheng-ze-tiao-mu/shi-yong-dai-ma-zu-jian.md#guan-fang-zhi-chi-mo-ban)

AI 能够精准理解下述结构，从而实现更稳定、规范的格式化输出。

```xml
<正则标识符>
    <内容1>AI输出的内容块1</内容1>
    <内容2>AI输出的内容块2</内容2>
    <内容3>AI输出的内容块3</内容3>
</正则标识符>

<Regex>
    <Content1>AI输出的内容块1</Content1>
    <Content2>AI输出的内容块2</Content2>
    <Content3>AI输出的内容块3</Content3>
</Regex>
```

#### 开场设计样例

<figure><img src="https://cdn.mufy.ai/images/aa474642-51ed-4f67-b301-57ee40ef2900/public" alt=""><figcaption></figcaption></figure>

如果支持，我们推荐将AI输出结构填写入开场设计，AI后续输出会遵从开场设计。

#### 输出设定约束

为了提升 AI 输出的稳定性，需要在【高级设置】-【输出设定】中明确输出规范。

可以使用[AI一键生成指令](/documentation/guan-yu-zheng-ze/ai-yi-jian-sheng-cheng-zhi-ling.md)辅助编写

<figure><img src="https://cdn.mufy.ai/images/65cb3a9b-199b-4f62-6bcc-a3fa0dc21d00/public" alt=""><figcaption></figcaption></figure>

<figure><img src="https://cdn.mufy.ai/images/41760804-5325-47d1-4f59-a86bfe9a0700/public" alt=""><figcaption></figcaption></figure>

约束输出设定推荐采用两个维度，**“何时输出”**、**“内容要求”、“强制约束”**

例如：

如何约束AI输出状态栏？

**何时输出** 在每次对话结尾输出\<StatusBar>\</StatusBar>组件

**内容要求** 状态栏的输出要求如下：

```xml
<StatusBar>
<Affection>20%(好感度默认20,在对user表现出好感后适当上升)</Affection>
<CharState>当前Char的状态描写</CharState>
</StatusBar>
```

**强制约束** 状态栏的输出要求如下：

```
- 只输出上述XML结构，不要有任何开场白、解释或其他文字。
- 必须保持XML标签名称（StatusBar，Affection, CharState）完全一致，不要修改。
- 每个标签内只填写对应的内容，不要包含标签本身。
```


---

# Agent Instructions: 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:

```
GET https://docs.mufy.ai/documentation/zheng-ze-xiang-qing/ai-wen-ding-shu-chu-zheng-ze.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
