> For the complete documentation index, see [llms.txt](https://bothub.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bothub.gitbook.io/project/basic-knowledge/ai/shi-bie-you-xian-ji.md).

# 识别优先级

## 关键词匹配、意图识别优先级

在对话管理中，我们可以在关键词匹配栏选择精确匹配、模糊匹配或包含匹配，并在意图栏选择想要开启的意图。假设在默认语境中，对话A设置了精确匹配关键词“Hi”，对话B设置了模糊匹配关键词“Hi”，对话C中开启了意图“G\_greeting”，那么当用户输入”Hi“时，会匹配到哪个对话呢？

![](/files/-LUUaizbmOoaceohnYPk)

在同一语境中，对话识别的优先级为：

&#x20;                               **精确匹配>意图识别>包含匹配>模糊匹配**

系统会首先进行精确匹配，如果无匹配，再进行意图识别，其次是包含匹配，最后是模糊匹配。因此，如上案例，用户输入”Hi“会被对话A优先识别到，用户会收到对话A所设置的回复内容。

## 语境优先级

那么，假如全局对话下的对话A设置了精确匹配关键词“Hi”，默认语境下的对话B也同样精确匹配关键词“Hi”，当用户输入“Hi”时，会匹配到哪个对话呢？

![](/files/-LUUs9vP3inLk4LfcnT0)

对话管理中语境的优先级顺序如下：

1、**全局对话**：最高优先级。不论用户对话在哪个语境中，系统都会自动先用全局对话下配置的对话进行识别。此语境适合配置负面情绪、活动关键词等优先级最高的对话。

2、**默认语境**：用户在进入对话之后，默认初始进行的对话在默认语境下，如果发生语境跳转，对话将跳出默认语境，进入其他的语境。常用对话都可在默认语境下配置。

3、**其他语境**：只有两种情况下用户对话会进入其他自定义的语境：                                   &#x20;

1. 勾选“设置为入口对话”，勾选之后优先级相当于默认语境。 &#x20;

![对话管理页面](/files/-LUZg23O81MXueEMSg9B)

&#x20;   2\. 成为后续语境，用户的下一句对话将在此语境下进行识别。

![对话管理页面](/files/-LUZgtAVN_H3h7Lce-II)

注意，用户的一个对话只可能根据优先级被一个语境下的一个对话匹配到，不存在同时匹配到多个语境下的不同对话。故上述案例，用户输入”Hi“会被对话A优先识别到，会收到对话A所设置的回复内容。


---

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

```
GET https://bothub.gitbook.io/project/basic-knowledge/ai/shi-bie-you-xian-ji.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.
