- Checkout the components repo: https://github.com/microsoft/botframework-components
This is a transcript of a machine-generated story | |
that took place in fiction.quest. The lines starting | |
with > were my commands. The rest are the hallucinations | |
of a machine that was raised on our popular culture. | |
https://fiction.quest | |
> Rufus, let's take Max on a time travel adventure | |
Rufus grins widely at Zeb, his eyes lighting up with |
// install these libs, set OPENAI_API_KEY, and put your baseline prompt in prompt.txt. | |
require('dotenv').config() | |
const { Configuration, OpenAIApi } = require("openai"); | |
const wordwrapjs = require('wordwrapjs'); | |
const fs = require('fs'); | |
const prompt = require('prompt-sync')({sigint: true}); | |
const configuration = new Configuration({ | |
apiKey: process.env.OPENAI_API_KEY, |
[ | |
{ | |
"name": "benbrown/grammarHelperLG", | |
"version": "", | |
"source": "npm", | |
"language" :"js", | |
"repository": "https://github.com/benbrown/grammarHelperLG", | |
"authors": ["Ben Brown <benbrown@gmail.com>"], | |
"category": "Community Packages", | |
"description": "A collection of LG rules to help form proper sentences out of dynamic data" |
Bot Framework uses a concept called "adapters" to create an interface between external messaging platforms and the bot logic. Adapters are responsible for passing messages and events back and forth between the bot and users, and translating them between their external and internal forms.
There are many open source adapters available (for Node, for C#), but there are many messaging platforms still unsupported. The code for these adapters provides a good template for creating a new one.
The Azure Bot Service channel system can be thought of as a meta-adapter: in this case, the translation is done in the cloud by the service, and
Switch npm to pull from the Bot Framework nightly build to install botbuilder-lg's preview release:
npm config set registry https://botbuilder.myget.org/F/botbuilder-declarative/npm/
npm install --save botbuilder-lg@4.5.0
Put this code in a Botkit skill:
/** | |
* This module if installed into a botkit v4+ app will enable "Bot Inspector" mode in Bot Framework Emulator. | |
* Put it in features/botinspector.js inside your fresh Botkit app. | |
* This allows you to connect to the bot app running locally with emulator to inspect messages | |
* as they come and go to the messaging platform. | |
* Read more here: | |
* https://github.com/Microsoft/botframework/blob/master/README.md#bot-inspector-new---preview | |
*/ | |
// import botbuilder 4.4 library | |
const { InspectionMiddleware, InspectionState, BotFrameworkAdapter } = require('botbuilder') |
var schedule = require('node-schedule'); | |
// channel/group ID fields for the places you want to send messages | |
var groupChannels = ['G6BKKTVPG', 'C6WHTV57V']; | |
// your slack team's id, needed to spawn a bot | |
var team_id = 'T123123'; | |
// this can probably be a FAKE user id, just required as part of startConversation | |
var user_id = 'U123'; |
Botkit.on('connected', function() { | |
Botkit.triggerScript('script','thread'); | |
}); |
var user_id = 123; | |
app.controller('chat', ['$scope',function($scope, $cookies) { | |
var socket; | |
$scope.reconnect_count = 0; | |
$scope.reconnect_timeout = 3000; | |
$scope.max_reconnect = 5; |