diff --git a/README.md b/README.md index ab56d201..5cba9062 100755 --- a/README.md +++ b/README.md @@ -16,11 +16,12 @@ Check out the [wiki](https://github.com/kercre123/wire-pod/wiki) for more inform If you want to :P -[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate/?business=53VQ3Q95TD2M6&no_recurring=0¤cy_code=USD) +[![Buy Me A Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://buymeacoffee.com/kercre123) ## Credits - [Digital Dream Labs](https://github.com/digital-dream-labs) for open sourcing chipper and creating escape pod (which made this possible) +- [bliteknight](https://github.com/bliteknight) for making wire-pod more accessible with his easy-to-use pre-setup Linux boxes - [dietb](https://github.com/dietb) for rewriting chipper and giving tips - [fforchino](https://github.com/fforchino) for adding many features such as localization and multilanguage, and for helping out - [xanathon](https://github.com/xanathon) for the publicity and web interface help diff --git a/chipper/go.mod b/chipper/go.mod index 7b6e13d5..0e0d9596 100644 --- a/chipper/go.mod +++ b/chipper/go.mod @@ -25,39 +25,63 @@ require ( github.com/sashabaranov/go-openai v1.24.0 github.com/soheilhy/cmux v0.1.5 github.com/soundhound/houndify-sdk-go v0.3.5 + github.com/vadv/gopher-lua-libs v0.5.0 github.com/wlynxg/anet v0.0.1 - golang.org/x/crypto v0.16.0 + github.com/yuin/gopher-lua v1.1.1 + golang.org/x/crypto v0.21.0 + golang.org/x/text v0.14.0 google.golang.org/grpc v1.60.0 gopkg.in/ini.v1 v1.67.0 ) require ( + github.com/VividCortex/ewma v1.1.1 // indirect github.com/agnivade/levenshtein v1.1.1 // indirect github.com/akavel/rsrc v0.10.2 // indirect - github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect - github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect + github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect + github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect + github.com/alessio/shellescape v1.4.1 // indirect + github.com/aws/aws-sdk-go v1.34.28 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cbroglie/mustache v1.0.1 // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cheggaaa/pb/v3 v3.0.5 // indirect github.com/currantlabs/ble v0.0.0-20171229162446-c1d21c164cf8 // indirect github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f // indirect + github.com/dustin/go-humanize v1.0.0 // indirect + github.com/fatih/color v1.7.0 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/go-audio/riff v1.0.0 // indirect + github.com/go-sql-driver/mysql v1.5.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grd/ogg v0.0.0-20130623210630-0dae53159b70 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.3.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/jamesruan/sodium v0.0.0-20181216154042-9620b83ffeae // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josephspurrier/goversioninfo v1.4.0 // indirect github.com/kr/text v0.2.0 // indirect + github.com/lib/pq v1.7.0 // indirect github.com/magiconair/properties v1.8.1 // indirect github.com/mattn/go-colorable v0.1.8 // indirect github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mattn/go-runewidth v0.0.10 // indirect + github.com/mattn/go-sqlite3 v1.14.3 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab // indirect github.com/miekg/dns v1.1.41 // indirect github.com/mitchellh/mapstructure v1.4.3 // indirect + github.com/montanaflynn/stats v0.6.3 // indirect github.com/pelletier/go-toml v1.8.0 // indirect + github.com/prometheus/client_golang v1.11.1 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.26.0 // indirect + github.com/prometheus/procfs v0.6.0 // indirect github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/sirupsen/logrus v1.7.0 // indirect github.com/spf13/afero v1.2.2 // indirect github.com/spf13/cast v1.3.1 // indirect @@ -65,16 +89,17 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.7.1 // indirect github.com/subosito/gotenv v1.2.0 // indirect - github.com/yuin/gopher-lua v1.1.1 // indirect + github.com/technoweenie/multipartstreamer v1.0.1 // indirect + github.com/yuin/gluamapper v0.0.0-20150323120927-d836955830e7 // indirect golang.org/x/image v0.10.0 // indirect - golang.org/x/net v0.16.0 // indirect - golang.org/x/sys v0.15.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/sys v0.18.0 // indirect google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect gopkg.in/hraban/opus.v2 v2.0.0-20201025103112-d779bb1cc5a2 // indirect + gopkg.in/xmlpath.v2 v2.0.0-20150820204837-860cbeca3ebc // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/chipper/go.sum b/chipper/go.sum index ab7e7fdc..6049658b 100644 --- a/chipper/go.sum +++ b/chipper/go.sum @@ -44,15 +44,22 @@ github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8 github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Picovoice/leopard/binding/go/v2 v2.0.2 h1:Knk/UV51oRuHTHd7MGtlZXwsFF5jxu6AqttB0jGMHxs= github.com/Picovoice/leopard/binding/go/v2 v2.0.2/go.mod h1:/rYUeRDH4xBgtwBe9D8BwHIauPJ+M7czqLfyeJQJu7c= +github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM= +github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA= github.com/aalpern/go-metrics v0.0.0-20181116155206-644932c99203/go.mod h1:wHUOZ2LlAirciaWYGZM3apvZftM7aRXhLMDsdjqEFB4= github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8= github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw= github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= +github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= @@ -60,20 +67,31 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/asticode/go-asticoqui v0.2.0 h1:Y03X7kQUf309wHvv3ys39aYwyiFXqD9gIugNCDOVSrc= github.com/asticode/go-asticoqui v0.2.0/go.mod h1:HuUAasCpAyPjOQSqoY92VeBMYLkQ/Hu7Ij3aOhQrwlk= +github.com/aws/aws-sdk-go v1.34.0/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= +github.com/aws/aws-sdk-go v1.34.28 h1:sscPpn/Ns3i0F4HPEWAVcwdIRaZZCuL7llJ2/60yPIk= github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/bramvdbogaerde/go-scp v1.2.1 h1:BKTqrqXiQYovrDlfuVFaEGz0r4Ou6EED8L7jCXw6Buw= github.com/bramvdbogaerde/go-scp v1.2.1/go.mod h1:s4ZldBoRAOgUg8IrRP2Urmq5qqd2yPXQTPshACY8vQ0= github.com/bufbuild/buf v0.37.0/go.mod h1:lQ1m2HkIaGOFba6w/aC3KYBHhKEOESP3gaAEpS3dAFM= +github.com/cbroglie/mustache v1.0.1 h1:ivMg8MguXq/rrz2eu3tw6g3b16+PQhoTn6EZAhst2mw= +github.com/cbroglie/mustache v1.0.1/go.mod h1:R/RUa+SobQ14qkP4jtx5Vke5sDytONDQXNLPY/PO69g= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= +github.com/cheggaaa/pb/v3 v3.0.5 h1:lmZOti7CraK9RSjzExsY53+WWfub9Qv13B5m4ptEoPE= +github.com/cheggaaa/pb/v3 v3.0.5/go.mod h1:X1L61/+36nz9bjIsrDU52qHKOQukUQe2Ge+YvGuquCw= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -123,12 +141,14 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh github.com/docker/go-connections v0.4.1-0.20180821093606-97c2040d34df/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fforchino/vector-go-sdk v0.0.0-20231108155304-62168f3595d6 h1:zJLvieaRwMPB+u1bhFMFVubWMvLR3qWuQ1H+WKw7P+0= github.com/fforchino/vector-go-sdk v0.0.0-20231108155304-62168f3595d6/go.mod h1:VhuDr1h8ilsmbbjG1Wvp66kIzWfyGFwKA54oIhpwIKQ= @@ -151,8 +171,11 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= @@ -232,6 +255,7 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -290,17 +314,24 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/jamesruan/sodium v0.0.0-20181216154042-9620b83ffeae h1:FFafUVNizQIaIHAqmDKXQlZ+8/LplHZbL11emgcto+M= github.com/jamesruan/sodium v0.0.0-20181216154042-9620b83ffeae/go.mod h1:GZ0frHfchUw9cjP3CK1J7+M74KNo7zrhffQxTeuf5I8= github.com/jhump/protoreflect v1.8.1/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= +github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= +github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josephspurrier/goversioninfo v1.4.0 h1:Puhl12NSHUSALHSuzYwPYQkqa2E1+7SrtAPJorKK0C8= github.com/josephspurrier/goversioninfo v1.4.0/go.mod h1:JWzv5rKQr+MmW+LvM412ToT/IkYDZjaclF2pKDss8IY= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw= github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= @@ -323,18 +354,26 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lib/pq v1.7.0 h1:h93mCPfUSkaul3Ka/VG8uZdmW1uMHDGxzu0NWHuJmHY= github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg= github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= +github.com/mattn/go-sqlite3 v1.14.3 h1:j7a/xn1U6TKA/PHHxqZuzh64CdtRc7rU9M+AvkOl5bA= +github.com/mattn/go-sqlite3 v1.14.3/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/maxhawkins/go-webrtcvad v0.0.0-20210121163624-be60036f3083 h1:0JDcvP4R28p6+u8VIHCwYx7UwiHZ074INz3C397oc9s= github.com/maxhawkins/go-webrtcvad v0.0.0-20210121163624-be60036f3083/go.mod h1:YdrZ05xnooeP54y7m+/UvI23O1Td46PjWkLJu1VLObM= @@ -360,11 +399,16 @@ github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/moby/sys/mount v0.1.0/go.mod h1:FVQFLDRWwyBjDTBNQXDlWnSFREqOo3OKX9aqhmeoo74= github.com/moby/sys/mountinfo v0.1.0/go.mod h1:w2t2Avltqx8vE7gX5l+QiBKxODu2TX0+Syr3h52Tw4o= github.com/moby/term v0.0.0-20200429084858-129dac9f73f6/go.mod h1:or9wGItza1sRcM4Wd3dIv8DsFHYQuFsMHEdxUIlUxms= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/montanaflynn/stats v0.6.3 h1:F8446DrvIF5V5smZfZ8K9nrmmix0AFgevPdLruGOmzk= +github.com/montanaflynn/stats v0.6.3/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/ncruces/zenity v0.10.10 h1:V/rtAhr5QLdDThahOkm7EYlnw4RuEsf7oN+Xb6lz1j0= github.com/ncruces/zenity v0.10.10/go.mod h1:k3k4hJ4Wt1MUbeV48y+Gbl7Fp9skfGszN/xtKmuvhZk= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= @@ -404,18 +448,33 @@ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndr github.com/pressly/goose v2.6.0+incompatible/go.mod h1:m+QHWCqxR3k8D9l7qfzuC/djtlfzxr34mozWDYEu1z8= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.1 h1:+4eQaD7vAZ6DsfsxB15hbE0odUjGI5ARs9yskGu1v4s= +github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 h1:GranzK4hv1/pqTIhMTXt2X8MmMOuH3hMeUR0o9SP5yc= github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844/go.mod h1:T1TLSfyWVBRXVGzWd0o9BI4kfoO9InEgfQe4NV3mLz8= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= @@ -476,19 +535,26 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM= +github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/twitchtv/twirp v7.1.0+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/vadv/gopher-lua-libs v0.5.0 h1:m0hhWia1A1U3PIRmtdHWBj88ogzuIjm6HUBmtUa0Tz4= +github.com/vadv/gopher-lua-libs v0.5.0/go.mod h1:mlSOxmrjug7DwisiH7xBFnBellHobPbvAIhVeI/4SYY= github.com/wlynxg/anet v0.0.1 h1:VbkEEgHxPSrRQSiyRd0pmrbcEQAEU2TTb8fb4DmSYoQ= github.com/wlynxg/anet v0.0.1/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/yuin/gluamapper v0.0.0-20150323120927-d836955830e7 h1:noHsffKZsNfU38DwcXWEPldrTjIZ8FPNKx8mYMGnqjs= +github.com/yuin/gluamapper v0.0.0-20150323120927-d836955830e7/go.mod h1:bbMEM6aU1WDF1ErA5YJ0p91652pGv140gGw4Ww3RGp8= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA= github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= @@ -524,8 +590,8 @@ golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -575,6 +641,7 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -601,8 +668,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= -golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -619,6 +686,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -630,7 +698,9 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -649,6 +719,7 @@ golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -663,6 +734,8 @@ golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -671,18 +744,20 @@ golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210426080607-c94f62235c83/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -862,6 +937,7 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -875,11 +951,14 @@ gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/xmlpath.v2 v2.0.0-20150820204837-860cbeca3ebc h1:LMEBgNcZUqXaP7evD1PZcL6EcDVa2QOFuI+cqM3+AJM= +gopkg.in/xmlpath.v2 v2.0.0-20150820204837-860cbeca3ebc/go.mod h1:N8UOSI6/c2yOpa/XDz3KVUiegocTziPiqNkeNTMiG1k= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/chipper/intent-data/en-US.json b/chipper/intent-data/en-US.json index 42f415b9..6e34eb44 100755 --- a/chipper/intent-data/en-US.json +++ b/chipper/intent-data/en-US.json @@ -34,11 +34,16 @@ "keyphrases" : ["charge", "home", "go to your", "church", "find your ch", "charger" ], "requiresexact": false }, - { + { "name": "intent_system_sleep", "keyphrases" : ["flee", "sleep", "sheep", "go to sleep" ], "requiresexact": false }, + { + "name": "intent_system_noaudio", + "keyphrases" : ["[blank_audio]", "[door opens]", "[sighs]" ], + "requiresexact": true + }, { "name": "intent_greeting_goodmorning", "keyphrases" : ["morning", "mourning", "mooning", "it bore", "afternoon", "after noon", "after whom", "good morning" ], @@ -191,7 +196,7 @@ }, { "name": "intent_knowledge_promptquestion", - "keyphrases" : ["question", "weston", "i have a question" ], + "keyphrases" : ["question", "weston", "i have a question", "conversation", "lets talk", "let's talk" ], "requiresexact": false }, { diff --git a/chipper/pkg/mdnshandler/mdns.go b/chipper/pkg/mdnshandler/mdns.go index 77a20a38..6f703e0e 100644 --- a/chipper/pkg/mdnshandler/mdns.go +++ b/chipper/pkg/mdnshandler/mdns.go @@ -12,13 +12,7 @@ import ( "github.com/kercre123/zeroconf" ) -/* - goal: - - register a proxy every minute or so - (it is every 4 seconds right now, which is too much) - - BroadcastNow function which resets the timer and broadcasts right now - - detect when a new bot is available on the network and broadcast ASAP -*/ +// legacy ZeroConf code var PostingmDNS bool var MDNSNow chan bool @@ -39,9 +33,9 @@ func PostmDNSWhenNewVector() { for entry := range entries { if strings.Contains(entry.Service, "ankivector") { logger.Println("Vector discovered on network, broadcasting mDNS") - time.Sleep(time.Second * 2) - PostmDNSNow() cancel() + time.Sleep(time.Second) + PostmDNSNow() return } } @@ -78,6 +72,9 @@ func PostmDNS() { for { ipAddr := vars.GetOutboundIP().String() server, _ := zeroconf.RegisterProxy("escapepod", "_app-proto._tcp", "local.", 8084, "escapepod", []string{ipAddr}, []string{"txtv=0", "lo=1", "la=2"}, nil) + if os.Getenv("PRINT_MDNS") == "true" { + logger.Println("mDNS broadcasted") + } for { if MDNSTimeBeforeNextRegister >= 30 { MDNSTimeBeforeNextRegister = 0 diff --git a/chipper/pkg/scripting/bcontrol.go b/chipper/pkg/scripting/bcontrol.go new file mode 100644 index 00000000..56d05e4c --- /dev/null +++ b/chipper/pkg/scripting/bcontrol.go @@ -0,0 +1,92 @@ +package scripting + +import ( + "context" + + "github.com/fforchino/vector-go-sdk/pkg/vectorpb" + "github.com/kercre123/wire-pod/chipper/pkg/logger" + lua "github.com/yuin/gopher-lua" +) + +func SetBControlFunctions(L *lua.LState) { + start := make(chan bool) + stop := make(chan bool) + currentlyAssumed := false + L.SetGlobal("assumeBehaviorControl", L.NewFunction(func(*lua.LState) int { + robot := gRfLS(L) + priority := vectorpb.ControlRequest_OVERRIDE_BEHAVIORS + if priority != 0 && priority != 10 && priority != 20 && priority != 30 { + logger.Println("LUA: Behavior control priority was not valid. Valid choices are 10, 20, and 30. Assuming 10.") + } else { + priority = vectorpb.ControlRequest_Priority(L.ToInt(1)) + } + controlRequest := &vectorpb.BehaviorControlRequest{ + RequestType: &vectorpb.BehaviorControlRequest_ControlRequest{ + ControlRequest: &vectorpb.ControlRequest{ + Priority: priority, + }, + }, + } + go func() { + // * begin - modified from official vector-go-sdk + r, err := robot.Conn.BehaviorControl( + context.Background(), + ) + if err != nil { + logger.Println(err) + return + } + + if err := r.Send(controlRequest); err != nil { + logger.Println(err) + return + } + + for { + ctrlresp, err := r.Recv() + if err != nil { + logger.Println(err) + return + } + if ctrlresp.GetControlGrantedResponse() != nil { + start <- true + break + } + } + + for { + select { + case <-stop: + if err := r.Send( + &vectorpb.BehaviorControlRequest{ + RequestType: &vectorpb.BehaviorControlRequest_ControlRelease{ + ControlRelease: &vectorpb.ControlRelease{}, + }, + }, + ); err != nil { + logger.Println(err) + return + } + return + default: + continue + } + } + // * end - modified from official vector-go-sdk + }() + for range start { + break + } + currentlyAssumed = true + return 0 + })) + L.SetGlobal("releaseBehaviorControl", L.NewFunction(func(*lua.LState) int { + if currentlyAssumed { + stop <- true + currentlyAssumed = false + return 0 + } + return 1 + })) + +} diff --git a/chipper/pkg/scripting/scripting.go b/chipper/pkg/scripting/scripting.go new file mode 100644 index 00000000..5f934fa9 --- /dev/null +++ b/chipper/pkg/scripting/scripting.go @@ -0,0 +1,158 @@ +package scripting + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "time" + + "github.com/fforchino/vector-go-sdk/pkg/vector" + "github.com/fforchino/vector-go-sdk/pkg/vectorpb" + "github.com/kercre123/wire-pod/chipper/pkg/logger" + "github.com/kercre123/wire-pod/chipper/pkg/vars" + lualibs "github.com/vadv/gopher-lua-libs" + lua "github.com/yuin/gopher-lua" +) + +/* + +assumeBehaviorControl(priority int) + - 10,20,30 (10 highest priority, overriding behaviors. 30 lowest) +releaseBehaviorControl() + + + +sayText(text string, goroutine bool) +playAnimation(animation string, goroutine bool) + +*/ + +type ExternalLuaRequest struct { + ESN string `json:"esn"` + Script string `json:"script"` +} + +type Bot struct { + ESN string + Robot *vector.Vector +} + +func sayText(L *lua.LState) int { + textToSay := L.ToString(1) + executeWithGoroutine(L, func(L *lua.LState) error { + _, err := gRfLS(L).Conn.SayText(L.Context(), &vectorpb.SayTextRequest{Text: textToSay, UseVectorVoice: true, DurationScalar: 1.0}) + return err + }) + return 0 +} + +func playAnimation(L *lua.LState) int { + animToPlay := L.ToString(1) + executeWithGoroutine(L, func(L *lua.LState) error { + _, err := gRfLS(L).Conn.PlayAnimation(L.Context(), &vectorpb.PlayAnimationRequest{Animation: &vectorpb.Animation{Name: animToPlay}, Loops: 1}) + return err + }) + return 0 +} + +// get robot from LState +func gRfLS(L *lua.LState) *vector.Vector { + ud := L.GetGlobal("bot").(*lua.LUserData) + bot := ud.Value.(*Bot) + return bot.Robot +} + +func MakeLuaState(esn string, validating bool) (*lua.LState, error) { + L := lua.NewState() + lualibs.Preload(L) + L.SetContext(context.Background()) + L.SetGlobal("sayText", L.NewFunction(sayText)) + L.SetGlobal("playAnimation", L.NewFunction(playAnimation)) + SetBControlFunctions(L) + ud := L.NewUserData() + if !validating { + rob, err := vars.GetRobot(esn) + if err != nil { + return nil, err + } + ctx, can := context.WithTimeout(context.Background(), time.Second*3) + defer can() + _, err = rob.Conn.BatteryState(ctx, &vectorpb.BatteryStateRequest{}) + if err != nil { + return nil, err + } + ud.Value = &Bot{ESN: esn, Robot: rob} + L.SetGlobal("bot", ud) + } + return L, nil +} + +func executeWithGoroutine(L *lua.LState, fn func(L *lua.LState) error) { + goroutine := L.ToBool(2) + if goroutine { + go func() { + err := fn(L) + if err != nil { + logger.Println("LUA: failure: " + err.Error()) + } + }() + } else { + err := fn(L) + if err != nil { + logger.Println("LUA: failure: " + err.Error()) + } + } +} + +func RunLuaScript(esn string, luaScript string) error { + L, err := MakeLuaState(esn, false) + if err != nil { + return err + } + defer L.Close() + + if err := L.DoString(luaScript); err != nil { + return err + } + L.DoString("releaseBehaviorControl()") + return nil +} + +func ValidateLuaScript(luaScript string) error { + L, _ := MakeLuaState("", true) + defer L.Close() + + err := L.DoString(fmt.Sprintf("return function() %s end", luaScript)) + if err != nil { + return err + } + return nil +} + +func ScriptingAPI(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/api-lua/run_script": + fBody, err := io.ReadAll(r.Body) + if err != nil { + http.Error(w, "request body couldn't be read: "+err.Error(), http.StatusInternalServerError) + return + } + var scriptReq ExternalLuaRequest + err = json.Unmarshal(fBody, &scriptReq) + if err != nil { + http.Error(w, "request body couldn't be unmarshalled: "+err.Error(), http.StatusInternalServerError) + return + } + err = RunLuaScript(scriptReq.ESN, scriptReq.Script) + if err != nil { + logger.Println(err) + http.Error(w, err.Error(), http.StatusInternalServerError) + } + } +} + +func RegisterScriptingAPI() { + http.HandleFunc("/api-lua/", ScriptingAPI) +} diff --git a/chipper/pkg/vars/config.go b/chipper/pkg/vars/config.go index 1a57f573..47350869 100644 --- a/chipper/pkg/vars/config.go +++ b/chipper/pkg/vars/config.go @@ -21,18 +21,19 @@ type apiConfig struct { Unit string `json:"unit"` } `json:"weather"` Knowledge struct { - Enable bool `json:"enable"` - Provider string `json:"provider"` - Key string `json:"key"` - ID string `json:"id"` - Model string `json:"model"` - IntentGraph bool `json:"intentgraph"` - RobotName string `json:"robotName"` - OpenAIPrompt string `json:"openai_prompt"` - OpenAIVoice string `json:"openai_voice"` - SaveChat bool `json:"save_chat"` - CommandsEnable bool `json:"commands_enable"` - Endpoint string `json:"endpoint"` + Enable bool `json:"enable"` + Provider string `json:"provider"` + Key string `json:"key"` + ID string `json:"id"` + Model string `json:"model"` + IntentGraph bool `json:"intentgraph"` + RobotName string `json:"robotName"` + OpenAIPrompt string `json:"openai_prompt"` + OpenAIVoice string `json:"openai_voice"` + OpenAIVoiceWithEnglish bool `json:"openai_voice_with_english"` + SaveChat bool `json:"save_chat"` + CommandsEnable bool `json:"commands_enable"` + Endpoint string `json:"endpoint"` } `json:"knowledge"` STT struct { Service string `json:"provider"` diff --git a/chipper/pkg/vars/vars.go b/chipper/pkg/vars/vars.go index 1cbdf7ff..8ca6d1b4 100644 --- a/chipper/pkg/vars/vars.go +++ b/chipper/pkg/vars/vars.go @@ -61,7 +61,7 @@ var WebPort string = "8080" var SDKIniPath string var BotJdocs []botjdoc var BotInfo RobotInfoStore -var CustomIntents IntentsStruct +var CustomIntents []CustomIntent var CustomIntentsExist bool = false var DownloadedVoskModels []string var VoskGrammerEnable bool = false @@ -113,7 +113,7 @@ type JsonIntent struct { RequireExactMatch bool `json:"requiresexact"` } -type IntentsStruct []struct { +type CustomIntent struct { Name string `json:"name"` Description string `json:"description"` Utterances []string `json:"utterances"` @@ -125,6 +125,7 @@ type IntentsStruct []struct { Exec string `json:"exec"` ExecArgs []string `json:"execargs"` IsSystemIntent bool `json:"issystem"` + LuaScript string `json:"luascript"` } type AJdoc struct { diff --git a/chipper/pkg/wirepod/config-ws/webserver.go b/chipper/pkg/wirepod/config-ws/webserver.go index 1d3ee319..62c1b6a4 100755 --- a/chipper/pkg/wirepod/config-ws/webserver.go +++ b/chipper/pkg/wirepod/config-ws/webserver.go @@ -13,6 +13,7 @@ import ( "strings" "github.com/kercre123/wire-pod/chipper/pkg/logger" + "github.com/kercre123/wire-pod/chipper/pkg/scripting" "github.com/kercre123/wire-pod/chipper/pkg/vars" "github.com/kercre123/wire-pod/chipper/pkg/wirepod/localization" processreqs "github.com/kercre123/wire-pod/chipper/pkg/wirepod/preqs" @@ -21,20 +22,6 @@ import ( var SttInitFunc func() error -type CustomIntent struct { - Name string `json:"name"` - Description string `json:"description"` - Utterances []string `json:"utterances"` - Intent string `json:"intent"` - Params struct { - ParamName string `json:"paramname"` - ParamValue string `json:"paramvalue"` - } `json:"params"` - Exec string `json:"exec"` - ExecArgs []string `json:"execargs"` - IsSystemIntent bool `json:"issystem"` -} - func apiHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Headers", "*") @@ -78,7 +65,7 @@ func apiHandler(w http.ResponseWriter, r *http.Request) { handleGetVersionInfo(w) case "generate_certs": handleGenerateCerts(w) - case "is_api_v1": + case "is_api_v2": fmt.Fprintf(w, "it is!") default: http.Error(w, "not found", http.StatusNotFound) @@ -86,7 +73,7 @@ func apiHandler(w http.ResponseWriter, r *http.Request) { } func handleAddCustomIntent(w http.ResponseWriter, r *http.Request) { - var intent CustomIntent + var intent vars.CustomIntent if err := json.NewDecoder(r.Body).Decode(&intent); err != nil { http.Error(w, "invalid request body", http.StatusBadRequest) return @@ -95,6 +82,13 @@ func handleAddCustomIntent(w http.ResponseWriter, r *http.Request) { http.Error(w, "missing required field (name, description, utterances, and intent are required)", http.StatusBadRequest) return } + intent.LuaScript = strings.TrimSpace(intent.LuaScript) + if intent.LuaScript != "" { + if err := scripting.ValidateLuaScript(intent.LuaScript); err != nil { + http.Error(w, "lua validation error: "+err.Error(), http.StatusBadRequest) + return + } + } vars.CustomIntentsExist = true vars.CustomIntents = append(vars.CustomIntents, intent) saveCustomIntents() @@ -104,7 +98,7 @@ func handleAddCustomIntent(w http.ResponseWriter, r *http.Request) { func handleEditCustomIntent(w http.ResponseWriter, r *http.Request) { var request struct { Number int `json:"number"` - CustomIntent + vars.CustomIntent } if err := json.NewDecoder(r.Body).Decode(&request); err != nil { http.Error(w, "invalid request body", http.StatusBadRequest) @@ -136,6 +130,13 @@ func handleEditCustomIntent(w http.ResponseWriter, r *http.Request) { if request.Exec != "" { intent.Exec = request.Exec } + if request.LuaScript != "" { + intent.LuaScript = request.LuaScript + if err := scripting.ValidateLuaScript(intent.LuaScript); err != nil { + http.Error(w, "lua validation error: "+err.Error(), http.StatusBadRequest) + return + } + } if len(request.ExecArgs) != 0 { intent.ExecArgs = request.ExecArgs } @@ -386,9 +387,10 @@ func saveCustomIntents() { func DisableCachingAndSniffing(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate;") + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0") w.Header().Set("pragma", "no-cache") w.Header().Set("X-Content-Type-Options", "nosniff") + w.Header().Set("Expires", "0") next.ServeHTTP(w, r) }) } diff --git a/chipper/pkg/wirepod/preqs/intent.go b/chipper/pkg/wirepod/preqs/intent.go index c83839a4..6513dbc3 100755 --- a/chipper/pkg/wirepod/preqs/intent.go +++ b/chipper/pkg/wirepod/preqs/intent.go @@ -45,7 +45,7 @@ func (s *Server) ProcessIntent(req *vtt.IntentRequest) (*vtt.IntentResponse, err if !successMatched { if vars.APIConfig.Knowledge.IntentGraph && vars.APIConfig.Knowledge.Enable { logger.Println("Making LLM request for device " + req.Device + "...") - _, err := ttr.StreamingKGSim(req, req.Device, transcribedText) + _, err := ttr.StreamingKGSim(req, req.Device, transcribedText, false) if err != nil { logger.Println("LLM error: " + err.Error()) logger.LogUI("LLM error: " + err.Error()) diff --git a/chipper/pkg/wirepod/preqs/intent_graph.go b/chipper/pkg/wirepod/preqs/intent_graph.go index d3f8bfc7..83911e86 100755 --- a/chipper/pkg/wirepod/preqs/intent_graph.go +++ b/chipper/pkg/wirepod/preqs/intent_graph.go @@ -62,7 +62,7 @@ func (s *Server) ProcessIntentGraph(req *vtt.IntentGraphRequest) (*vtt.IntentGra if !successMatched { if vars.APIConfig.Knowledge.IntentGraph && vars.APIConfig.Knowledge.Enable { logger.Println("Making LLM request for device " + req.Device + "...") - _, err := ttr.StreamingKGSim(req, req.Device, transcribedText) + _, err := ttr.StreamingKGSim(req, req.Device, transcribedText, false) if err != nil { logger.Println("LLM error: " + err.Error()) logger.LogUI("LLM error: " + err.Error()) diff --git a/chipper/pkg/wirepod/preqs/knowledgegraph.go b/chipper/pkg/wirepod/preqs/knowledgegraph.go index 17d55131..0c594457 100755 --- a/chipper/pkg/wirepod/preqs/knowledgegraph.go +++ b/chipper/pkg/wirepod/preqs/knowledgegraph.go @@ -1,10 +1,7 @@ package processreqs import ( - "bytes" "encoding/json" - "io" - "net/http" "strings" pb "github.com/digital-dream-labs/api/go/chipperpb" @@ -12,6 +9,7 @@ import ( "github.com/kercre123/wire-pod/chipper/pkg/vars" "github.com/kercre123/wire-pod/chipper/pkg/vtt" sr "github.com/kercre123/wire-pod/chipper/pkg/wirepod/speechrequest" + ttr "github.com/kercre123/wire-pod/chipper/pkg/wirepod/ttr" "github.com/pkg/errors" "github.com/soundhound/houndify-sdk-go" ) @@ -68,141 +66,32 @@ func houndifyKG(req sr.SpeechRequest) string { return apiResponse } -func togetherRequest(transcribedText string) string { - // will also handle custom - sendString := "You are a helpful robot called Vector. You will be given a question asked by a user and you must provide the best answer you can. It may not be punctuated or spelled correctly. Keep the answer concise yet informative. Here is the question: " + "\\" + "\"" + transcribedText + "\\" + "\"" + " , Answer: " - url := "https://api.together.xyz/inference" - if vars.APIConfig.Knowledge.Provider == "custom" { - url = vars.APIConfig.Knowledge.Endpoint - } - model := vars.APIConfig.Knowledge.Model - formData := `{ -"model": "` + model + `", -"prompt": "` + sendString + `", -"temperature": 0.7, -"max_tokens": 256, -"top_p": 1 -}` - logger.Println("Making request to Together API...") - logger.Println("Model is " + model) - req, _ := http.NewRequest("POST", url, bytes.NewBuffer([]byte(formData))) - req.Header.Set("Content-Type", "application/json") - req.Header.Set("Authorization", "Bearer "+vars.APIConfig.Knowledge.Key) - client := &http.Client{} - resp, err := client.Do(req) - if err != nil { - return "There was an error making the request to Together API" - } - defer resp.Body.Close() - body, _ := io.ReadAll(resp.Body) - var togetherResponse map[string]any - err = json.Unmarshal(body, &togetherResponse) - if err != nil { - return "Together API returned no response." - } - output := togetherResponse["output"].(map[string]any) - choice := output["choices"].([]any) - for _, val := range choice { - x := val.(map[string]any) - textResponse := x["text"].(string) - apiResponse := strings.TrimSuffix(textResponse, "") - logger.Println("Together response: " + apiResponse) - return apiResponse - } - // In case text is not present in result from API, return a string saying answer was not found - return "Answer was not found" -} - -func openaiRequest(transcribedText string) string { - var robName string - if vars.APIConfig.Knowledge.RobotName != "" { - robName = vars.APIConfig.Knowledge.RobotName - } else { - robName = "Vector" - } - defaultPrompt := "You are a helpful robot called " + robName + ". You will be given a question asked by a user and you must provide the best answer you can. It may not be punctuated or spelled correctly as the STT model is small. The answer will be put through TTS, so it should be a speakable string. Keep the answer concise yet informative." - sendString := " Here is the question: " + "\\" + "\"" + transcribedText + "\\" + "\"" + " , Answer: " - if strings.TrimSpace(vars.APIConfig.Knowledge.OpenAIPrompt) != "" { - sendString = strings.TrimSpace(vars.APIConfig.Knowledge.OpenAIPrompt) + sendString - } else { - sendString = defaultPrompt + sendString - } - logger.Println("Making request to OpenAI...") - url := "https://api.openai.com/v1/completions" - formData := `{ -"model": "gpt-3.5-turbo-instruct", -"prompt": "` + sendString + `", -"temperature": 0.9, -"max_tokens": 256, -"top_p": 1, -"frequency_penalty": 0.2, -"presence_penalty": 0 -}` - req, _ := http.NewRequest("POST", url, bytes.NewBuffer([]byte(formData))) - req.Header.Set("Content-Type", "application/json") - req.Header.Set("Authorization", "Bearer "+strings.TrimSpace(vars.APIConfig.Knowledge.Key)) - client := &http.Client{} - resp, err := client.Do(req) - if err != nil { - logger.Println(err) - return "There was an error making the request to OpenAI." - } - defer resp.Body.Close() - body, _ := io.ReadAll(resp.Body) - type openAIStruct struct { - ID string `json:"id"` - Object string `json:"object"` - Created int `json:"created"` - Model string `json:"model"` - Choices []struct { - Text string `json:"text"` - Index int `json:"index"` - Logprobs interface{} `json:"logprobs"` - FinishReason string `json:"finish_reason"` - } `json:"choices"` - Usage struct { - PromptTokens int `json:"prompt_tokens"` - CompletionTokens int `json:"completion_tokens"` - TotalTokens int `json:"total_tokens"` - } `json:"usage"` - } - var openAIResponse openAIStruct - err = json.Unmarshal(body, &openAIResponse) - if err != nil || len(openAIResponse.Choices) == 0 { - logger.Println("OpenAI returned no response.") - logger.Println(string(body)) - return "OpenAI returned no response." - } - apiResponse := strings.TrimSpace(openAIResponse.Choices[0].Text) - logger.Println("OpenAI response: " + apiResponse) - return apiResponse -} - -func openaiKG(speechReq sr.SpeechRequest) string { +func streamingKG(req *vtt.KnowledgeGraphRequest, speechReq sr.SpeechRequest) string { + // have him start "thinking" right after the text is transcribed transcribedText, err := sttHandler(speechReq) if err != nil { return "There was an error." } - return openaiRequest(transcribedText) -} - -func togetherKG(speechReq sr.SpeechRequest) string { - transcribedText, err := sttHandler(speechReq) + kg := pb.KnowledgeGraphResponse{ + Session: req.Session, + DeviceId: req.Device, + CommandType: NoResult, + SpokenText: "bla bla bla bla bla bla bla bla bla bla", + } + req.Stream.Send(&kg) + _, err = ttr.StreamingKGSim(req, req.Device, transcribedText, true) if err != nil { - return "There was an error." + logger.Println("LLM error: " + err.Error()) } - return togetherRequest(transcribedText) + logger.Println("(KG) Bot " + speechReq.Device + " request served.") + return "" } // Takes a SpeechRequest, figures out knowledgegraph provider, makes request, returns API response -func KgRequest(speechReq sr.SpeechRequest) string { +func KgRequest(req *vtt.KnowledgeGraphRequest, speechReq sr.SpeechRequest) string { if vars.APIConfig.Knowledge.Enable { if vars.APIConfig.Knowledge.Provider == "houndify" { return houndifyKG(speechReq) - } else if vars.APIConfig.Knowledge.Provider == "openai" { - return openaiKG(speechReq) - } else if vars.APIConfig.Knowledge.Provider == "together" { - return togetherKG(speechReq) } } return "Knowledge graph is not enabled. This can be enabled in the web interface." @@ -211,16 +100,20 @@ func KgRequest(speechReq sr.SpeechRequest) string { func (s *Server) ProcessKnowledgeGraph(req *vtt.KnowledgeGraphRequest) (*vtt.KnowledgeGraphResponse, error) { InitKnowledge() speechReq := sr.ReqToSpeechRequest(req) - apiResponse := KgRequest(speechReq) - kg := pb.KnowledgeGraphResponse{ - Session: req.Session, - DeviceId: req.Device, - CommandType: NoResult, - SpokenText: apiResponse, - } - logger.Println("(KG) Bot " + speechReq.Device + " request served.") - if err := req.Stream.Send(&kg); err != nil { - return nil, err + if vars.APIConfig.Knowledge.Enable && vars.APIConfig.Knowledge.Provider != "houndify" { + streamingKG(req, speechReq) + } else { + apiResponse := KgRequest(req, speechReq) + kg := pb.KnowledgeGraphResponse{ + Session: req.Session, + DeviceId: req.Device, + CommandType: NoResult, + SpokenText: apiResponse, + } + logger.Println("(KG) Bot " + speechReq.Device + " request served.") + if err := req.Stream.Send(&kg); err != nil { + return nil, err + } } return nil, nil diff --git a/chipper/pkg/wirepod/sdkapp/jdocspinger.go b/chipper/pkg/wirepod/sdkapp/jdocspinger.go index 59d74942..43f23c62 100644 --- a/chipper/pkg/wirepod/sdkapp/jdocspinger.go +++ b/chipper/pkg/wirepod/sdkapp/jdocspinger.go @@ -12,7 +12,6 @@ import ( "github.com/fforchino/vector-go-sdk/pkg/vectorpb" "github.com/kercre123/wire-pod/chipper/pkg/logger" - "github.com/kercre123/wire-pod/chipper/pkg/mdnshandler" "github.com/kercre123/wire-pod/chipper/pkg/vars" "github.com/kercre123/zeroconf" ) @@ -104,9 +103,6 @@ func InitJdocsPinger() { JdocsPingerBots.Robots[i].TimeSinceLastCheck = JdocsPingerBots.Robots[i].TimeSinceLastCheck + 1 if JdocsPingerBots.Robots[i].TimeSinceLastCheck > 15 { logger.Println("Haven't received a conn check from " + bot.ESN + " in 15 seconds, will ping jdocs on next check") - if vars.APIConfig.Server.EPConfig { - mdnshandler.PostmDNSNow() - } JdocsPingerBots.Robots[i].Stopped = true } } @@ -234,8 +230,4 @@ func RunMDNS(botIP string) { } } fmt.Println("Done running mDNS") - // a new resolver seems to kill any proxy - if vars.APIConfig.Server.EPConfig { - mdnshandler.PostmDNSNow() - } } diff --git a/chipper/pkg/wirepod/sdkapp/server.go b/chipper/pkg/wirepod/sdkapp/server.go index b8264ab9..8688511d 100755 --- a/chipper/pkg/wirepod/sdkapp/server.go +++ b/chipper/pkg/wirepod/sdkapp/server.go @@ -17,6 +17,7 @@ import ( "github.com/fforchino/vector-go-sdk/pkg/vectorpb" "github.com/kercre123/wire-pod/chipper/pkg/logger" + "github.com/kercre123/wire-pod/chipper/pkg/scripting" "github.com/kercre123/wire-pod/chipper/pkg/vars" ) @@ -519,6 +520,7 @@ func DisableCachingAndSniffing(next http.Handler) http.Handler { } func BeginServer() { + scripting.RegisterScriptingAPI() if os.Getenv("JDOCS_PINGER_ENABLED") == "false" { PingerEnabled = false logger.Println("Jdocs pinger has been disabled") diff --git a/chipper/pkg/wirepod/ttr/bcontrol.go b/chipper/pkg/wirepod/ttr/bcontrol.go index fb347e9c..a5ef94a0 100644 --- a/chipper/pkg/wirepod/ttr/bcontrol.go +++ b/chipper/pkg/wirepod/ttr/bcontrol.go @@ -6,6 +6,7 @@ import ( "github.com/fforchino/vector-go-sdk/pkg/vector" "github.com/fforchino/vector-go-sdk/pkg/vectorpb" + "github.com/kercre123/wire-pod/chipper/pkg/logger" ) func sayText(robot *vector.Vector, text string) { @@ -79,3 +80,62 @@ func sayText(robot *vector.Vector, text string) { } }() } + +func BControl(robot *vector.Vector, ctx context.Context, start, stop chan bool) { + controlRequest := &vectorpb.BehaviorControlRequest{ + RequestType: &vectorpb.BehaviorControlRequest_ControlRequest{ + ControlRequest: &vectorpb.ControlRequest{ + Priority: vectorpb.ControlRequest_OVERRIDE_BEHAVIORS, + }, + }, + } + + go func() { + // * begin - modified from official vector-go-sdk + r, err := robot.Conn.BehaviorControl( + ctx, + ) + if err != nil { + logger.Println(err) + return + } + + if err := r.Send(controlRequest); err != nil { + logger.Println(err) + return + } + + for { + ctrlresp, err := r.Recv() + if err != nil { + logger.Println(err) + return + } + if ctrlresp.GetControlGrantedResponse() != nil { + start <- true + break + } + } + + for { + select { + case <-stop: + logger.Println("KGSim: releasing behavior control (interrupt)") + if err := r.Send( + &vectorpb.BehaviorControlRequest{ + RequestType: &vectorpb.BehaviorControlRequest_ControlRelease{ + ControlRelease: &vectorpb.ControlRelease{}, + }, + }, + ); err != nil { + logger.Println(err) + return + } + return + default: + continue + } + } + // * end - modified from official vector-go-sdk + }() +} diff --git a/chipper/pkg/wirepod/ttr/kgsim.go b/chipper/pkg/wirepod/ttr/kgsim.go index 8b608af2..7380d1a4 100644 --- a/chipper/pkg/wirepod/ttr/kgsim.go +++ b/chipper/pkg/wirepod/ttr/kgsim.go @@ -84,8 +84,8 @@ func removeSpecialCharacters(str string) string { result = removeEmojis(re.ReplaceAllString(result, "")) // Replace special characters with ASCII - // * COPY/PASTE TO ADD MORE CHARACTERS: - // result = strings.ReplaceAll(result, "", "") + // * COPY/PASTE TO ADD MORE CHARACTERS: + // result = strings.ReplaceAll(result, "", "") result = strings.ReplaceAll(result, "‘", "'") result = strings.ReplaceAll(result, "’", "'") result = strings.ReplaceAll(result, "“", "\"") @@ -105,11 +105,10 @@ func removeSpecialCharacters(str string) string { result = strings.ReplaceAll(result, "®", "(r)") result = strings.ReplaceAll(result, "™", "(tm)") result = strings.ReplaceAll(result, "@", "(a)") - result = strings.ReplaceAll(result, " AI ", " A. I. ") + result = strings.ReplaceAll(result, " AI ", " A. I. ") return result } - func removeEmojis(input string) string { // a mess, but it works! re := regexp.MustCompile(`[\x{1F600}-\x{1F64F}]|[\x{1F300}-\x{1F5FF}]|[\x{1F680}-\x{1F6FF}]|[\x{1F1E0}-\x{1F1FF}]|[\x{2600}-\x{26FF}]|[\x{2700}-\x{27BF}]|[\x{1F900}-\x{1F9FF}]|[\x{1F004}]|[\x{1F0CF}]|[\x{1F18E}]|[\x{1F191}-\x{1F251}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]|[\x{1F004}-\x{1F0CF}]|[\x{1F191}-\x{1F251}]|[\x{2B50}]`) @@ -117,7 +116,7 @@ func removeEmojis(input string) string { return result } -func CreateAIReq(transcribedText, esn string, gpt3tryagain bool) openai.ChatCompletionRequest { +func CreateAIReq(transcribedText, esn string, gpt3tryagain, isKG bool) openai.ChatCompletionRequest { defaultPrompt := "You are a helpful, animated robot called Vector. Keep the response concise yet informative." var nChat []openai.ChatCompletionMessage @@ -143,7 +142,7 @@ func CreateAIReq(transcribedText, esn string, gpt3tryagain bool) openai.ChatComp model = vars.APIConfig.Knowledge.Model } - smsg.Content = CreatePrompt(smsg.Content, model) + smsg.Content = CreatePrompt(smsg.Content, model, isKG) nChat = append(nChat, smsg) if vars.APIConfig.Knowledge.SaveChat { @@ -169,7 +168,13 @@ func CreateAIReq(transcribedText, esn string, gpt3tryagain bool) openai.ChatComp return aireq } -func StreamingKGSim(req interface{}, esn string, transcribedText string) (string, error) { +func StreamingKGSim(req interface{}, esn string, transcribedText string, isKG bool) (string, error) { + start := make(chan bool) + stop := make(chan bool) + stopStop := make(chan bool) + kgReadyToAnswer := make(chan bool) + kgStopLooping := false + ctx := context.Background() matched := false var robot *vector.Vector var guid string @@ -193,6 +198,24 @@ func StreamingKGSim(req interface{}, esn string, transcribedText string) (string if err != nil { return "", err } + if isKG { + BControl(robot, ctx, start, stop) + go func() { + for { + if kgStopLooping { + kgReadyToAnswer <- true + break + } + robot.Conn.PlayAnimation(ctx, &vectorpb.PlayAnimationRequest{ + Animation: &vectorpb.Animation{ + Name: "anim_knowledgegraph_searching_01", + }, + Loops: 1, + }) + time.Sleep(time.Second / 3) + } + }() + } var fullRespText string var fullfullRespText string var fullRespSlice []string @@ -213,18 +236,17 @@ func StreamingKGSim(req interface{}, esn string, transcribedText string) (string } else if vars.APIConfig.Knowledge.Provider == "openai" { c = openai.NewClient(vars.APIConfig.Knowledge.Key) } - ctx := context.Background() speakReady := make(chan string) successIntent := make(chan bool) - aireq := CreateAIReq(transcribedText, esn, false) + aireq := CreateAIReq(transcribedText, esn, false, isKG) stream, err := c.CreateChatCompletionStream(ctx, aireq) if err != nil { if strings.Contains(err.Error(), "does not exist") && vars.APIConfig.Knowledge.Provider == "openai" { logger.Println("GPT-4 model cannot be accessed with this API key. You likely need to add more than $5 dollars of funds to your OpenAI account.") logger.LogUI("GPT-4 model cannot be accessed with this API key. You likely need to add more than $5 dollars of funds to your OpenAI account.") - aireq := CreateAIReq(transcribedText, esn, true) + aireq := CreateAIReq(transcribedText, esn, true, isKG) logger.Println("Falling back to " + aireq.Model) logger.LogUI("Falling back to " + aireq.Model) stream, err = c.CreateChatCompletionStream(ctx, aireq) @@ -233,6 +255,15 @@ func StreamingKGSim(req interface{}, esn string, transcribedText string) (string return "", err } } else { + if isKG { + kgStopLooping = true + for range kgReadyToAnswer { + break + } + stop <- true + time.Sleep(time.Second / 3) + KGSim(esn, "There was an error getting data from the L. L. M.") + } return "", err } } @@ -245,13 +276,23 @@ func StreamingKGSim(req interface{}, esn string, transcribedText string) (string for { response, err := stream.Recv() if errors.Is(err, io.EOF) { - // if fullRespSlice != fullRespText, add that missing bit to fullRespSlice + // prevents a crash if len(fullRespSlice) == 0 { logger.Println("LLM returned no response") successIntent <- false + if isKG { + kgStopLooping = true + for range kgReadyToAnswer { + break + } + stop <- true + time.Sleep(time.Second / 3) + KGSim(esn, "There was an error getting data from the L. L. M.") + } break } isDone = true + // if fullRespSlice != fullRespText, add that missing bit to fullRespSlice newStr := fullRespSlice[0] for i, str := range fullRespSlice { if i == 0 { @@ -318,81 +359,48 @@ func StreamingKGSim(req interface{}, esn string, transcribedText string) (string }() for is := range successIntent { if is { - IntentPass(req, "intent_greeting_hello", transcribedText, map[string]string{}, false) + if !isKG { + IntentPass(req, "intent_greeting_hello", transcribedText, map[string]string{}, false) + } break } else { return "", errors.New("llm returned no response") } } time.Sleep(time.Millisecond * 200) - controlRequest := &vectorpb.BehaviorControlRequest{ - RequestType: &vectorpb.BehaviorControlRequest_ControlRequest{ - ControlRequest: &vectorpb.ControlRequest{ - Priority: vectorpb.ControlRequest_OVERRIDE_BEHAVIORS, - }, - }, + if !isKG { + BControl(robot, ctx, start, stop) } - start := make(chan bool) - stop := make(chan bool) - + interrupted := false go func() { - // * begin - modified from official vector-go-sdk - r, err := robot.Conn.BehaviorControl( - ctx, - ) - if err != nil { - logger.Println(err) - return - } - - if err := r.Send(controlRequest); err != nil { - logger.Println(err) - return - } - - for { - ctrlresp, err := r.Recv() - if err != nil { - logger.Println(err) - return - } - if ctrlresp.GetControlGrantedResponse() != nil { - start <- true - break - } - } - - for { - select { - case <-stop: - logger.Println("KGSim: releasing behavior control (interrupt)") - if err := r.Send( - &vectorpb.BehaviorControlRequest{ - RequestType: &vectorpb.BehaviorControlRequest_ControlRelease{ - ControlRelease: &vectorpb.ControlRelease{}, - }, - }, - ); err != nil { - logger.Println(err) - return - } - return - default: - continue - } - } - // * end - modified from official vector-go-sdk + interrupted = InterruptKGSimWhenTouchedOrWaked(robot, stop, stopStop) }() + var TTSLoopAnimation string + var TTSGetinAnimation string + if isKG { + TTSLoopAnimation = "anim_knowledgegraph_answer_01" + TTSGetinAnimation = "anim_knowledgegraph_searching_getout_01" + } else { + TTSLoopAnimation = "anim_tts_loop_02" + TTSGetinAnimation = "anim_getin_tts_01" + } var stopTTSLoop bool TTSLoopStopped := make(chan bool) for range start { - time.Sleep(time.Millisecond * 300) + if isKG { + kgStopLooping = true + for range kgReadyToAnswer { + break + } + } else { + time.Sleep(time.Millisecond * 300) + } robot.Conn.PlayAnimation( ctx, &vectorpb.PlayAnimationRequest{ Animation: &vectorpb.Animation{ - Name: "anim_getin_tts_01", + Name: TTSGetinAnimation, }, Loops: 1, }, @@ -408,7 +416,7 @@ func StreamingKGSim(req interface{}, esn string, transcribedText string) (string ctx, &vectorpb.PlayAnimationRequest{ Animation: &vectorpb.Animation{ - Name: "anim_tts_loop_02", + Name: TTSLoopAnimation, }, Loops: 1, }, @@ -431,10 +439,13 @@ func StreamingKGSim(req interface{}, esn string, transcribedText string) (string break } } + if interrupted { + break + } logger.Println(respSlice[numInResp]) acts := GetActionsFromString(respSlice[numInResp]) nChat[len(nChat)-1].Content = fullRespText - disconnect = PerformActions(nChat, acts, robot) + disconnect = PerformActions(nChat, acts, robot, stopStop) if disconnect { break } @@ -447,17 +458,22 @@ func StreamingKGSim(req interface{}, esn string, transcribedText string) (string } } time.Sleep(time.Millisecond * 100) - // robot.Conn.PlayAnimation( - // ctx, - // &vectorpb.PlayAnimationRequest{ - // Animation: &vectorpb.Animation{ - // Name: "anim_knowledgegraph_success_01", + // if isKG { + // robot.Conn.PlayAnimation( + // ctx, + // &vectorpb.PlayAnimationRequest{ + // Animation: &vectorpb.Animation{ + // Name: "anim_knowledgegraph_success_01", + // }, + // Loops: 1, // }, - // Loops: 1, - // }, - // ) - //time.Sleep(time.Millisecond * 3300) - stop <- true + // ) + // time.Sleep(time.Millisecond * 3300) + // } + if !interrupted { + stopStop <- true + stop <- true + } } return "", nil } @@ -598,15 +614,6 @@ func KGSim(esn string, textToSay string) error { } } time.Sleep(time.Millisecond * 100) - robot.Conn.PlayAnimation( - ctx, - &vectorpb.PlayAnimationRequest{ - Animation: &vectorpb.Animation{ - Name: "anim_knowledgegraph_success_01", - }, - Loops: 1, - }, - ) //time.Sleep(time.Millisecond * 3300) stop <- true } diff --git a/chipper/pkg/wirepod/ttr/kgsim_cmds.go b/chipper/pkg/wirepod/ttr/kgsim_cmds.go index 4ceced7b..e8126b70 100644 --- a/chipper/pkg/wirepod/ttr/kgsim_cmds.go +++ b/chipper/pkg/wirepod/ttr/kgsim_cmds.go @@ -26,7 +26,8 @@ const ( // arg: animation name ActionPlayAnimationWI = 2 // arg: now - ActionGetImage = 3 + ActionGetImage = 3 + ActionNewRequest = 4 // arg: sound file ActionPlaySound = 4 ) @@ -124,6 +125,13 @@ var ValidLLMCommands []LLMCommand = []LLMCommand{ Action: ActionGetImage, SupportedModels: []string{openai.GPT4o}, }, + { + Command: "newVoiceRequest", + Description: "Starts a new voice command from the robot. Use this if you want more input from the user/if you want to carry out a conversation. You are the only one who can end it in this case. This goes at the end of your response, if you use it.", + ParamChoices: "now", + Action: ActionNewRequest, + SupportedModels: []string{"all"}, + }, // { // Command: "playSound", // Description: "Plays a sound on the robot.", @@ -141,7 +149,7 @@ func ModelIsSupported(cmd LLMCommand, model string) bool { return false } -func CreatePrompt(origPrompt string, model string) string { +func CreatePrompt(origPrompt string, model string, isKG bool) string { prompt := origPrompt + "\n\n" + "Keep in mind, user input comes from speech-to-text software, so respond accordingly. No special characters, especially these: & ^ * # @ - . No lists. No formatting." if vars.APIConfig.Knowledge.CommandsEnable { prompt = prompt + "\n\n" + "You are running ON an Anki Vector robot. You have a set of commands. If you include an emoji, I will make you start over. If you want to use a command but it doesn't exist or your desired parameter isn't in the list, avoid using the command. The format is {{command||parameter}}. You can embed these in sentences. Example: \"User: How are you feeling? | Response: \"{{playAnimationWI||sad}} I'm feeling sad...\". Square brackets ([]) are not valid.\n\nUse the playAnimation or playAnimationWI commands if you want to express emotion! You are very animated and good at following instructions. Animation takes precendence over words. You are to include many animations in your response.\n\nHere is every valid command:" @@ -150,8 +158,18 @@ func CreatePrompt(origPrompt string, model string) string { promptAppendage := "\n\nCommand Name: " + cmd.Command + "\nDescription: " + cmd.Description + "\nParameter choices: " + cmd.ParamChoices prompt = prompt + promptAppendage } + if isKG && vars.APIConfig.Knowledge.SaveChat { + promptAppentage := "\n\nNOTE: You are in 'conversation' mode. If you ask the user a question, use newVoiceRequest. If you don't, you should end the conversation by not using it." + prompt = prompt + promptAppentage + } else { + promptAppentage := "\n\nNOTE: You are NOT in 'conversation' mode. Refrain from asking the user any questions and from using newVoiceRequest." + prompt = prompt + promptAppentage + } } } + if os.Getenv("DEBUG_PRINT_PROMPT") == "true" { + logger.Println(prompt) + } return prompt } @@ -270,10 +288,9 @@ func DoPlaySound(sound string, robot *vector.Vector) error { func DoSayText(input string, robot *vector.Vector) error { // just before vector speaks - removeSpecialCharacters(input) + removeSpecialCharacters(input) - // TODO - if (vars.APIConfig.STT.Language != "en-US" && vars.APIConfig.Knowledge.Provider == "openai") || os.Getenv("USE_OPENAI_VOICE") == "true" { + if (vars.APIConfig.STT.Language != "en-US" && vars.APIConfig.Knowledge.Provider == "openai") || vars.APIConfig.Knowledge.OpenAIVoiceWithEnglish { err := DoSayText_OpenAI(robot, input) return err } @@ -373,13 +390,23 @@ func DoSayText_OpenAI(robot *vector.Vector, input string) error { return nil } -func DoGetImage(msgs []openai.ChatCompletionMessage, param string, robot *vector.Vector) { +func DoGetImage(msgs []openai.ChatCompletionMessage, param string, robot *vector.Vector, stopStop chan bool) { + stopImaging := false + go func() { + for range stopStop { + stopImaging = true + break + } + }() logger.Println("Get image here...") // get image robot.Conn.EnableMirrorMode(context.Background(), &vectorpb.EnableMirrorModeRequest{ Enable: true, }) for i := 3; i > 0; i-- { + if stopImaging { + return + } time.Sleep(time.Millisecond * 300) robot.Conn.SayText( context.Background(), @@ -389,6 +416,9 @@ func DoGetImage(msgs []openai.ChatCompletionMessage, param string, robot *vector DurationScalar: 1.05, }, ) + if stopImaging { + return + } } resp, _ := robot.Conn.CaptureSingleImage( context.Background(), @@ -466,6 +496,9 @@ func DoGetImage(msgs []openai.ChatCompletionMessage, param string, robot *vector logger.Println("Using " + vars.APIConfig.Knowledge.Model) aireq.Model = vars.APIConfig.Knowledge.Model } + if stopImaging { + return + } stream, err := c.CreateChatCompletionStream(ctx, aireq) if err != nil { if strings.Contains(err.Error(), "does not exist") && vars.APIConfig.Knowledge.Provider == "openai" { @@ -550,6 +583,9 @@ func DoGetImage(msgs []openai.ChatCompletionMessage, param string, robot *vector }() numInResp := 0 for { + if stopImaging { + return + } respSlice := fullRespSlice if len(respSlice)-1 < numInResp { if !isDone { @@ -564,14 +600,31 @@ func DoGetImage(msgs []openai.ChatCompletionMessage, param string, robot *vector } logger.Println(respSlice[numInResp]) acts := GetActionsFromString(respSlice[numInResp]) - PerformActions(msgs, acts, robot) + PerformActions(msgs, acts, robot, stopStop) numInResp = numInResp + 1 + if stopImaging { + return + } } } -func PerformActions(msgs []openai.ChatCompletionMessage, actions []RobotAction, robot *vector.Vector) bool { +func DoNewRequest(robot *vector.Vector) { + time.Sleep(time.Second / 3) + robot.Conn.AppIntent(context.Background(), &vectorpb.AppIntentRequest{Intent: "knowledge_question"}) +} + +func PerformActions(msgs []openai.ChatCompletionMessage, actions []RobotAction, robot *vector.Vector, stopStop chan bool) bool { // assuming we have behavior control already + stopPerforming := false + go func() { + for range stopStop { + stopPerforming = true + } + }() for _, action := range actions { + if stopPerforming { + return false + } switch { case action.Action == ActionSayText: DoSayText(action.Parameter, robot) @@ -579,8 +632,11 @@ func PerformActions(msgs []openai.ChatCompletionMessage, actions []RobotAction, DoPlayAnimation(action.Parameter, robot) case action.Action == ActionPlayAnimationWI: DoPlayAnimationWI(action.Parameter, robot) + case action.Action == ActionNewRequest: + go DoNewRequest(robot) + return true case action.Action == ActionGetImage: - DoGetImage(msgs, action.Parameter, robot) + DoGetImage(msgs, action.Parameter, robot, stopStop) return true case action.Action == ActionPlaySound: DoPlaySound(action.Parameter, robot) diff --git a/chipper/pkg/wirepod/ttr/kgsim_interrupt.go b/chipper/pkg/wirepod/ttr/kgsim_interrupt.go new file mode 100644 index 00000000..0f9daa3f --- /dev/null +++ b/chipper/pkg/wirepod/ttr/kgsim_interrupt.go @@ -0,0 +1,92 @@ +package wirepod_ttr + +import ( + "context" + "time" + + "github.com/fforchino/vector-go-sdk/pkg/vector" + "github.com/fforchino/vector-go-sdk/pkg/vectorpb" + "github.com/kercre123/wire-pod/chipper/pkg/logger" +) + +func InterruptKGSimWhenTouchedOrWaked(rob *vector.Vector, stop chan bool, stopStop chan bool) bool { + strm, err := rob.Conn.EventStream( + context.Background(), + &vectorpb.EventRequest{ + ListType: &vectorpb.EventRequest_WhiteList{ + WhiteList: &vectorpb.FilterList{ + List: []string{"robot_state", "wake_word"}, + }, + }, + }, + ) + if err != nil { + logger.Println("Couldn't make an event stream: " + err.Error()) + return false + } + var stopFunc bool + go func() { + for range stopStop { + logger.Println("KG Interrupter has been stopped") + stopFunc = true + break + } + }() + var origTouchValue uint32 + var origValueGotten bool + var valsAboveValue int + var valsAboveValueMax int = 5 + var stopResponse bool + for { + var resp *vectorpb.EventResponse + resp, err = strm.Recv() + if err != nil { + break + } + switch resp.Event.EventType.(type) { + case *vectorpb.Event_RobotState: + origTouchValue = resp.Event.GetRobotState().TouchData.GetRawTouchValue() + origValueGotten = true + default: + } + if origValueGotten { + break + } + } + if origValueGotten { + for { + var resp *vectorpb.EventResponse + resp, err = strm.Recv() + if err != nil { + logger.Println("Event stream error: " + err.Error()) + return false + } + switch resp.Event.EventType.(type) { + case *vectorpb.Event_RobotState: + if resp.Event.GetRobotState().TouchData.GetRawTouchValue() > origTouchValue+50 { + valsAboveValue++ + } else { + valsAboveValue = 0 + } + case *vectorpb.Event_WakeWord: + logger.Println("Interrupting LLM response (source: wake word)") + stopResponse = true + default: + } + if valsAboveValue > valsAboveValueMax { + logger.Println("Interrupting LLM response (source: touch sensor)") + stopResponse = true + } + if stopResponse { + stop <- true + time.Sleep(time.Second / 4) + return true + } + if stopFunc { + strm.CloseSend() + return false + } + } + } + return false +} diff --git a/chipper/pkg/wirepod/ttr/matchIntentSend.go b/chipper/pkg/wirepod/ttr/matchIntentSend.go index 7cd70bd5..58017057 100755 --- a/chipper/pkg/wirepod/ttr/matchIntentSend.go +++ b/chipper/pkg/wirepod/ttr/matchIntentSend.go @@ -9,6 +9,7 @@ import ( pb "github.com/digital-dream-labs/api/go/chipperpb" "github.com/kercre123/wire-pod/chipper/pkg/logger" + "github.com/kercre123/wire-pod/chipper/pkg/scripting" "github.com/kercre123/wire-pod/chipper/pkg/vars" "github.com/kercre123/wire-pod/chipper/pkg/vtt" ) @@ -105,8 +106,7 @@ func customIntentHandler(req interface{}, voiceText string, botSerial string) bo // Check whether the custom sentence is either at the end of the spoken text or space-separated... var seekText = strings.ToLower(strings.TrimSpace(v)) // System intents can also match any utterances (*) - if (c.IsSystemIntent && strings.HasPrefix(seekText, "*")) || - strings.HasSuffix(voiceText, seekText) || strings.Contains(voiceText, seekText+" ") { + if (c.IsSystemIntent && strings.HasPrefix(seekText, "*")) || strings.Contains(voiceText, seekText) { logger.Println("Bot " + botSerial + " Custom Intent Matched: " + c.Name + " - " + c.Description + " - " + c.Intent) var intentParams map[string]string var isParam bool = false @@ -115,6 +115,16 @@ func customIntentHandler(req interface{}, voiceText string, botSerial string) bo intentParams = map[string]string{c.Params.ParamName: c.Params.ParamValue} isParam = true } + + go func() { + if c.LuaScript != "" { + err := scripting.RunLuaScript(botSerial, c.LuaScript) + if err != nil { + logger.Println("Error running Lua script: " + err.Error()) + } + } + }() + var args []string for _, arg := range c.ExecArgs { if arg == "!botSerial" { diff --git a/chipper/webroot/css/style.css b/chipper/webroot/css/style.css index 06113661..2552317d 100755 --- a/chipper/webroot/css/style.css +++ b/chipper/webroot/css/style.css @@ -191,6 +191,9 @@ textarea { textarea:hover, textarea:focus { border-color: white; + border: 2px solid; + box-sizing: border-box; + transition: border-color 0.3s; } /* p { diff --git a/chipper/webroot/index.html b/chipper/webroot/index.html index f66231ca..bb6f6598 100755 --- a/chipper/webroot/index.html +++ b/chipper/webroot/index.html @@ -6,6 +6,9 @@ + + + @@ -58,9 +61,8 @@

- It is recommended you read - the - wiki + For more details, see + the Custom Intents page of the wiki

@@ -79,8 +81,10 @@


- +
+ +
@@ -156,34 +160,6 @@

Log


- -