gasolin / saihubot Goto Github PK
View Code? Open in Web Editor NEW:speech_balloon: client side chatbot that works in the browser and command line
Home Page: https://gasolin.github.io/saihubot/
License: MIT License
:speech_balloon: client side chatbot that works in the browser and command line
Home Page: https://gasolin.github.io/saihubot/
License: MIT License
to bypass the CORS issue, Make a CORS (server-side) companion
https://www.npmjs.com/package/cors-anywhere
https://www.npmjs.com/package/qorsproxy
currently can use https://cors-anywhere.herokuapp.com/
to fetch data
add option to autosave brain (by setInterval)
There's a helper plugin which currently show names of plugins, let's add help
attr in each plugin and show it when the help
attr is available
correspondent to html-adapter/saihubot-html-skill-help
current structure
https://github.com/gasolin/saihubot in gh-pages branch
- index.html
- docs
- samples
- src
- adapters
- addons
- core
- skills
https://github.com/gasolin/saihubot-cli in main branch
- src
- adapters
- addons
- cli.js
suggest structure: (monorepo manage by lerna)
keep commit in gh-pages
branch so current html version will keep working
Name modules as saihubot-[adapter]-[addon|skill]-[name]
https://github.com/gasolin/saihubot in gh-pages branch
- index.html
- cli/ // previous https://github.com/gasolin/saihubot-cli
- docs
- samples
- packages
- core
- html-adapter
- html-addon-search
...
- html-skill-search
...
- cli-adaper
- cli-addon-search
...
- cli-skill-search
...
include keyword saihubot
, saihubot-adapter
, saihubot-skill
, saihubot-addon
in package.json
readonly config brain, accept path
requirement:{
brain: {
props: ['read', 'config'],
}
}
refer to gasolin/webbybot#67
wrap fetch api as Saihu.http
http(URL)
.query({})
.header('User-Agent', 'Mozilla/5.0')
.get(err, res, body) {...}
API:
huohubot.prompt(title, callback, [fail_message])
wait input for 30 seconds
then create index.html with full features
use https://www.npmjs.com/package/os-locale to detect locale,
can take extra SAIHUBOT_LANG
to overwrite the default
define in skill
i18n: {
'en': {
ticker: 'High {{high}} / Low {{low}}'
},
'zh_TW': {
ticker: '高 {{high}} / 低 {{low}}'
}
}
call robot.addon.t('ticker')
to render string
call robot.addon.i18n.language
to get current lang
ref https://www.i18next.com/translation-function/interpolation
create saihubot-brain-localstorage.js addon to map with hubot's brain module
ADV:
use sort of redux pattern (dispatch->reducer) and host state to reflect any change.
add rules manager to handle rules/skills
Then we can implement more functions in followup bugs
save dialog actions in brain and process skills in brain before handle plugin skills
ex: specify webextension sync driver to localforage brain
https://github.com/esphen/localforage-webExtensionStorage-driver
get system env and return a proper type
all system env are prefixed with SAIHUBOT_
SAIHUBOT_ETH_ADDRS=addr1, addr2
run getConfig('LANG')
should return as 'en' (string)
run getConfig('ETH_ADDRS')
should return as [addr1, addr2]
(array)
provide redux-adapter and reducerSlice that fit React (maybe React Native) usage
current huohubot-dialog only take care of click input, but does not parse text input
expect:
when user type something, the bot will parse it and treat as its selection
wrap window.fetch / node_fetch as addons.fetch
API in saihubot-[adapter]-addons-search
wrap robot.emit
(CustomEvent) and robot.on
(addEventListner) method for event handling
and define actions to access the brain
pick a magic number to just keep last 8 dialogues
cron like scheduler to notify by time/date
construct messages with markdown syntax
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.