Skip to content

Commit

Permalink
Merge branch 'main' of github.com:digital-dream-labs/vector-cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
dietb committed Jan 1, 2021
2 parents ef82063 + 478a319 commit 1a08770
Showing 1 changed file with 61 additions and 1 deletion.
62 changes: 61 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ Programs that make Vector talk to the cloud!

## Building

To build the binaries, you'll first need the armbuilder docker image. It can be generated by running..
To make it easy to cross-compile binaries on your computer that will
run on Vector you'll first need the armbuilder docker image. It can
be generated by running..

```
# make docker-builder
```
Expand All @@ -19,3 +22,60 @@ To build vic-gateway, run...
# make vic-gateway
```

## Example Customization

Let's have Vector refuse to give users information on Area 51 and then
explictly state that all other information requests have been approved.

First we make the following changes to `internal/voice/stream/context.go`

```diff
diff --git a/internal/voice/stream/context.go b/internal/voice/stream/context.go
index 1d5df2c..564b22f 100644
--- a/internal/voice/stream/context.go
+++ b/internal/voice/stream/context.go
@@ -1,7 +1,9 @@
package stream

import (
- "bytes"
+ "regexp"
+
+ "bytes"
"context"
"encoding/json"
"fmt"
@@ -155,6 +157,14 @@ func sendIntentResponse(resp *chipper.IntentResult, receiver Receiver) {

func sendKGResponse(resp *chipper.KnowledgeGraphResponse, receiver Receiver) {
var buf bytes.Buffer
+
+ found, _ := regexp.MatchString("area fifty one", resp.QueryText)
+ if found {
+ resp.SpokenText = "Information regarding Area Fifty One is classified. The Illuminati High Council has been notified of this request."
+ } else {
+ resp.SpokenText = "Information Request Approved. " + resp.SpokenText
+ }
+
params := map[string]string{
"answer": resp.SpokenText,
"answer_type": resp.CommandType,
```

Next compile, copy to Vector, and reboot.

```bash
grant@lord-humungus vector-cloud % make vic-cloud
echo `go version` && cd /Users/grant/src/vector-cloud && go mod download
... BUILD LOG OUTPUT ...
Packed 1 file.
grant@lh % ssh root@<VECTOR_IP> mount -o remount,rw /
grant@lh % scp build/vic-cloud root@<VECTOR_IP>:/anki/bin
vic-cloud 100% 4800KB 3.6MB/s 00:01
grant@lh %
grant@lh % ssh root@<VECTOR_IP> /sbin/reboot
```

And test after the reboot by saying "Hey Vector... Question... What is Area 51?" and
"Hey Vector... Question... What is DogeCoin?"

0 comments on commit 1a08770

Please sign in to comment.