specify text generation in py process
This commit is contained in:
parent
5075827551
commit
8c6ad6d5a3
1 changed files with 4 additions and 4 deletions
8
index.js
8
index.js
|
@ -21,21 +21,21 @@ client.on("room.message", (roomId, event) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (lineCount(config.file) < config.size) return; // ? don't start generating messages until a big enough dataset is present
|
if (lineCount(config.file) < config.size) return; // ? don't start generating messages until a big enough dataset is present
|
||||||
|
|
||||||
// TODO: train AI every Nth message?
|
|
||||||
// ? send message every N messages using the training data
|
// ? send message every N messages using the training data
|
||||||
if (!(messageCounter % config.frequency)) {
|
if (!(messageCounter % config.frequency)) {
|
||||||
console.log("Generating message...");
|
console.log("Generating message...");
|
||||||
|
|
||||||
const python = spawn('python', ["textgen.py"]);
|
const python = spawn('python', ["textgen.py", "generate"]);
|
||||||
|
|
||||||
python.stdout.on('data', function (message) {
|
python.stdout.on('data', function (message) {
|
||||||
message = message.toString();
|
message = message.toString();
|
||||||
console.log("bot:\t" + message);
|
|
||||||
client.sendText(roomId, message);
|
client.sendText(roomId, message);
|
||||||
});
|
});
|
||||||
python.on('close'); // ? close python process when finished
|
python.on('close'); // ? close python process when finished
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: train AI every Nth message?
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function lineCount(text) {
|
function lineCount(text) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue