<commit_before>var _ = require('lodash');
var express = require('express');
var app = express();

var bodyParser = require('body-parser');
app.use(bodyParser());
app.set('port', (process.env.PORT || 5000));

// 生きてるか確認するためのHello World
app.get('/', function(req, res) {
  res.send('Hello World!');
});

// LineからのコールバックURL
app.post('/callback', function(req, res) {

    var results = req.body.result;
    _.each(results, function(msg){

        var request = require('superagent');
        require('superagent-proxy')(request);

        request
            .post('https://chatbot-api.userlocal.jp/api/chat')
            .send({
                key: process.env.USER_LOCAL_API_KEY,
                message: encodeURI(msg.content),
                bot_name: "めぐみん",
                platform: "line",
                user_id: msg.content.from.toString()
            })
            .end(function(err, res){
                if (err || !res.ok) {
                    console.error(err);
                } else {
                    console.log(res)

                    request
                        .post('https://trialbot-api.line.me/v1/events')
                        .proxy(process.env.FIXIE_URL) // IPの固定化
                        .send({
                            to: [msg.content.from.toString()],
                            toChannel: 1383378250,
                            eventType: "138311608800106203",
                            content: {
                                contentType:　1,
                                toType:　1,
                                text:　res.body.result
                            }
                        })
                        .set('Content-Type', 'application/json; charset=UTF-8')
                        .set('X-Line-ChannelID', process.env.CHANNEL_ID)
                        .set('X-Line-ChannelSecret', process.env.SECRET)
                        .set('X-Line-Trusted-User-With-ACL', process.env.MID)
                        .end(function(err, res){
                            if (err || !res.ok) {
                                console.error(err);
                            } else {
                                console.log(res)
                            }
                        });

                }
            });<commit_msg>userlocalだけログをとる<commit_after>var _ = require('lodash');
var express = require('express');
var app = express();

var bodyParser = require('body-parser');
app.use(bodyParser());
app.set('port', (process.env.PORT || 5000));

// 生きてるか確認するためのHello World
app.get('/', function(req, res) {
  res.send('Hello World!');
});

// LineからのコールバックURL
app.post('/callback', function(req, res) {

    var results = req.body.result;
    _.each(results, function(msg){

        var request = require('superagent');
        require('superagent-proxy')(request);

        request
            .post('https://chatbot-api.userlocal.jp/api/chat')
            .send({
                key: process.env.USER_LOCAL_API_KEY,
                message: encodeURI(msg.content),
                bot_name: "めぐみん",
                platform: "line",
                user_id: msg.content.from.toString()
            })
            .end(function(err, res){
                if (err || !res.ok) {
                    console.error(err);
                } else {
                    console.log(res)

                    request
                        .post('https://trialbot-api.line.me/v1/events')
                        .proxy(process.env.FIXIE_URL) // IPの固定化
                        .send({
                            to: [msg.content.from.toString()],
                            toChannel: 1383378250,
                            eventType: "138311608800106203",
                            content: {
                                contentType:　1,
                                toType:　1,
                                text:　res.body.result
                            }
                        })
                        .set('Content-Type', 'application/json; charset=UTF-8')
                        .set('X-Line-ChannelID', process.env.CHANNEL_ID)
                        .set('X-Line-ChannelSecret', process.env.SECRET)
                        .set('X-Line-Trusted-User-With-ACL', process.env.MID)
                        .end(function(err, res){
                            if (err || !res.ok) {
                                console.error(err);
                            } else {
                                // Nothing
                            }
                        });

                }
            });
{'fraction_non_alphanumeric': 0.12676668841052402, 'fraction_numerical': 0.015655577299412915, 'mean_word_length': 1.058165548098434, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1123354', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1196, 'n_words': 182}