集成各种API

    使用动态模型可以实现快速编程,它可以把各种API集成在一起,然后通过配置快速开发复杂的程序。

组合API代码示例

    下面的代码是一个微信公众号的WEB程序,它把收到的消息提交给聊天程序Alice,并返回Alice的回复。

<?xml version="1.0" encoding="utf-8"?>

<SimpleControl name="WeiXinServer" descriptors="xworker.http.controls.SimpleControl">
    <description><![CDATA[<p>微信公共号服务器示例,使用Chatterbean的Alice回复消息。</p>

<p>需要配置到微信服务器才能生效。</p>]]></description>
    <actions>
        <WeixinServer name="doAction" descriptors="xworker.app.weixin.WeixinServer" token="test123"
             debugLog="true">
            <actions>
                <TextMessageHandler name="messageReceived" descriptors="xworker.app.weixin.MessageActions/@TextMessageHandler">
                    <actions>
                        <Alice name="handleText" descriptors="xworker.ai.chatterbean.Alice"
                             rootPath="${xworkerRootPath}/projects/xworker_ai/chatterbean/"
                             aimlConfig="" httpContentType=""></Alice>
                    </actions>
                </TextMessageHandler>
            </actions>
        </WeixinServer>
    </actions>
</SimpleControl>

构建高级的模型示例

    可以用基本模型构建高级的模型,从而在使用时可以通过简单的配置实现复杂的功能。

    下面的GIF视频演示了一个WEB的登陆页面。