PHPackages                             commune/compnt-rasa - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. commune/compnt-rasa

ActiveLibrary[API Development](/categories/api)

commune/compnt-rasa
===================

component using rasa as nlu for commune/chatbot

v0.1.0(6y ago)0421MITPHPPHP &gt;=7.2

Since Dec 28Pushed 6y ago1 watchersCompare

[ Source](https://github.com/thirdgerb/compnt-rasa)[ Packagist](https://packagist.org/packages/commune/compnt-rasa)[ RSS](/packages/commune-compnt-rasa/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (1)

本项目是[commune/chatbot](https://github.com/thirdgerb/chatbot) 和 [commune/studio-hyperf](https://github.com/thirdgerb/studio-hyperf)的组件, 可将 [Rasa](https://rasa.io) 提供的 NLU 中间件引入项目.

```
composer require commune/compnt-rasa

```

注册 RasaComponent
----------------

[](#注册-rasacomponent)

CommuneChatbot 对 Rasa 服务做了基本的封装, 需要通过 `Commune\Components\Rasa\RasaComponent` 引入系统, 具体而言有三步:

1. 配置数组引入 `Commune\Components\Rasa\RasaComponent`
2. `NLUComponent::$nluSerivces` 处, 注册`Commune\Components\Rasa\Services\RasaService`
3. 在配置数组 `$chatbotConfig->host->sessionPipes` 中引入中间件`Commune\Components\Rasa\RasaSessionPipe`

```
// 机器人配置数组 ChatbotConfig

return [
    ...

    'components' => [
        ...

        Commune\Components\Rasa\RasaComponent::class => [
            // rasa http api 地址
            'server' => 'localhost:5005',

            // 如果通过 jwt 验证的话
            'jwt' => '',

            // 意图的置信度, 高于 0.7 才加入 highlyPossibleIntent
            'threshold' => 70,

            // 语料库同步的目标文件位置
            'output' => __DIR__ .'/resources/rasa.md',

            // rasa domain.md 的文件位置
            'domainOutput' => __DIR__ . '/resources/domain.yml',

            // 使用 Guzzle 调用 Rasa api 时的配置
            'clientConfig' => [
                'timeout' => 0.3,
            ],
        ],

        NLUComponent::class => [
            'nluServices' => [
                ...
                Commune\Components\Rasa\Services\RasaService::class,
            ]

        ],
    ],

    ...

    'host' => [
        ...

        'sessionPipes' => [
            ...
            Commune\Components\Rasa\RasaSessionPipe::class,
        ]
        ...
    ],

]
```

同步语料库
-----

[](#同步语料库)

Rasa 所需要的语料库, 格式在 [Rasa training data format](https://rasa.com/zh-cn/rasa/nlu/training-data-format/) 可以查看. CommuneChatbot 的本地语料库设计参考了 Rasa 定义的格式.

使用 `Commune\Components\Rasa\Services\RasaService` 可以直接将本地语料库同步到 rasa 的配置文件中.

具体内容请查看 [开发手册](https://github.com/thirdgerb/chatbot-book).

```
CommuneChatbot 开发了一批用多轮对话管理机器人自己的工具.

请选择您要使用的开发工具:  (1)

[1] nlu 语料库管理

> 1

选择功能 (1)

[1] 查看NLU命中的意图
[2] 同步语料库到NLU
[3] 同步语料库到本地存储
[4] 管理意图的语料样本

> 2

Commune\Components\Rasa\Services\RasaService : success

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

2332d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/07cd152acb87d750d5de1037350526f02d61d95417702d6f5105279df209ca36?d=identicon)[thirdgerb](/maintainers/thirdgerb)

---

Top Contributors

[![thirdgerb](https://avatars.githubusercontent.com/u/12014319?v=4)](https://github.com/thirdgerb "thirdgerb (4 commits)")

### Embed Badge

![Health badge](/badges/commune-compnt-rasa/health.svg)

```
[![Health](https://phpackages.com/badges/commune-compnt-rasa/health.svg)](https://phpackages.com/packages/commune-compnt-rasa)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
