# Tiện ích mở rộng kiểm duyệt

Module này được sử dụng để xem xét nội dung được nhập bởi người dùng cuối và đầu ra từ các mô hình ngôn ngữ lớn (LLMs) trong ứng dụng, chia thành hai loại điểm mở rộng.

Vui lòng đọc [Phần Mở rộng Dựa trên API](https://developer.chatx.vn/document-chatx/tinh-nang/extension-tien-ich/mo-rong-dua-tren-api) để hoàn thành việc phát triển và tích hợp các khả năng dịch vụ API cơ bản.

## Extension Point <a href="#extension-point" id="extension-point"></a>

`app.moderation.input`: Điểm mở rộng xem xét nội dung đầu vào của người dùng cuối. Nó được sử dụng để xem xét nội dung của các biến được truyền vào bởi người dùng cuối và nội dung đầu vào của cuộc trò chuyện trong các ứng dụng hội thoại.

`app.moderation.output`: Điểm mở rộng xem xét nội dung đầu ra từ LLMs. Nó được sử dụng để xem xét nội dung được đầu ra bởi LLM. Khi đầu ra của LLM đang phát ra, nội dung sẽ được yêu cầu bằng cách gửi API theo từng phần có 100 ký tự để tránh trễ trong quá trình xem xét khi nội dung đầu ra dài.

### `app.moderation.input` <a href="#app.moderation.input" id="app.moderation.input"></a>

#### **Request Body**

```
{
    "point": "app.moderation.input", 
        "app_id": string,  
        "inputs": {  
            "var_1": "value_1",
            "var_2": "value_2",
            ...
        },
        "query": string | null  
    }
}
```

* Ví dụ

```
{
    "point": "app.moderation.input",
    "params": {
        "app_id": "61248ab4-1125-45be-ae32-0ce91334d021",
        "inputs": {
            "var_1": "I will kill you.",
            "var_2": "I will fuck you."
        },
        "query": "Happy everydays."
    }
}
```

#### Phản hồi API

```
{
    "flagged": bool,  
    "action": string, 
    "preset_response": string,  
    "inputs": {  
        "var_1": "value_1",
        "var_2": "value_2",
        ...
    },
    "query": string | null  
}
```

* Ví dụ

`action=direct_output`

```
{
    "flagged": true,
    "action": "direct_output",
    "preset_response": "Your content violates our usage policy."
}
```

`action=overrided`

```
{
    "flagged": true,
    "action": "overrided",
    "inputs": {
        "var_1": "I will *** you.",
        "var_2": "I will *** you."
    },
    "query": "Happy everydays."
}
```

### `app.moderation.output` <a href="#app.moderation.output" id="app.moderation.output"></a>

#### **Request Body**

```
{
    "point": "app.moderation.output", 
    "params": {
        "app_id": string,  
        "text": string  
    }
}
```

* Ví dụ

```
{
    "point": "app.moderation.output",
    "params": {
        "app_id": "61248ab4-1125-45be-ae32-0ce91334d021",
        "text": "I will kill you."
    }
}
```

#### Phản hồi API

```
{
    "flagged": bool,  
    "action": string, 
    "preset_response": string,  
    "text": string  
```

* Ví dụ

`action=direct_output`

```
{
    "flagged": true,
    "action": "direct_output",
    "preset_response": "Your content violates our usage policy."
}
```

`action=overrided`

```
{
    "flagged": true,
    "action": "overrided",
    "text": "I will *** you."
}
```


---

# 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://developer.chatx.vn/document-chatx/tinh-nang/extension-tien-ich/mo-rong-dua-tren-api/tien-ich-mo-rong-kiem-duyet.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.
