(d map[string]interface{})
| 67 | } |
| 68 | |
| 69 | func (t *cmdProxy) handleOverview(d map[string]interface{}) { |
| 70 | c := t.newProxyClient(false) |
| 71 | |
| 72 | log.Debugf("call rpc overview to proxy %s", t.addr) |
| 73 | o, err := c.Overview() |
| 74 | if err != nil { |
| 75 | log.PanicErrorf(err, "call rpc overview to proxy %s failed", t.addr) |
| 76 | } |
| 77 | log.Debugf("call rpc overview OK") |
| 78 | |
| 79 | var cmd string |
| 80 | for _, s := range []string{"config", "model", "slots", "stats"} { |
| 81 | if d[s].(bool) { |
| 82 | cmd = s |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | var obj interface{} |
| 87 | switch cmd { |
| 88 | default: |
| 89 | obj = o |
| 90 | case "config": |
| 91 | obj = o.Config |
| 92 | case "model": |
| 93 | obj = o.Model |
| 94 | case "slots": |
| 95 | obj = o.Slots |
| 96 | case "stats": |
| 97 | obj = o.Stats |
| 98 | } |
| 99 | |
| 100 | b, err := json.MarshalIndent(obj, "", " ") |
| 101 | if err != nil { |
| 102 | log.PanicErrorf(err, "json marshal failed") |
| 103 | } |
| 104 | fmt.Println(string(b)) |
| 105 | } |
| 106 | |
| 107 | func (t *cmdProxy) handleStart(d map[string]interface{}) { |
| 108 | c := t.newProxyClient(true) |
no test coverage detected