更新时间:2023-08-28 GMT+08:00
分享

测试与验证

  1. 在未修改Demo的情况下,请在/src/api/config.js中配置。

    let chatConfig = {
        appKey:'xxxxx',
        appSecret:'xxxxx',
        channelId:'xxxxx',
        lang:'zh'
    }

    appKey和appSecret 对应apifabric接口的aksk,channelId是需要对接的渠道ID。之前需要完成渠道配置,确定渠道配置了机器人:

    渠道ID获取如下:

    点击“修改”,确认该渠道是否配置了智能机器人。

  2. 安装node.js,完成安装后到package.json的同级目录下,先执行npm install;完成后执行npm run build。

    执行完成后,会生成一个dist目录。注意该目录的路径。

  3. 下载nginx,windows版本的即可,下载完成后找到nginx的目录,在其目录中找到conf/nginx.conf,编辑修改。

    worker_processes  1;
     
    events {
        worker_connections  1024;
    }
     
    http {
        include       mime.types;
        default_type text/plain;
        charset UTF-8;
        sendfile        on;
     
        keepalive_timeout  65;
     
        server {
            listen       18082 ssl;
            server_name  localhost;
     
            ssl_certificate     D:/nginx/keys/server.crt;#证书路径
            ssl_certificate_key     D:/nginx/keys/server.key;#key路径
            ssl_session_cache   shared:SSL:60m; #s储存SSL会话的缓存类型和大小
            ssl_session_timeout 60m; #会话过期时间
     
            location / { 
                root    D:/servicecloudDevelop/servicecloud/aicc-tool/ServiceCloudChatDemo/dist; #构建工程的dist目录
                index  index.html index.htm;
            }
     
            location /apigovernance { 
                client_max_body_size 200m;
                proxy_pass   https://10.21.119.148:28090/apigovernance;  #配置https://aicc服务地址/apigovernance
            }
     
            location /apiaccess { 
                client_max_body_size 200m;
                proxy_pass   https://10.21.119.148:28090/apiaccess; #配置https://aicc服务地址/apigovernance
            }
        }
    }

    其中root的目录,修改成npm run build 生成的dist目录路径。

            location / { 
                root    D:/servicecloudDevelop/servicecloud/aicc-tool/ServiceCloudChatDemo/dist; #构建工程的dist目录
                index  index.html index.htm;
            }

    加上ssl证书路径。可以使用自签名生成的证书,生成方式可以自行搜索“自签名证书”。

    ssl_certificate     D:/nginx/keys/server.crt;#证书路径
            ssl_certificate_key     D:/nginx/keys/server.key;#key路径

分享:

    相关文档

    相关产品