#59 TUI docs EN+FR; key reader split (quality run #40 PASS)
Tutorial (chat from the terminal), how-tos (manage models, change the server's configuration from rzb tui), reference (rzb tui: frame, screens, keys, chat commands, tui.yaml, requests it makes), explanation (the terminal interface: second process, three channels, what stays local, editor vs forms, rejected alternatives). The rzb tui CLI section now points to the TUI reference; config_file in the HTTP reference. PosixTerminal.keys split into readKeys / nextInput (qlty function complexity 31 -> under the threshold). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b1f1dbc parent: 0c75ccb modified
.quality/history.jsonl +2 -0 | @@ -36,3 +36,5 @@ | ||
| 36 | 36 | {"branch": "feature/v0.3-tui", "breaches": [], "commit": "cb5a310", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 262, "complex": 588, "cyclo": 649, "fields": 1364, "funcs": 667, "lcom": 124, "lines": 12110, "loc": 9587}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 36, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T21:35:08Z"} |
| 37 | 37 | {"branch": "feature/v0.3-tui", "breaches": [], "commit": "64c4687", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 326, "complex": 717, "cyclo": 827, "fields": 1651, "funcs": 818, "lcom": 154, "lines": 14427, "loc": 11386}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 37, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T04:12:05Z"} |
| 38 | 38 | {"branch": "feature/v0.3-tui", "breaches": [], "commit": "d628c4a", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 343, "complex": 815, "cyclo": 943, "fields": 1789, "funcs": 892, "lcom": 163, "lines": 15636, "loc": 12375}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 38, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T04:37:14Z"} |
| 39 | +{"branch": "feature/v0.3-tui", "breaches": ["code smells: 1 (max 0)"], "commit": "0c75ccb", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": false, "metrics": {"classes": 366, "complex": 906, "cyclo": 1049, "fields": 1938, "funcs": 968, "lcom": 175, "lines": 17068, "loc": 13574}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 39, "smells": 1, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T05:12:36Z"} | |
| 40 | +{"branch": "feature/v0.3-tui", "breaches": [], "commit": "0c75ccb", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 367, "complex": 890, "cyclo": 1053, "fields": 1938, "funcs": 970, "lcom": 175, "lines": 17092, "loc": 13589}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 40, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T05:13:16Z"} | |
| @@ -36,3 +36,5 @@ | |||
| 36 | {"branch": "feature/v0.3-tui", "breaches": [], "commit": "cb5a310", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 262, "complex": 588, "cyclo": 649, "fields": 1364, "funcs": 667, "lcom": 124, "lines": 12110, "loc": 9587}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 36, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T21:35:08Z"} | 36 | {"branch": "feature/v0.3-tui", "breaches": [], "commit": "cb5a310", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 262, "complex": 588, "cyclo": 649, "fields": 1364, "funcs": 667, "lcom": 124, "lines": 12110, "loc": 9587}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 36, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-26T21:35:08Z"} |
| 37 | {"branch": "feature/v0.3-tui", "breaches": [], "commit": "64c4687", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 326, "complex": 717, "cyclo": 827, "fields": 1651, "funcs": 818, "lcom": 154, "lines": 14427, "loc": 11386}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 37, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T04:12:05Z"} | 37 | {"branch": "feature/v0.3-tui", "breaches": [], "commit": "64c4687", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 326, "complex": 717, "cyclo": 827, "fields": 1651, "funcs": 818, "lcom": 154, "lines": 14427, "loc": 11386}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 37, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T04:12:05Z"} |
| 38 | {"branch": "feature/v0.3-tui", "breaches": [], "commit": "d628c4a", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 343, "complex": 815, "cyclo": 943, "fields": 1789, "funcs": 892, "lcom": 163, "lines": 15636, "loc": 12375}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 38, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T04:37:14Z"} | 38 | {"branch": "feature/v0.3-tui", "breaches": [], "commit": "d628c4a", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 343, "complex": 815, "cyclo": 943, "fields": 1789, "funcs": 892, "lcom": 163, "lines": 15636, "loc": 12375}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 38, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T04:37:14Z"} |
| 39 | +{"branch": "feature/v0.3-tui", "breaches": ["code smells: 1 (max 0)"], "commit": "0c75ccb", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": false, "metrics": {"classes": 366, "complex": 906, "cyclo": 1049, "fields": 1938, "funcs": 968, "lcom": 175, "lines": 17068, "loc": 13574}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 39, "smells": 1, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T05:12:36Z"} | ||
| 40 | +{"branch": "feature/v0.3-tui", "breaches": [], "commit": "0c75ccb", "counts": {}, "gate": {"max_error": 0, "max_smells": 0, "max_warning": 0}, "gate_passed": true, "metrics": {"classes": 367, "complex": 890, "cyclo": 1053, "fields": 1938, "funcs": 970, "lcom": 175, "lines": 17092, "loc": 13589}, "qlty_version": "qlty 0.672.0 linux-arm64 (4362b62 2026-11-20)", "run": 40, "smells": 0, "swiftlint_version": "0.65.1", "timestamp": "2026-11-27T05:13:16Z"} | ||
added
.quality/report-20261127T051236Z.md +79 -0 | new file mode 100644 | ||
| @@ -0,0 +1,79 @@ | ||
| 1 | +# Quality report — 2026-11-27T05:12:36Z | |
| 2 | + | |
| 3 | +- **Gate**: ❌ **FAIL** | |
| 4 | +- **Commit**: `0c75ccb` on `feature/v0.3-tui` | |
| 5 | +- **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20) | |
| 6 | +- **swiftlint**: 0.65.1 (run directly, merged into lint issues) | |
| 7 | +- **Run**: #39 (previous: 2026-11-27T04:37:14Z) | |
| 8 | + | |
| 9 | +## Gate violations | |
| 10 | + | |
| 11 | +- code smells: 1 (max 0) | |
| 12 | + | |
| 13 | +## Lint issues (`qlty check`) | |
| 14 | + | |
| 15 | +_none_ | |
| 16 | + | |
| 17 | +### Top rules | |
| 18 | + | |
| 19 | +_none_ | |
| 20 | + | |
| 21 | +### Most affected files | |
| 22 | + | |
| 23 | +_none_ | |
| 24 | + | |
| 25 | +## Code smells (`qlty smells`) | |
| 26 | + | |
| 27 | +Total: **1** (vs previous: +1) | |
| 28 | + | |
| 29 | +| smell | file | line | detail | | |
| 30 | +|---|---|---|---| | |
| 31 | +| qlty:function-complexity | Sources/RazorbillTUI/Terminal.swift | 79 | Function with high complexity (count = 31): keys | | |
| 32 | + | |
| 33 | +## Metrics (`qlty metrics`) | |
| 34 | + | |
| 35 | +| metric | total | vs previous | | |
| 36 | +|---|---|---| | |
| 37 | +| funcs | 968 | +76 | | |
| 38 | +| classes | 366 | +23 | | |
| 39 | +| fields | 1938 | +149 | | |
| 40 | +| cyclo | 1049 | +106 | | |
| 41 | +| complex | 906 | +91 | | |
| 42 | +| lcom | 175 | +12 | | |
| 43 | +| lines | 17068 | +1432 | | |
| 44 | +| loc | 13574 | +1199 | | |
| 45 | + | |
| 46 | +### Most complex files | |
| 47 | + | |
| 48 | +| file | complex | cyclo | loc | | |
| 49 | +|---|---|---|---| | |
| 50 | +| Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 | | |
| 51 | +| Sources/RazorbillTUI/Terminal.swift | 36 | 14 | 124 | | |
| 52 | +| Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 | | |
| 53 | +| Sources/RazorbillTUI/ChatScreen.swift | 28 | 38 | 219 | | |
| 54 | +| experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 | | |
| 55 | +| Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 | | |
| 56 | +| Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 | | |
| 57 | +| Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 135 | | |
| 58 | +| tools/host-runner/host_runner.py | 23 | 23 | 144 | | |
| 59 | +| Sources/RazorbillCore/Config/TUIPreferences.swift | 21 | 20 | 152 | | |
| 60 | +| Sources/RazorbillTUI/TUIApp.swift | 21 | 35 | 224 | | |
| 61 | +| Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 | | |
| 62 | +| Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 | | |
| 63 | +| Sources/RazorbillTUI/DashboardScreen.swift | 19 | 17 | 109 | | |
| 64 | +| Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 | | |
| 65 | + | |
| 66 | +## Trend | |
| 67 | + | |
| 68 | +| run | timestamp | error | warning | smells | complex | gate | | |
| 69 | +|---|---|---|---|---|---|---| | |
| 70 | +| 30 | 2026-11-26T05:21:18Z | 0 | 0 | 0 | 546 | PASS | | |
| 71 | +| 31 | 2026-11-26T07:11:39Z | 0 | 0 | 0 | 546 | PASS | | |
| 72 | +| 32 | 2026-11-26T07:29:39Z | 0 | 0 | 0 | 547 | PASS | | |
| 73 | +| 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS | | |
| 74 | +| 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS | | |
| 75 | +| 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS | | |
| 76 | +| 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS | | |
| 77 | +| 37 | 2026-11-27T04:12:05Z | 0 | 0 | 0 | 717 | PASS | | |
| 78 | +| 38 | 2026-11-27T04:37:14Z | 0 | 0 | 0 | 815 | PASS | | |
| 79 | +| 39 | 2026-11-27T05:12:36Z | 0 | 0 | 1 | 906 | FAIL | | |
| new file mode 100644 | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | +# Quality report — 2026-11-27T05:12:36Z | ||
| 2 | + | ||
| 3 | +- **Gate**: ❌ **FAIL** | ||
| 4 | +- **Commit**: `0c75ccb` on `feature/v0.3-tui` | ||
| 5 | +- **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20) | ||
| 6 | +- **swiftlint**: 0.65.1 (run directly, merged into lint issues) | ||
| 7 | +- **Run**: #39 (previous: 2026-11-27T04:37:14Z) | ||
| 8 | + | ||
| 9 | +## Gate violations | ||
| 10 | + | ||
| 11 | +- code smells: 1 (max 0) | ||
| 12 | + | ||
| 13 | +## Lint issues (`qlty check`) | ||
| 14 | + | ||
| 15 | +_none_ | ||
| 16 | + | ||
| 17 | +### Top rules | ||
| 18 | + | ||
| 19 | +_none_ | ||
| 20 | + | ||
| 21 | +### Most affected files | ||
| 22 | + | ||
| 23 | +_none_ | ||
| 24 | + | ||
| 25 | +## Code smells (`qlty smells`) | ||
| 26 | + | ||
| 27 | +Total: **1** (vs previous: +1) | ||
| 28 | + | ||
| 29 | +| smell | file | line | detail | | ||
| 30 | +|---|---|---|---| | ||
| 31 | +| qlty:function-complexity | Sources/RazorbillTUI/Terminal.swift | 79 | Function with high complexity (count = 31): keys | | ||
| 32 | + | ||
| 33 | +## Metrics (`qlty metrics`) | ||
| 34 | + | ||
| 35 | +| metric | total | vs previous | | ||
| 36 | +|---|---|---| | ||
| 37 | +| funcs | 968 | +76 | | ||
| 38 | +| classes | 366 | +23 | | ||
| 39 | +| fields | 1938 | +149 | | ||
| 40 | +| cyclo | 1049 | +106 | | ||
| 41 | +| complex | 906 | +91 | | ||
| 42 | +| lcom | 175 | +12 | | ||
| 43 | +| lines | 17068 | +1432 | | ||
| 44 | +| loc | 13574 | +1199 | | ||
| 45 | + | ||
| 46 | +### Most complex files | ||
| 47 | + | ||
| 48 | +| file | complex | cyclo | loc | | ||
| 49 | +|---|---|---|---| | ||
| 50 | +| Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 | | ||
| 51 | +| Sources/RazorbillTUI/Terminal.swift | 36 | 14 | 124 | | ||
| 52 | +| Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 | | ||
| 53 | +| Sources/RazorbillTUI/ChatScreen.swift | 28 | 38 | 219 | | ||
| 54 | +| experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 | | ||
| 55 | +| Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 | | ||
| 56 | +| Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 | | ||
| 57 | +| Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 135 | | ||
| 58 | +| tools/host-runner/host_runner.py | 23 | 23 | 144 | | ||
| 59 | +| Sources/RazorbillCore/Config/TUIPreferences.swift | 21 | 20 | 152 | | ||
| 60 | +| Sources/RazorbillTUI/TUIApp.swift | 21 | 35 | 224 | | ||
| 61 | +| Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 | | ||
| 62 | +| Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 | | ||
| 63 | +| Sources/RazorbillTUI/DashboardScreen.swift | 19 | 17 | 109 | | ||
| 64 | +| Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 | | ||
| 65 | + | ||
| 66 | +## Trend | ||
| 67 | + | ||
| 68 | +| run | timestamp | error | warning | smells | complex | gate | | ||
| 69 | +|---|---|---|---|---|---|---| | ||
| 70 | +| 30 | 2026-11-26T05:21:18Z | 0 | 0 | 0 | 546 | PASS | | ||
| 71 | +| 31 | 2026-11-26T07:11:39Z | 0 | 0 | 0 | 546 | PASS | | ||
| 72 | +| 32 | 2026-11-26T07:29:39Z | 0 | 0 | 0 | 547 | PASS | | ||
| 73 | +| 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS | | ||
| 74 | +| 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS | | ||
| 75 | +| 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS | | ||
| 76 | +| 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS | | ||
| 77 | +| 37 | 2026-11-27T04:12:05Z | 0 | 0 | 0 | 717 | PASS | | ||
| 78 | +| 38 | 2026-11-27T04:37:14Z | 0 | 0 | 0 | 815 | PASS | | ||
| 79 | +| 39 | 2026-11-27T05:12:36Z | 0 | 0 | 1 | 906 | FAIL | | ||
added
.quality/report-20261127T051316Z.md +73 -0 | new file mode 100644 | ||
| @@ -0,0 +1,73 @@ | ||
| 1 | +# Quality report — 2026-11-27T05:13:16Z | |
| 2 | + | |
| 3 | +- **Gate**: ✅ **PASS** | |
| 4 | +- **Commit**: `0c75ccb` on `feature/v0.3-tui` | |
| 5 | +- **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20) | |
| 6 | +- **swiftlint**: 0.65.1 (run directly, merged into lint issues) | |
| 7 | +- **Run**: #40 (previous: 2026-11-27T05:12:36Z) | |
| 8 | + | |
| 9 | +## Lint issues (`qlty check`) | |
| 10 | + | |
| 11 | +_none_ | |
| 12 | + | |
| 13 | +### Top rules | |
| 14 | + | |
| 15 | +_none_ | |
| 16 | + | |
| 17 | +### Most affected files | |
| 18 | + | |
| 19 | +_none_ | |
| 20 | + | |
| 21 | +## Code smells (`qlty smells`) | |
| 22 | + | |
| 23 | +Total: **0** (vs previous: -1) | |
| 24 | + | |
| 25 | +_none_ | |
| 26 | + | |
| 27 | +## Metrics (`qlty metrics`) | |
| 28 | + | |
| 29 | +| metric | total | vs previous | | |
| 30 | +|---|---|---| | |
| 31 | +| funcs | 970 | +2 | | |
| 32 | +| classes | 367 | +1 | | |
| 33 | +| fields | 1938 | ±0 | | |
| 34 | +| cyclo | 1053 | +4 | | |
| 35 | +| complex | 890 | -16 | | |
| 36 | +| lcom | 175 | ±0 | | |
| 37 | +| lines | 17092 | +24 | | |
| 38 | +| loc | 13589 | +15 | | |
| 39 | + | |
| 40 | +### Most complex files | |
| 41 | + | |
| 42 | +| file | complex | cyclo | loc | | |
| 43 | +|---|---|---|---| | |
| 44 | +| Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 | | |
| 45 | +| Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 | | |
| 46 | +| Sources/RazorbillTUI/ChatScreen.swift | 28 | 38 | 219 | | |
| 47 | +| experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 | | |
| 48 | +| Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 | | |
| 49 | +| Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 | | |
| 50 | +| Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 135 | | |
| 51 | +| tools/host-runner/host_runner.py | 23 | 23 | 144 | | |
| 52 | +| Sources/RazorbillCore/Config/TUIPreferences.swift | 21 | 20 | 152 | | |
| 53 | +| Sources/RazorbillTUI/TUIApp.swift | 21 | 35 | 224 | | |
| 54 | +| Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 | | |
| 55 | +| Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 | | |
| 56 | +| Sources/RazorbillTUI/Terminal.swift | 20 | 18 | 139 | | |
| 57 | +| Sources/RazorbillTUI/DashboardScreen.swift | 19 | 17 | 109 | | |
| 58 | +| Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 | | |
| 59 | + | |
| 60 | +## Trend | |
| 61 | + | |
| 62 | +| run | timestamp | error | warning | smells | complex | gate | | |
| 63 | +|---|---|---|---|---|---|---| | |
| 64 | +| 31 | 2026-11-26T07:11:39Z | 0 | 0 | 0 | 546 | PASS | | |
| 65 | +| 32 | 2026-11-26T07:29:39Z | 0 | 0 | 0 | 547 | PASS | | |
| 66 | +| 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS | | |
| 67 | +| 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS | | |
| 68 | +| 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS | | |
| 69 | +| 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS | | |
| 70 | +| 37 | 2026-11-27T04:12:05Z | 0 | 0 | 0 | 717 | PASS | | |
| 71 | +| 38 | 2026-11-27T04:37:14Z | 0 | 0 | 0 | 815 | PASS | | |
| 72 | +| 39 | 2026-11-27T05:12:36Z | 0 | 0 | 1 | 906 | FAIL | | |
| 73 | +| 40 | 2026-11-27T05:13:16Z | 0 | 0 | 0 | 890 | PASS | | |
| new file mode 100644 | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | +# Quality report — 2026-11-27T05:13:16Z | ||
| 2 | + | ||
| 3 | +- **Gate**: ✅ **PASS** | ||
| 4 | +- **Commit**: `0c75ccb` on `feature/v0.3-tui` | ||
| 5 | +- **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20) | ||
| 6 | +- **swiftlint**: 0.65.1 (run directly, merged into lint issues) | ||
| 7 | +- **Run**: #40 (previous: 2026-11-27T05:12:36Z) | ||
| 8 | + | ||
| 9 | +## Lint issues (`qlty check`) | ||
| 10 | + | ||
| 11 | +_none_ | ||
| 12 | + | ||
| 13 | +### Top rules | ||
| 14 | + | ||
| 15 | +_none_ | ||
| 16 | + | ||
| 17 | +### Most affected files | ||
| 18 | + | ||
| 19 | +_none_ | ||
| 20 | + | ||
| 21 | +## Code smells (`qlty smells`) | ||
| 22 | + | ||
| 23 | +Total: **0** (vs previous: -1) | ||
| 24 | + | ||
| 25 | +_none_ | ||
| 26 | + | ||
| 27 | +## Metrics (`qlty metrics`) | ||
| 28 | + | ||
| 29 | +| metric | total | vs previous | | ||
| 30 | +|---|---|---| | ||
| 31 | +| funcs | 970 | +2 | | ||
| 32 | +| classes | 367 | +1 | | ||
| 33 | +| fields | 1938 | ±0 | | ||
| 34 | +| cyclo | 1053 | +4 | | ||
| 35 | +| complex | 890 | -16 | | ||
| 36 | +| lcom | 175 | ±0 | | ||
| 37 | +| lines | 17092 | +24 | | ||
| 38 | +| loc | 13589 | +15 | | ||
| 39 | + | ||
| 40 | +### Most complex files | ||
| 41 | + | ||
| 42 | +| file | complex | cyclo | loc | | ||
| 43 | +|---|---|---|---| | ||
| 44 | +| Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 | | ||
| 45 | +| Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 | | ||
| 46 | +| Sources/RazorbillTUI/ChatScreen.swift | 28 | 38 | 219 | | ||
| 47 | +| experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 | | ||
| 48 | +| Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 | | ||
| 49 | +| Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 | | ||
| 50 | +| Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 135 | | ||
| 51 | +| tools/host-runner/host_runner.py | 23 | 23 | 144 | | ||
| 52 | +| Sources/RazorbillCore/Config/TUIPreferences.swift | 21 | 20 | 152 | | ||
| 53 | +| Sources/RazorbillTUI/TUIApp.swift | 21 | 35 | 224 | | ||
| 54 | +| Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 | | ||
| 55 | +| Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 | | ||
| 56 | +| Sources/RazorbillTUI/Terminal.swift | 20 | 18 | 139 | | ||
| 57 | +| Sources/RazorbillTUI/DashboardScreen.swift | 19 | 17 | 109 | | ||
| 58 | +| Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 | | ||
| 59 | + | ||
| 60 | +## Trend | ||
| 61 | + | ||
| 62 | +| run | timestamp | error | warning | smells | complex | gate | | ||
| 63 | +|---|---|---|---|---|---|---| | ||
| 64 | +| 31 | 2026-11-26T07:11:39Z | 0 | 0 | 0 | 546 | PASS | | ||
| 65 | +| 32 | 2026-11-26T07:29:39Z | 0 | 0 | 0 | 547 | PASS | | ||
| 66 | +| 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS | | ||
| 67 | +| 34 | 2026-11-26T14:17:19Z | 0 | 0 | 0 | 547 | PASS | | ||
| 68 | +| 35 | 2026-11-26T14:42:16Z | 0 | 0 | 0 | 548 | PASS | | ||
| 69 | +| 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS | | ||
| 70 | +| 37 | 2026-11-27T04:12:05Z | 0 | 0 | 0 | 717 | PASS | | ||
| 71 | +| 38 | 2026-11-27T04:37:14Z | 0 | 0 | 0 | 815 | PASS | | ||
| 72 | +| 39 | 2026-11-27T05:12:36Z | 0 | 0 | 1 | 906 | FAIL | | ||
| 73 | +| 40 | 2026-11-27T05:13:16Z | 0 | 0 | 0 | 890 | PASS | | ||
modified
.quality/report-latest.md +19 -19 | @@ -1,10 +1,10 @@ | ||
| 1 | -# Quality report — 2026-11-27T04:37:14Z | |
| 1 | +# Quality report — 2026-11-27T05:13:16Z | |
| 2 | 2 | |
| 3 | 3 | - **Gate**: ✅ **PASS** |
| 4 | -- **Commit**: `d628c4a` on `feature/v0.3-tui` | |
| 4 | +- **Commit**: `0c75ccb` on `feature/v0.3-tui` | |
| 5 | 5 | - **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20) |
| 6 | 6 | - **swiftlint**: 0.65.1 (run directly, merged into lint issues) |
| 7 | -- **Run**: #38 (previous: 2026-11-27T04:12:05Z) | |
| 7 | +- **Run**: #40 (previous: 2026-11-27T05:12:36Z) | |
| 8 | 8 | |
| 9 | 9 | ## Lint issues (`qlty check`) |
| 10 | 10 | |
| @@ -20,7 +20,7 @@ _none_ | ||
| 20 | 20 | |
| 21 | 21 | ## Code smells (`qlty smells`) |
| 22 | 22 | |
| 23 | -Total: **0** (vs previous: ±0) | |
| 23 | +Total: **0** (vs previous: -1) | |
| 24 | 24 | |
| 25 | 25 | _none_ |
| 26 | 26 | |
| @@ -28,14 +28,14 @@ _none_ | ||
| 28 | 28 | |
| 29 | 29 | | metric | total | vs previous | |
| 30 | 30 | |---|---|---| |
| 31 | -| funcs | 892 | +74 | | |
| 32 | -| classes | 343 | +17 | | |
| 33 | -| fields | 1789 | +138 | | |
| 34 | -| cyclo | 943 | +116 | | |
| 35 | -| complex | 815 | +98 | | |
| 36 | -| lcom | 163 | +9 | | |
| 37 | -| lines | 15636 | +1209 | | |
| 38 | -| loc | 12375 | +989 | | |
| 31 | +| funcs | 970 | +2 | | |
| 32 | +| classes | 367 | +1 | | |
| 33 | +| fields | 1938 | ±0 | | |
| 34 | +| cyclo | 1053 | +4 | | |
| 35 | +| complex | 890 | -16 | | |
| 36 | +| lcom | 175 | ±0 | | |
| 37 | +| lines | 17092 | +24 | | |
| 38 | +| loc | 13589 | +15 | | |
| 39 | 39 | |
| 40 | 40 | ### Most complex files |
| 41 | 41 | |
| @@ -43,26 +43,24 @@ _none_ | ||
| 43 | 43 | |---|---|---|---| |
| 44 | 44 | | Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 | |
| 45 | 45 | | Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 | |
| 46 | -| Sources/RazorbillTUI/ChatScreen.swift | 27 | 37 | 212 | | |
| 46 | +| Sources/RazorbillTUI/ChatScreen.swift | 28 | 38 | 219 | | |
| 47 | 47 | | experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 | |
| 48 | 48 | | Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 | |
| 49 | 49 | | Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 | |
| 50 | -| Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 134 | | |
| 50 | +| Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 135 | | |
| 51 | 51 | | tools/host-runner/host_runner.py | 23 | 23 | 144 | |
| 52 | +| Sources/RazorbillCore/Config/TUIPreferences.swift | 21 | 20 | 152 | | |
| 53 | +| Sources/RazorbillTUI/TUIApp.swift | 21 | 35 | 224 | | |
| 52 | 54 | | Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 | |
| 53 | 55 | | Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 | |
| 54 | -| Sources/RazorbillTUI/Terminal.swift | 20 | 10 | 99 | | |
| 56 | +| Sources/RazorbillTUI/Terminal.swift | 20 | 18 | 139 | | |
| 55 | 57 | | Sources/RazorbillTUI/DashboardScreen.swift | 19 | 17 | 109 | |
| 56 | -| Sources/RazorbillTUI/TUIApp.swift | 19 | 31 | 204 | | |
| 57 | 58 | | Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 | |
| 58 | -| Sources/RazorbillServer/Chat/ChatCompletionRequest.swift | 17 | 24 | 276 | | |
| 59 | 59 | |
| 60 | 60 | ## Trend |
| 61 | 61 | |
| 62 | 62 | | run | timestamp | error | warning | smells | complex | gate | |
| 63 | 63 | |---|---|---|---|---|---|---| |
| 64 | -| 29 | 2026-11-26T04:34:58Z | 0 | 0 | 0 | 546 | PASS | | |
| 65 | -| 30 | 2026-11-26T05:21:18Z | 0 | 0 | 0 | 546 | PASS | | |
| 66 | 64 | | 31 | 2026-11-26T07:11:39Z | 0 | 0 | 0 | 546 | PASS | |
| 67 | 65 | | 32 | 2026-11-26T07:29:39Z | 0 | 0 | 0 | 547 | PASS | |
| 68 | 66 | | 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS | |
| @@ -71,3 +69,5 @@ _none_ | ||
| 71 | 69 | | 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS | |
| 72 | 70 | | 37 | 2026-11-27T04:12:05Z | 0 | 0 | 0 | 717 | PASS | |
| 73 | 71 | | 38 | 2026-11-27T04:37:14Z | 0 | 0 | 0 | 815 | PASS | |
| 72 | +| 39 | 2026-11-27T05:12:36Z | 0 | 0 | 1 | 906 | FAIL | | |
| 73 | +| 40 | 2026-11-27T05:13:16Z | 0 | 0 | 0 | 890 | PASS | | |
| @@ -1,10 +1,10 @@ | |||
| 1 | -# Quality report — 2026-11-27T04:37:14Z | 1 | +# Quality report — 2026-11-27T05:13:16Z |
| 2 | 2 | ||
| 3 | - **Gate**: ✅ **PASS** | 3 | - **Gate**: ✅ **PASS** |
| 4 | -- **Commit**: `d628c4a` on `feature/v0.3-tui` | 4 | +- **Commit**: `0c75ccb` on `feature/v0.3-tui` |
| 5 | - **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20) | 5 | - **qlty**: qlty 0.672.0 linux-arm64 (4362b62 2026-11-20) |
| 6 | - **swiftlint**: 0.65.1 (run directly, merged into lint issues) | 6 | - **swiftlint**: 0.65.1 (run directly, merged into lint issues) |
| 7 | -- **Run**: #38 (previous: 2026-11-27T04:12:05Z) | 7 | +- **Run**: #40 (previous: 2026-11-27T05:12:36Z) |
| 8 | 8 | ||
| 9 | ## Lint issues (`qlty check`) | 9 | ## Lint issues (`qlty check`) |
| 10 | 10 | ||
| @@ -20,7 +20,7 @@ _none_ | |||
| 20 | 20 | ||
| 21 | ## Code smells (`qlty smells`) | 21 | ## Code smells (`qlty smells`) |
| 22 | 22 | ||
| 23 | -Total: **0** (vs previous: ±0) | 23 | +Total: **0** (vs previous: -1) |
| 24 | 24 | ||
| 25 | _none_ | 25 | _none_ |
| 26 | 26 | ||
| @@ -28,14 +28,14 @@ _none_ | |||
| 28 | 28 | ||
| 29 | | metric | total | vs previous | | 29 | | metric | total | vs previous | |
| 30 | |---|---|---| | 30 | |---|---|---| |
| 31 | -| funcs | 892 | +74 | | 31 | +| funcs | 970 | +2 | |
| 32 | -| classes | 343 | +17 | | 32 | +| classes | 367 | +1 | |
| 33 | -| fields | 1789 | +138 | | 33 | +| fields | 1938 | ±0 | |
| 34 | -| cyclo | 943 | +116 | | 34 | +| cyclo | 1053 | +4 | |
| 35 | -| complex | 815 | +98 | | 35 | +| complex | 890 | -16 | |
| 36 | -| lcom | 163 | +9 | | 36 | +| lcom | 175 | ±0 | |
| 37 | -| lines | 15636 | +1209 | | 37 | +| lines | 17092 | +24 | |
| 38 | -| loc | 12375 | +989 | | 38 | +| loc | 13589 | +15 | |
| 39 | 39 | ||
| 40 | ### Most complex files | 40 | ### Most complex files |
| 41 | 41 | ||
| @@ -43,26 +43,24 @@ _none_ | |||
| 43 | |---|---|---|---| | 43 | |---|---|---|---| |
| 44 | | Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 | | 44 | | Sources/RazorbillServer/CompletionsRoute.swift | 47 | 20 | 244 | |
| 45 | | Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 | | 45 | | Sources/RazorbillServer/Chat/CompletionStream.swift | 31 | 20 | 125 | |
| 46 | -| Sources/RazorbillTUI/ChatScreen.swift | 27 | 37 | 212 | | 46 | +| Sources/RazorbillTUI/ChatScreen.swift | 28 | 38 | 219 | |
| 47 | | experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 | | 47 | | experiments/02-kv-cache-reuse/Sources/KVCacheReuse/KVCacheReuse.swift | 26 | 20 | 285 | |
| 48 | | Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 | | 48 | | Sources/RazorbillServer/ModelManager.swift | 25 | 26 | 268 | |
| 49 | | Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 | | 49 | | Sources/RazorbillMLX/MLXEngine.swift | 23 | 35 | 246 | |
| 50 | -| Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 134 | | 50 | +| Sources/RazorbillTUI/ServerAPI.swift | 23 | 23 | 135 | |
| 51 | | tools/host-runner/host_runner.py | 23 | 23 | 144 | | 51 | | tools/host-runner/host_runner.py | 23 | 23 | 144 | |
| 52 | +| Sources/RazorbillCore/Config/TUIPreferences.swift | 21 | 20 | 152 | | ||
| 53 | +| Sources/RazorbillTUI/TUIApp.swift | 21 | 35 | 224 | | ||
| 52 | | Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 | | 54 | | Sources/RazorbillCore/Config/ConfigValue+JSON.swift | 20 | 25 | 71 | |
| 53 | | Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 | | 55 | | Sources/RazorbillCore/Config/ServerConfigLoader.swift | 20 | 17 | 227 | |
| 54 | -| Sources/RazorbillTUI/Terminal.swift | 20 | 10 | 99 | | 56 | +| Sources/RazorbillTUI/Terminal.swift | 20 | 18 | 139 | |
| 55 | | Sources/RazorbillTUI/DashboardScreen.swift | 19 | 17 | 109 | | 57 | | Sources/RazorbillTUI/DashboardScreen.swift | 19 | 17 | 109 | |
| 56 | -| Sources/RazorbillTUI/TUIApp.swift | 19 | 31 | 204 | | ||
| 57 | | Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 | | 58 | | Sources/RazorbillServer/Chat/ToolsAndFormats.swift | 18 | 30 | 170 | |
| 58 | -| Sources/RazorbillServer/Chat/ChatCompletionRequest.swift | 17 | 24 | 276 | | ||
| 59 | 59 | ||
| 60 | ## Trend | 60 | ## Trend |
| 61 | 61 | ||
| 62 | | run | timestamp | error | warning | smells | complex | gate | | 62 | | run | timestamp | error | warning | smells | complex | gate | |
| 63 | |---|---|---|---|---|---|---| | 63 | |---|---|---|---|---|---|---| |
| 64 | -| 29 | 2026-11-26T04:34:58Z | 0 | 0 | 0 | 546 | PASS | | ||
| 65 | -| 30 | 2026-11-26T05:21:18Z | 0 | 0 | 0 | 546 | PASS | | ||
| 66 | | 31 | 2026-11-26T07:11:39Z | 0 | 0 | 0 | 546 | PASS | | 64 | | 31 | 2026-11-26T07:11:39Z | 0 | 0 | 0 | 546 | PASS | |
| 67 | | 32 | 2026-11-26T07:29:39Z | 0 | 0 | 0 | 547 | PASS | | 65 | | 32 | 2026-11-26T07:29:39Z | 0 | 0 | 0 | 547 | PASS | |
| 68 | | 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS | | 66 | | 33 | 2026-11-26T14:05:13Z | 0 | 0 | 0 | 547 | PASS | |
| @@ -71,3 +69,5 @@ _none_ | |||
| 71 | | 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS | | 69 | | 36 | 2026-11-26T21:35:08Z | 0 | 0 | 0 | 588 | PASS | |
| 72 | | 37 | 2026-11-27T04:12:05Z | 0 | 0 | 0 | 717 | PASS | | 70 | | 37 | 2026-11-27T04:12:05Z | 0 | 0 | 0 | 717 | PASS | |
| 73 | | 38 | 2026-11-27T04:37:14Z | 0 | 0 | 0 | 815 | PASS | | 71 | | 38 | 2026-11-27T04:37:14Z | 0 | 0 | 0 | 815 | PASS | |
| 72 | +| 39 | 2026-11-27T05:12:36Z | 0 | 0 | 1 | 906 | FAIL | | ||
| 73 | +| 40 | 2026-11-27T05:13:16Z | 0 | 0 | 0 | 890 | PASS | | ||
modified
Sources/RazorbillTUI/Terminal.swift +44 -20 | @@ -84,26 +84,7 @@ public final class PosixTerminal: Terminal, @unchecked Sendable { | ||
| 84 | 84 | resize.resume() |
| 85 | 85 | resizeSource = resize |
| 86 | 86 | let reader = Thread { |
| 87 | - var decoder = KeyDecoder() | |
| 88 | - var buffer = [UInt8](repeating: 0, count: 256) | |
| 89 | - while true { | |
| 90 | - // Wait for input in short slices, so a pause takes effect before the next read. | |
| 91 | - if self.lock.withLock({ self.paused }) { | |
| 92 | - usleep(20_000) | |
| 93 | - continue | |
| 94 | - } | |
| 95 | - var watched = pollfd(fd: STDIN_FILENO, events: Int16(POLLIN), revents: 0) | |
| 96 | - let ready = poll(&watched, 1, 50) | |
| 97 | - if ready == 0 || (ready < 0 && errno == EINTR) { continue } | |
| 98 | - if ready < 0 { break } | |
| 99 | - if self.lock.withLock({ self.paused }) { continue } | |
| 100 | - let count = read(STDIN_FILENO, &buffer, buffer.count) | |
| 101 | - if count < 0, errno == EINTR { continue } | |
| 102 | - if count <= 0 { break } | |
| 103 | - var keys = decoder.decode(Array(buffer[0 ..< count])) | |
| 104 | - keys += decoder.flush() // a lone ESC read alone is the Escape key | |
| 105 | - for key in keys { continuation.yield(key) } | |
| 106 | - } | |
| 87 | + self.readKeys { continuation.yield($0) } | |
| 107 | 88 | self.resizeSource?.cancel() |
| 108 | 89 | continuation.finish() |
| 109 | 90 | } |
| @@ -111,6 +92,49 @@ public final class PosixTerminal: Terminal, @unchecked Sendable { | ||
| 111 | 92 | } |
| 112 | 93 | } |
| 113 | 94 | |
| 95 | + /// What one turn of the key reader found on standard input. | |
| 96 | + private enum Input { | |
| 97 | + case bytes([UInt8]) | |
| 98 | + /// Nothing yet, or paused: look again. | |
| 99 | + case nothing | |
| 100 | + /// Standard input closed or failed. | |
| 101 | + case ended | |
| 102 | + } | |
| 103 | + | |
| 104 | + /// Reads and decodes keys until standard input ends. | |
| 105 | + private func readKeys(_ yield: (Key) -> Void) { | |
| 106 | + var decoder = KeyDecoder() | |
| 107 | + while true { | |
| 108 | + switch nextInput() { | |
| 109 | + case .ended: | |
| 110 | + return | |
| 111 | + case .nothing: | |
| 112 | + continue | |
| 113 | + case .bytes(let bytes): | |
| 114 | + // A lone ESC read alone is the Escape key. | |
| 115 | + for key in decoder.decode(bytes) + decoder.flush() { yield(key) } | |
| 116 | + } | |
| 117 | + } | |
| 118 | + } | |
| 119 | + | |
| 120 | + /// Waits for input in short slices, so a pause takes effect before the next read. | |
| 121 | + private func nextInput() -> Input { | |
| 122 | + if isPaused { | |
| 123 | + usleep(20_000) | |
| 124 | + return .nothing | |
| 125 | + } | |
| 126 | + var watched = pollfd(fd: STDIN_FILENO, events: Int16(POLLIN), revents: 0) | |
| 127 | + let ready = poll(&watched, 1, 50) | |
| 128 | + if ready < 0 { return errno == EINTR ? .nothing : .ended } | |
| 129 | + if ready == 0 || isPaused { return .nothing } | |
| 130 | + var buffer = [UInt8](repeating: 0, count: 256) | |
| 131 | + let count = read(STDIN_FILENO, &buffer, buffer.count) | |
| 132 | + if count < 0 { return errno == EINTR ? .nothing : .ended } | |
| 133 | + return count == 0 ? .ended : .bytes(Array(buffer[0 ..< count])) | |
| 134 | + } | |
| 135 | + | |
| 136 | + private var isPaused: Bool { lock.withLock { paused } } | |
| 137 | + | |
| 114 | 138 | public func draw(_ screen: Screen) { |
| 115 | 139 | var output = "\u{1B}[?25l" // hide the cursor while drawing |
| 116 | 140 | for (row, line) in screen.lines.enumerated() { |
| @@ -84,26 +84,7 @@ public final class PosixTerminal: Terminal, @unchecked Sendable { | |||
| 84 | resize.resume() | 84 | resize.resume() |
| 85 | resizeSource = resize | 85 | resizeSource = resize |
| 86 | let reader = Thread { | 86 | let reader = Thread { |
| 87 | - var decoder = KeyDecoder() | 87 | + self.readKeys { continuation.yield($0) } |
| 88 | - var buffer = [UInt8](repeating: 0, count: 256) | ||
| 89 | - while true { | ||
| 90 | - // Wait for input in short slices, so a pause takes effect before the next read. | ||
| 91 | - if self.lock.withLock({ self.paused }) { | ||
| 92 | - usleep(20_000) | ||
| 93 | - continue | ||
| 94 | - } | ||
| 95 | - var watched = pollfd(fd: STDIN_FILENO, events: Int16(POLLIN), revents: 0) | ||
| 96 | - let ready = poll(&watched, 1, 50) | ||
| 97 | - if ready == 0 || (ready < 0 && errno == EINTR) { continue } | ||
| 98 | - if ready < 0 { break } | ||
| 99 | - if self.lock.withLock({ self.paused }) { continue } | ||
| 100 | - let count = read(STDIN_FILENO, &buffer, buffer.count) | ||
| 101 | - if count < 0, errno == EINTR { continue } | ||
| 102 | - if count <= 0 { break } | ||
| 103 | - var keys = decoder.decode(Array(buffer[0 ..< count])) | ||
| 104 | - keys += decoder.flush() // a lone ESC read alone is the Escape key | ||
| 105 | - for key in keys { continuation.yield(key) } | ||
| 106 | - } | ||
| 107 | self.resizeSource?.cancel() | 88 | self.resizeSource?.cancel() |
| 108 | continuation.finish() | 89 | continuation.finish() |
| 109 | } | 90 | } |
| @@ -111,6 +92,49 @@ public final class PosixTerminal: Terminal, @unchecked Sendable { | |||
| 111 | } | 92 | } |
| 112 | } | 93 | } |
| 113 | 94 | ||
| 95 | + /// What one turn of the key reader found on standard input. | ||
| 96 | + private enum Input { | ||
| 97 | + case bytes([UInt8]) | ||
| 98 | + /// Nothing yet, or paused: look again. | ||
| 99 | + case nothing | ||
| 100 | + /// Standard input closed or failed. | ||
| 101 | + case ended | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + /// Reads and decodes keys until standard input ends. | ||
| 105 | + private func readKeys(_ yield: (Key) -> Void) { | ||
| 106 | + var decoder = KeyDecoder() | ||
| 107 | + while true { | ||
| 108 | + switch nextInput() { | ||
| 109 | + case .ended: | ||
| 110 | + return | ||
| 111 | + case .nothing: | ||
| 112 | + continue | ||
| 113 | + case .bytes(let bytes): | ||
| 114 | + // A lone ESC read alone is the Escape key. | ||
| 115 | + for key in decoder.decode(bytes) + decoder.flush() { yield(key) } | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + /// Waits for input in short slices, so a pause takes effect before the next read. | ||
| 121 | + private func nextInput() -> Input { | ||
| 122 | + if isPaused { | ||
| 123 | + usleep(20_000) | ||
| 124 | + return .nothing | ||
| 125 | + } | ||
| 126 | + var watched = pollfd(fd: STDIN_FILENO, events: Int16(POLLIN), revents: 0) | ||
| 127 | + let ready = poll(&watched, 1, 50) | ||
| 128 | + if ready < 0 { return errno == EINTR ? .nothing : .ended } | ||
| 129 | + if ready == 0 || isPaused { return .nothing } | ||
| 130 | + var buffer = [UInt8](repeating: 0, count: 256) | ||
| 131 | + let count = read(STDIN_FILENO, &buffer, buffer.count) | ||
| 132 | + if count < 0 { return errno == EINTR ? .nothing : .ended } | ||
| 133 | + return count == 0 ? .ended : .bytes(Array(buffer[0 ..< count])) | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + private var isPaused: Bool { lock.withLock { paused } } | ||
| 137 | + | ||
| 114 | public func draw(_ screen: Screen) { | 138 | public func draw(_ screen: Screen) { |
| 115 | var output = "\u{1B}[?25l" // hide the cursor while drawing | 139 | var output = "\u{1B}[?25l" // hide the cursor while drawing |
| 116 | for (row, line) in screen.lines.enumerated() { | 140 | for (row, line) in screen.lines.enumerated() { |
modified
docs/diagrams/packages.drawio +1 -1 | @@ -95,7 +95,7 @@ | ||
| 95 | 95 | <mxCell id="e11" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;endArrow=block;strokeColor=#666666;" edge="1" parent="1" source="core" target="yams"> |
| 96 | 96 | <mxGeometry relative="1" as="geometry" /> |
| 97 | 97 | </mxCell> |
| 98 | -<mxCell id="tui" value="<b>RazorbillTUI</b><br><font style="font-size:11px">rzb tui: own ANSI/termios layer, screens, widgets, HTTP client of the server (SSE, /rzb). No MLX, no RazorbillServer.</font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;shadow=1;" vertex="1" parent="1"> | |
| 98 | +<mxCell id="tui" value="<b>RazorbillTUI</b><br><font style="font-size:11px">rzb tui: own ANSI/termios layer; Chat, Dashboard, Models, Settings screens; HTTP client of the server (SSE, /rzb); model cache and tui.yaml on disk. No MLX, no RazorbillServer.</font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;shadow=1;" vertex="1" parent="1"> | |
| 99 | 99 | <mxGeometry x="430" y="400" width="280" height="70" as="geometry" /> |
| 100 | 100 | </mxCell> |
| 101 | 101 | <mxCell id="ahc" value="<b>async-http-client</b><br><font style="font-size:11px">HTTP client of rzb tui (streamed answers)</font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1"> |
| @@ -95,7 +95,7 @@ | |||
| 95 | <mxCell id="e11" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;endArrow=block;strokeColor=#666666;" edge="1" parent="1" source="core" target="yams"> | 95 | <mxCell id="e11" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;endArrow=block;strokeColor=#666666;" edge="1" parent="1" source="core" target="yams"> |
| 96 | <mxGeometry relative="1" as="geometry" /> | 96 | <mxGeometry relative="1" as="geometry" /> |
| 97 | </mxCell> | 97 | </mxCell> |
| 98 | -<mxCell id="tui" value="<b>RazorbillTUI</b><br><font style="font-size:11px">rzb tui: own ANSI/termios layer, screens, widgets, HTTP client of the server (SSE, /rzb). No MLX, no RazorbillServer.</font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;shadow=1;" vertex="1" parent="1"> | 98 | +<mxCell id="tui" value="<b>RazorbillTUI</b><br><font style="font-size:11px">rzb tui: own ANSI/termios layer; Chat, Dashboard, Models, Settings screens; HTTP client of the server (SSE, /rzb); model cache and tui.yaml on disk. No MLX, no RazorbillServer.</font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;shadow=1;" vertex="1" parent="1"> |
| 99 | <mxGeometry x="430" y="400" width="280" height="70" as="geometry" /> | 99 | <mxGeometry x="430" y="400" width="280" height="70" as="geometry" /> |
| 100 | </mxCell> | 100 | </mxCell> |
| 101 | <mxCell id="ahc" value="<b>async-http-client</b><br><font style="font-size:11px">HTTP client of rzb tui (streamed answers)</font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1"> | 101 | <mxCell id="ahc" value="<b>async-http-client</b><br><font style="font-size:11px">HTTP client of rzb tui (streamed answers)</font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1"> |
modified
docs/en/README.md +5 -0 | @@ -7,6 +7,7 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th | ||
| 7 | 7 | ## Learn — tutorials |
| 8 | 8 | |
| 9 | 9 | - [Your first requests to a local model](tutorials/getting-started.md): download a model, start the server, call it with `curl` and with the `openai` library. |
| 10 | +- [Chat with a local model from the terminal](tutorials/chat-from-the-terminal.md): the server and `rzb tui` side by side, a conversation, the Dashboard. | |
| 10 | 11 | |
| 11 | 12 | ## Do — how-to guides |
| 12 | 13 | |
| @@ -15,6 +16,8 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th | ||
| 15 | 16 | - [Manage models](how-to/manage-models.md) |
| 16 | 17 | - [Configure the server](how-to/configure-the-server.md): model names, defaults, locks, limits, network access. |
| 17 | 18 | - [Watch and steer a running server](how-to/watch-and-steer-a-running-server.md): status, freeing a model, reloading the configuration. |
| 19 | +- [Manage models from rzb tui](how-to/manage-models-from-the-tui.md): download, remove, check the size. | |
| 20 | +- [Change the server's configuration from rzb tui](how-to/change-the-server-configuration-from-the-tui.md): edit, check and reload; the TUI's own preferences. | |
| 18 | 21 | - [Use razorbill from an OpenAI client](how-to/use-openai-clients.md): Python, JavaScript, LangChain, chat UIs. |
| 19 | 22 | - [Get structured output](how-to/get-structured-output.md) |
| 20 | 23 | - [Use function calling](how-to/use-function-calling.md) |
| @@ -28,6 +31,7 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th | ||
| 28 | 31 | - [HTTP API](reference/http-api.md): endpoints, fields supported, refused and ignored, responses, streaming, local admin routes. |
| 29 | 32 | - [Server configuration file](reference/configuration.md): every key, its type, default and errors. |
| 30 | 33 | - [Command line](reference/cli.md): `rzb serve`, `rzb tui`, `rzb models`, `rzb config validate`, exit codes. |
| 34 | +- [rzb tui](reference/tui.md): screens, keys, chat commands, the `tui.yaml` preferences file. | |
| 31 | 35 | - [API errors](reference/errors.md): statuses, types and codes. |
| 32 | 36 | |
| 33 | 37 | ## Understand — explanation |
| @@ -37,3 +41,4 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th | ||
| 37 | 41 | - [Constrained decoding](explanation/constrained-decoding.md): how JSON and tool calls are guaranteed, and the limits. |
| 38 | 42 | - [Reasoning models](explanation/thinking.md): how reasoning is separated, sent or hidden, and limited. |
| 39 | 43 | - [OpenAI compatibility](explanation/openai-compatibility.md): what "compatible" means here and how it is checked. |
| 44 | +- [The terminal interface](explanation/terminal-interface.md): why `rzb tui` is a separate process, how it reaches what it shows, what stays local. | |
| @@ -7,6 +7,7 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th | |||
| 7 | ## Learn — tutorials | 7 | ## Learn — tutorials |
| 8 | 8 | ||
| 9 | - [Your first requests to a local model](tutorials/getting-started.md): download a model, start the server, call it with `curl` and with the `openai` library. | 9 | - [Your first requests to a local model](tutorials/getting-started.md): download a model, start the server, call it with `curl` and with the `openai` library. |
| 10 | +- [Chat with a local model from the terminal](tutorials/chat-from-the-terminal.md): the server and `rzb tui` side by side, a conversation, the Dashboard. | ||
| 10 | 11 | ||
| 11 | ## Do — how-to guides | 12 | ## Do — how-to guides |
| 12 | 13 | ||
| @@ -15,6 +16,8 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th | |||
| 15 | - [Manage models](how-to/manage-models.md) | 16 | - [Manage models](how-to/manage-models.md) |
| 16 | - [Configure the server](how-to/configure-the-server.md): model names, defaults, locks, limits, network access. | 17 | - [Configure the server](how-to/configure-the-server.md): model names, defaults, locks, limits, network access. |
| 17 | - [Watch and steer a running server](how-to/watch-and-steer-a-running-server.md): status, freeing a model, reloading the configuration. | 18 | - [Watch and steer a running server](how-to/watch-and-steer-a-running-server.md): status, freeing a model, reloading the configuration. |
| 19 | +- [Manage models from rzb tui](how-to/manage-models-from-the-tui.md): download, remove, check the size. | ||
| 20 | +- [Change the server's configuration from rzb tui](how-to/change-the-server-configuration-from-the-tui.md): edit, check and reload; the TUI's own preferences. | ||
| 18 | - [Use razorbill from an OpenAI client](how-to/use-openai-clients.md): Python, JavaScript, LangChain, chat UIs. | 21 | - [Use razorbill from an OpenAI client](how-to/use-openai-clients.md): Python, JavaScript, LangChain, chat UIs. |
| 19 | - [Get structured output](how-to/get-structured-output.md) | 22 | - [Get structured output](how-to/get-structured-output.md) |
| 20 | - [Use function calling](how-to/use-function-calling.md) | 23 | - [Use function calling](how-to/use-function-calling.md) |
| @@ -28,6 +31,7 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th | |||
| 28 | - [HTTP API](reference/http-api.md): endpoints, fields supported, refused and ignored, responses, streaming, local admin routes. | 31 | - [HTTP API](reference/http-api.md): endpoints, fields supported, refused and ignored, responses, streaming, local admin routes. |
| 29 | - [Server configuration file](reference/configuration.md): every key, its type, default and errors. | 32 | - [Server configuration file](reference/configuration.md): every key, its type, default and errors. |
| 30 | - [Command line](reference/cli.md): `rzb serve`, `rzb tui`, `rzb models`, `rzb config validate`, exit codes. | 33 | - [Command line](reference/cli.md): `rzb serve`, `rzb tui`, `rzb models`, `rzb config validate`, exit codes. |
| 34 | +- [rzb tui](reference/tui.md): screens, keys, chat commands, the `tui.yaml` preferences file. | ||
| 31 | - [API errors](reference/errors.md): statuses, types and codes. | 35 | - [API errors](reference/errors.md): statuses, types and codes. |
| 32 | 36 | ||
| 33 | ## Understand — explanation | 37 | ## Understand — explanation |
| @@ -37,3 +41,4 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th | |||
| 37 | - [Constrained decoding](explanation/constrained-decoding.md): how JSON and tool calls are guaranteed, and the limits. | 41 | - [Constrained decoding](explanation/constrained-decoding.md): how JSON and tool calls are guaranteed, and the limits. |
| 38 | - [Reasoning models](explanation/thinking.md): how reasoning is separated, sent or hidden, and limited. | 42 | - [Reasoning models](explanation/thinking.md): how reasoning is separated, sent or hidden, and limited. |
| 39 | - [OpenAI compatibility](explanation/openai-compatibility.md): what "compatible" means here and how it is checked. | 43 | - [OpenAI compatibility](explanation/openai-compatibility.md): what "compatible" means here and how it is checked. |
| 44 | +- [The terminal interface](explanation/terminal-interface.md): why `rzb tui` is a separate process, how it reaches what it shows, what stays local. | ||
modified
docs/en/explanation/architecture.md +1 -0 | @@ -54,3 +54,4 @@ MLX ships Metal shaders that must be compiled into a `default.metallib`. SwiftPM | ||
| 54 | 54 | - How models are loaded, shared and unloaded: [model lifecycle](model-lifecycle.md). |
| 55 | 55 | - How JSON and tool calls are guaranteed: [constrained decoding](constrained-decoding.md). |
| 56 | 56 | - How reasoning is separated from answers: [reasoning models](thinking.md). |
| 57 | +- Why `rzb tui` is a separate process: [the terminal interface](terminal-interface.md). | |
| @@ -54,3 +54,4 @@ MLX ships Metal shaders that must be compiled into a `default.metallib`. SwiftPM | |||
| 54 | - How models are loaded, shared and unloaded: [model lifecycle](model-lifecycle.md). | 54 | - How models are loaded, shared and unloaded: [model lifecycle](model-lifecycle.md). |
| 55 | - How JSON and tool calls are guaranteed: [constrained decoding](constrained-decoding.md). | 55 | - How JSON and tool calls are guaranteed: [constrained decoding](constrained-decoding.md). |
| 56 | - How reasoning is separated from answers: [reasoning models](thinking.md). | 56 | - How reasoning is separated from answers: [reasoning models](thinking.md). |
| 57 | +- Why `rzb tui` is a separate process: [the terminal interface](terminal-interface.md). | ||
added
docs/en/explanation/terminal-interface.md +44 -0 | new file mode 100644 | ||
| @@ -0,0 +1,44 @@ | ||
| 1 | +# The terminal interface — explanation | |
| 2 | + | |
| 3 | +## What is this about? | |
| 4 | + | |
| 5 | +`rzb tui` is a full-screen program for the person at the Mac: chat with the server's models, see what the server holds, manage the model cache, change the configuration. This page explains why it is a separate process, how it reaches what it shows, and what it deliberately keeps local. | |
| 6 | + | |
| 7 | +## A second process, not a mode of the server | |
| 8 | + | |
| 9 | +The server is meant to run for a long time, in the background, possibly started at login. A terminal window is meant to come and go. Putting the interface inside `rzb serve` would tie the two lifetimes together: closing the window would stop the server, and a crash in the drawing code would take the models down with it. As a second `rzb` process on the same machine, the interface can be opened, closed and opened again while the server keeps serving every other client. | |
| 10 | + | |
| 11 | +## Three ways to reach things | |
| 12 | + | |
| 13 | +The interface uses the channel that already exists for each kind of thing: | |
| 14 | + | |
| 15 | +- **The OpenAI API** for chatting. The Chat screen is a client like any other; it sends the whole conversation with each message, as OpenAI clients do, and the server's prompt cache avoids reading it again. A side effect is useful: the interface exercises the same API as every other client. | |
| 16 | +- **The `/rzb/` routes** for what only the server process knows: the models in memory, the queues, the engine's memory, the last requests, unloading a model, reloading the configuration. | |
| 17 | +- **The disk** for what is on the disk: the Hugging Face cache, read and cleaned like `rzb models` does, and the configuration file, opened like any file. Adding routes for them would make the server a file manager. | |
| 18 | + | |
| 19 | +Downloading needs the engine, which lives in the MLX part of `rzb`. The interface itself links no MLX, so that it builds and is tested on Linux like the server; the command line hands it the engine's download function. | |
| 20 | + | |
| 21 | +## What stays local | |
| 22 | + | |
| 23 | +The `/rzb/` routes answer the machine itself only. They act on the server for everyone and show what other clients do, so the person allowed to use them is the one at the Mac. `rzb tui` follows the same line: it is meant for a server on the same machine, and a server on another one answers 403. Port forwarding over `ssh` is the way to use it from elsewhere, because the server then sees a local connection. | |
| 24 | + | |
| 25 | +## Polling rather than events | |
| 26 | + | |
| 27 | +The Dashboard asks for the status every second. A refresh costs a few hundred bytes, keeps no connection open, and works the same with `curl`. A stream of events would be a second way to learn the same state, to keep consistent with the first, for a display that changes at human speed. | |
| 28 | + | |
| 29 | +## The server's file in an editor, the preferences in a form | |
| 30 | + | |
| 31 | +The server's configuration is a file people write by hand, with comments that explain their choices. Rewriting it from a form would lose those comments, because the YAML library does not keep them. So `rzb tui` opens it in the user's editor, checks it on return with the same validation as `rzb config validate`, and only then asks the server to reload it; a file with mistakes never reaches the server. The interface's own preferences are a small file it writes itself, so a form is the simpler way to change them. | |
| 32 | + | |
| 33 | +## Rejected alternatives | |
| 34 | + | |
| 35 | +- **The interface inside `rzb serve`** (`rzb serve --tui`): one process, but the server's life would depend on a terminal. | |
| 36 | +- **Server-sent events for the Dashboard**: instant updates, at the price of a second protocol for the same information. | |
| 37 | +- **Forms for the server's file**: comfortable, but comments would be lost on every save. | |
| 38 | +- **Routes for the model cache** (`/rzb/models` to list, download, delete): the interface would not need disk access, but the server would gain file-management duties that `rzb models` already covers. | |
| 39 | + | |
| 40 | +## How it relates to the rest | |
| 41 | + | |
| 42 | +- The routes it calls: [HTTP API reference](../reference/http-api.md#local-admin-routes-rzb); why they exist: [OpenAI compatibility](openai-compatibility.md#routes-of-our-own-under-rzb). | |
| 43 | +- Where its module sits: [architecture](architecture.md). | |
| 44 | +- Using it: [tutorial](../tutorials/chat-from-the-terminal.md), [reference](../reference/tui.md). | |
| new file mode 100644 | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | +# The terminal interface — explanation | ||
| 2 | + | ||
| 3 | +## What is this about? | ||
| 4 | + | ||
| 5 | +`rzb tui` is a full-screen program for the person at the Mac: chat with the server's models, see what the server holds, manage the model cache, change the configuration. This page explains why it is a separate process, how it reaches what it shows, and what it deliberately keeps local. | ||
| 6 | + | ||
| 7 | +## A second process, not a mode of the server | ||
| 8 | + | ||
| 9 | +The server is meant to run for a long time, in the background, possibly started at login. A terminal window is meant to come and go. Putting the interface inside `rzb serve` would tie the two lifetimes together: closing the window would stop the server, and a crash in the drawing code would take the models down with it. As a second `rzb` process on the same machine, the interface can be opened, closed and opened again while the server keeps serving every other client. | ||
| 10 | + | ||
| 11 | +## Three ways to reach things | ||
| 12 | + | ||
| 13 | +The interface uses the channel that already exists for each kind of thing: | ||
| 14 | + | ||
| 15 | +- **The OpenAI API** for chatting. The Chat screen is a client like any other; it sends the whole conversation with each message, as OpenAI clients do, and the server's prompt cache avoids reading it again. A side effect is useful: the interface exercises the same API as every other client. | ||
| 16 | +- **The `/rzb/` routes** for what only the server process knows: the models in memory, the queues, the engine's memory, the last requests, unloading a model, reloading the configuration. | ||
| 17 | +- **The disk** for what is on the disk: the Hugging Face cache, read and cleaned like `rzb models` does, and the configuration file, opened like any file. Adding routes for them would make the server a file manager. | ||
| 18 | + | ||
| 19 | +Downloading needs the engine, which lives in the MLX part of `rzb`. The interface itself links no MLX, so that it builds and is tested on Linux like the server; the command line hands it the engine's download function. | ||
| 20 | + | ||
| 21 | +## What stays local | ||
| 22 | + | ||
| 23 | +The `/rzb/` routes answer the machine itself only. They act on the server for everyone and show what other clients do, so the person allowed to use them is the one at the Mac. `rzb tui` follows the same line: it is meant for a server on the same machine, and a server on another one answers 403. Port forwarding over `ssh` is the way to use it from elsewhere, because the server then sees a local connection. | ||
| 24 | + | ||
| 25 | +## Polling rather than events | ||
| 26 | + | ||
| 27 | +The Dashboard asks for the status every second. A refresh costs a few hundred bytes, keeps no connection open, and works the same with `curl`. A stream of events would be a second way to learn the same state, to keep consistent with the first, for a display that changes at human speed. | ||
| 28 | + | ||
| 29 | +## The server's file in an editor, the preferences in a form | ||
| 30 | + | ||
| 31 | +The server's configuration is a file people write by hand, with comments that explain their choices. Rewriting it from a form would lose those comments, because the YAML library does not keep them. So `rzb tui` opens it in the user's editor, checks it on return with the same validation as `rzb config validate`, and only then asks the server to reload it; a file with mistakes never reaches the server. The interface's own preferences are a small file it writes itself, so a form is the simpler way to change them. | ||
| 32 | + | ||
| 33 | +## Rejected alternatives | ||
| 34 | + | ||
| 35 | +- **The interface inside `rzb serve`** (`rzb serve --tui`): one process, but the server's life would depend on a terminal. | ||
| 36 | +- **Server-sent events for the Dashboard**: instant updates, at the price of a second protocol for the same information. | ||
| 37 | +- **Forms for the server's file**: comfortable, but comments would be lost on every save. | ||
| 38 | +- **Routes for the model cache** (`/rzb/models` to list, download, delete): the interface would not need disk access, but the server would gain file-management duties that `rzb models` already covers. | ||
| 39 | + | ||
| 40 | +## How it relates to the rest | ||
| 41 | + | ||
| 42 | +- The routes it calls: [HTTP API reference](../reference/http-api.md#local-admin-routes-rzb); why they exist: [OpenAI compatibility](openai-compatibility.md#routes-of-our-own-under-rzb). | ||
| 43 | +- Where its module sits: [architecture](architecture.md). | ||
| 44 | +- Using it: [tutorial](../tutorials/chat-from-the-terminal.md), [reference](../reference/tui.md). | ||
added
docs/en/how-to/change-the-server-configuration-from-the-tui.md +37 -0 | new file mode 100644 | ||
| @@ -0,0 +1,37 @@ | ||
| 1 | +# How to change the server's configuration from rzb tui | |
| 2 | + | |
| 3 | +This guide shows how to edit the running server's configuration file from `rzb tui`, have it checked and reloaded, and how to change `rzb tui`'s own preferences. It assumes the server was started with `rzb serve --config <file>`. | |
| 4 | + | |
| 5 | +## Edit the server's file | |
| 6 | + | |
| 7 | +1. Press `F4`. Under Server configuration, the `file:` line names the file. | |
| 8 | +2. Press `Ctrl-O`. The file opens in your editor (`$VISUAL`, else `$EDITOR`, else `vi`). | |
| 9 | +3. Change it, save, and quit the editor. | |
| 10 | +4. Back in `rzb tui`, read the result under the section: | |
| 11 | + - problems are listed with their line numbers, and the server keeps its configuration: press `Ctrl-O` to fix the file; | |
| 12 | + - otherwise the server has reloaded it, and the line says how many models are declared, which loaded models were unloaded, and which `server:` keys only apply after a restart. | |
| 13 | +5. If keys are listed as needing a restart, stop the server and start it again. | |
| 14 | + | |
| 15 | +To pick the editor for one session: `EDITOR=nano rzb tui --config server.yaml`. | |
| 16 | + | |
| 17 | +## Reload a file edited elsewhere | |
| 18 | + | |
| 19 | +Edit the file with any tool, then press `Ctrl-R` on the Settings screen. It is the same as `curl -X POST http://127.0.0.1:7920/rzb/config/reload`. | |
| 20 | + | |
| 21 | +## Change rzb tui's preferences | |
| 22 | + | |
| 23 | +1. On the Settings screen, move between the fields with `Tab` or the arrows, and type. | |
| 24 | +2. Press `Enter` to save. A wrong field is named and nothing is saved; `Esc` undoes the changes. | |
| 25 | + | |
| 26 | +The reasoning display, the chat sampling, the colours and the poll interval change at once; the server URL and the API key variable apply the next time `rzb tui` starts. | |
| 27 | + | |
| 28 | +## Variants | |
| 29 | + | |
| 30 | +- **The file line says none**: the server runs without `--config`. Stop it and start it again with a file; `rzb tui` cannot add one to a running server. | |
| 31 | +- **The server has an API key**: start `rzb tui` with `--api-key-env` naming its variable, or set `api_key_env` in the preferences. | |
| 32 | + | |
| 33 | +## See also | |
| 34 | + | |
| 35 | +- What a reload changes, key by key: [configuration reference](../reference/configuration.md#reloading). | |
| 36 | +- The preferences file: [rzb tui reference](../reference/tui.md#preferences-file-tuiyaml). | |
| 37 | +- The same from the shell: [watch and steer a running server](watch-and-steer-a-running-server.md#apply-a-configuration-change-without-restarting). | |
| new file mode 100644 | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | +# How to change the server's configuration from rzb tui | ||
| 2 | + | ||
| 3 | +This guide shows how to edit the running server's configuration file from `rzb tui`, have it checked and reloaded, and how to change `rzb tui`'s own preferences. It assumes the server was started with `rzb serve --config <file>`. | ||
| 4 | + | ||
| 5 | +## Edit the server's file | ||
| 6 | + | ||
| 7 | +1. Press `F4`. Under Server configuration, the `file:` line names the file. | ||
| 8 | +2. Press `Ctrl-O`. The file opens in your editor (`$VISUAL`, else `$EDITOR`, else `vi`). | ||
| 9 | +3. Change it, save, and quit the editor. | ||
| 10 | +4. Back in `rzb tui`, read the result under the section: | ||
| 11 | + - problems are listed with their line numbers, and the server keeps its configuration: press `Ctrl-O` to fix the file; | ||
| 12 | + - otherwise the server has reloaded it, and the line says how many models are declared, which loaded models were unloaded, and which `server:` keys only apply after a restart. | ||
| 13 | +5. If keys are listed as needing a restart, stop the server and start it again. | ||
| 14 | + | ||
| 15 | +To pick the editor for one session: `EDITOR=nano rzb tui --config server.yaml`. | ||
| 16 | + | ||
| 17 | +## Reload a file edited elsewhere | ||
| 18 | + | ||
| 19 | +Edit the file with any tool, then press `Ctrl-R` on the Settings screen. It is the same as `curl -X POST http://127.0.0.1:7920/rzb/config/reload`. | ||
| 20 | + | ||
| 21 | +## Change rzb tui's preferences | ||
| 22 | + | ||
| 23 | +1. On the Settings screen, move between the fields with `Tab` or the arrows, and type. | ||
| 24 | +2. Press `Enter` to save. A wrong field is named and nothing is saved; `Esc` undoes the changes. | ||
| 25 | + | ||
| 26 | +The reasoning display, the chat sampling, the colours and the poll interval change at once; the server URL and the API key variable apply the next time `rzb tui` starts. | ||
| 27 | + | ||
| 28 | +## Variants | ||
| 29 | + | ||
| 30 | +- **The file line says none**: the server runs without `--config`. Stop it and start it again with a file; `rzb tui` cannot add one to a running server. | ||
| 31 | +- **The server has an API key**: start `rzb tui` with `--api-key-env` naming its variable, or set `api_key_env` in the preferences. | ||
| 32 | + | ||
| 33 | +## See also | ||
| 34 | + | ||
| 35 | +- What a reload changes, key by key: [configuration reference](../reference/configuration.md#reloading). | ||
| 36 | +- The preferences file: [rzb tui reference](../reference/tui.md#preferences-file-tuiyaml). | ||
| 37 | +- The same from the shell: [watch and steer a running server](watch-and-steer-a-running-server.md#apply-a-configuration-change-without-restarting). | ||
added
docs/en/how-to/manage-models-from-the-tui.md +32 -0 | new file mode 100644 | ||
| @@ -0,0 +1,32 @@ | ||
| 1 | +# How to manage models from rzb tui | |
| 2 | + | |
| 3 | +This guide shows how to download, remove and check models on the Models screen of `rzb tui`. It assumes `rzb tui` is open; start it with `--config` to see which models the server declares. | |
| 4 | + | |
| 5 | +## Download a model | |
| 6 | + | |
| 7 | +1. Press `F3`. | |
| 8 | +2. Press `p`, type the Hugging Face id, for instance `mlx-community/Qwen3-1.7B-4bit`, and press `Enter`. | |
| 9 | +3. Watch the `↓` line: it shows the progress. When it ends, `downloaded …` appears and the model is in the list. | |
| 10 | + | |
| 11 | +The download is the one `rzb models pull` makes, with the same rule: only models in MLX format are listed. Press `Esc` instead of `Enter` to give up before it starts. | |
| 12 | + | |
| 13 | +## Remove a model | |
| 14 | + | |
| 15 | +1. Select it with `↑` `↓`. | |
| 16 | +2. Press `d`, then `y`. Any other key keeps it. | |
| 17 | + | |
| 18 | +When the server has the model loaded, it is unloaded first. If a request is using it, nothing is removed and the screen says why: try again once the Dashboard shows it idle. | |
| 19 | + | |
| 20 | +## Check that a model fits before loading it | |
| 21 | + | |
| 22 | +Select it: the line under the list gives its size and the server's memory in use over its limit, and says `more than is free now` when it would not fit beside the models already loaded. The server then unloads idle models to make room, or answers 503 when it cannot. | |
| 23 | + | |
| 24 | +## Variants | |
| 25 | + | |
| 26 | +- **You downloaded a model in another terminal** (`rzb models pull`): press `r` to read the cache again. | |
| 27 | +- **`DECLARED AS` is empty for every model**: `rzb tui` was started without `--config` and the server runs without one, so no declared names are known. | |
| 28 | + | |
| 29 | +## See also | |
| 30 | + | |
| 31 | +- Every column and key of the screen: [rzb tui reference](../reference/tui.md#models-f3). | |
| 32 | +- The same tasks on the command line: [manage models](manage-models.md). | |
| new file mode 100644 | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | +# How to manage models from rzb tui | ||
| 2 | + | ||
| 3 | +This guide shows how to download, remove and check models on the Models screen of `rzb tui`. It assumes `rzb tui` is open; start it with `--config` to see which models the server declares. | ||
| 4 | + | ||
| 5 | +## Download a model | ||
| 6 | + | ||
| 7 | +1. Press `F3`. | ||
| 8 | +2. Press `p`, type the Hugging Face id, for instance `mlx-community/Qwen3-1.7B-4bit`, and press `Enter`. | ||
| 9 | +3. Watch the `↓` line: it shows the progress. When it ends, `downloaded …` appears and the model is in the list. | ||
| 10 | + | ||
| 11 | +The download is the one `rzb models pull` makes, with the same rule: only models in MLX format are listed. Press `Esc` instead of `Enter` to give up before it starts. | ||
| 12 | + | ||
| 13 | +## Remove a model | ||
| 14 | + | ||
| 15 | +1. Select it with `↑` `↓`. | ||
| 16 | +2. Press `d`, then `y`. Any other key keeps it. | ||
| 17 | + | ||
| 18 | +When the server has the model loaded, it is unloaded first. If a request is using it, nothing is removed and the screen says why: try again once the Dashboard shows it idle. | ||
| 19 | + | ||
| 20 | +## Check that a model fits before loading it | ||
| 21 | + | ||
| 22 | +Select it: the line under the list gives its size and the server's memory in use over its limit, and says `more than is free now` when it would not fit beside the models already loaded. The server then unloads idle models to make room, or answers 503 when it cannot. | ||
| 23 | + | ||
| 24 | +## Variants | ||
| 25 | + | ||
| 26 | +- **You downloaded a model in another terminal** (`rzb models pull`): press `r` to read the cache again. | ||
| 27 | +- **`DECLARED AS` is empty for every model**: `rzb tui` was started without `--config` and the server runs without one, so no declared names are known. | ||
| 28 | + | ||
| 29 | +## See also | ||
| 30 | + | ||
| 31 | +- Every column and key of the screen: [rzb tui reference](../reference/tui.md#models-f3). | ||
| 32 | +- The same tasks on the command line: [manage models](manage-models.md). | ||
modified
docs/en/reference/cli.md +5 -36 | @@ -49,7 +49,7 @@ The engine is the first one of the build: `mlx` on the Mac, `fake` on Linux (whi | ||
| 49 | 49 | rzb tui [--url <url>] [--config <file>] [--api-key-env <name>] |
| 50 | 50 | ``` |
| 51 | 51 | |
| 52 | -Opens a full-screen interface to a `rzb serve` running on the same machine, and runs until Ctrl-Q or Ctrl-C; the terminal is then restored as it was. It never loads a model itself: it reads the server over HTTP, polling [`GET /rzb/status`](http-api.md#get-rzbstatus) every second. | |
| 52 | +Opens a full-screen interface to a `rzb serve` running on the same machine, and runs until Ctrl-Q or Ctrl-C; the terminal is then restored as it was. It never loads a model itself: it reads the server over HTTP, polling [`GET /rzb/status`](http-api.md#get-rzbstatus) every second (`poll_interval`). | |
| 53 | 53 | |
| 54 | 54 | | Option | Type | Default | Description | |
| 55 | 55 | | --- | --- | --- | --- | |
| @@ -57,43 +57,11 @@ Opens a full-screen interface to a `rzb serve` running on the same machine, and | ||
| 57 | 57 | | `--config <file>` | path | none | The server's configuration file: its `server.host` and `server.port` give the address (`0.0.0.0` and `::` become `127.0.0.1`), its `server.api_key_env` the key variable | |
| 58 | 58 | | `--api-key-env <name>` | string | `server.api_key_env`, else `RZB_API_KEY` | Environment variable holding the server's API key; unset or empty: no key | |
| 59 | 59 | |
| 60 | -| Key | Effect | | |
| 61 | -| --- | --- | | |
| 62 | -| `F1` `F2` `F3` `F4` | Chat, Dashboard, Models, Settings screen | | |
| 63 | -| `Ctrl-T` | Next screen | | |
| 64 | -| `Ctrl-Q` | Quit | | |
| 65 | -| `Ctrl-C` | Stop the answer being generated on the Chat screen; quit otherwise | | |
| 66 | - | |
| 67 | -The Models and Settings screens are not built yet. | |
| 68 | - | |
| 69 | -**Dashboard** (the first screen): the server's version, uptime and address; the engine's memory as a gauge of active over limit, with cache and peak; the loaded models (name, kind, state, size, then idle time and time left before `keep_alive` unloads them, or busy and waiting requests); the last requests (age, method and path, status, model, prompt+completion tokens, cached tokens, completion tokens per second over the whole request, duration). | |
| 70 | - | |
| 71 | -| Key | Effect | | |
| 72 | -| --- | --- | | |
| 73 | -| `↑` `↓` `PgUp` `PgDn` `Home` `End` | Select a model | | |
| 74 | -| `u` | Unload the selected model ([`POST /rzb/models/{id}/unload`](http-api.md#post-rzbmodelsidunload)); the server's answer is shown below the requests, including its refusal while the model is in use | | |
| 75 | - | |
| 76 | -**Chat**: a conversation with a model of the server, streamed. It is kept by `rzb tui` and resent whole with each message. The model is the first loaded chat model of `/v1/models`, else the first chat model listed. After each answer: prompt+completion tokens, cached prompt tokens, tokens per second from the first piece to the last. | |
| 60 | +Precedence: these options, then the [preferences file](tui.md#preferences-file-tuiyaml) `~/.config/razorbill/tui.yaml`, then the `--config` file, then the defaults. `NO_COLOR` turns colours off. | |
| 77 | 61 | |
| 78 | -| Key | Effect | | |
| 79 | -| --- | --- | | |
| 80 | -| `Enter` | Send the message, or run a command | | |
| 81 | -| `Esc` | Stop the answer being generated (what came stays and is part of the conversation) | | |
| 82 | -| `Ctrl-N` | New conversation | | |
| 83 | -| `Ctrl-P` | Choose the model (`↑` `↓`, `Enter`; `Esc` closes the list) | | |
| 84 | -| `Ctrl-R` | Reasoning folded (one line with its length), hidden, then shown | | |
| 85 | -| `PgUp` `PgDn` | Scroll the conversation | | |
| 86 | -| `←` `→` `Home` `End` `Ctrl-A` `Ctrl-E` `Backspace` `Delete` | Edit the message | | |
| 87 | - | |
| 88 | -| Command | Effect | | |
| 89 | -| --- | --- | | |
| 90 | -| `/set <name> <value>` | Sampling for the next messages: `temperature` (0–2), `top_p` (0–1), `top_k` (≥ 0), `min_p` (0–1), `max_tokens` (≥ 1), `thinking` (`on`, `off`) | | |
| 91 | -| `/set <name>` | Give the setting back to the server's value | | |
| 92 | -| `/set` | Show the settings | | |
| 93 | -| `/clear` | New conversation | | |
| 94 | -| `/help` | The keys and commands | The bottom line shows the connection: `●` connected (version, model, memory), `○` no server (the screen gives the `rzb serve` command to run, with `--config` when one was given), `✕` API key refused or server on another machine. | |
| 62 | +The screens, their keys and the preferences are described in the [`rzb tui` reference](tui.md). | |
| 95 | 63 | |
| 96 | -Errors: a `--url` that is not an http(s) address gives exit code 64; an invalid `--config` file, exit code 2; no terminal on standard input and output, `error: rzb tui needs a terminal …` and exit code 1. | |
| 64 | +Errors: a `--url` that is not an http(s) address gives exit code 64; an invalid `--config` or preferences file, exit code 2; no terminal on standard input and output, `error: rzb tui needs a terminal …` and exit code 1. | |
| 97 | 65 | |
| 98 | 66 | ## rzb config validate |
| 99 | 67 | |
| @@ -134,3 +102,4 @@ Prints `rzb 0.2.0 (engines: fake, mlx)` (the engines of this build, sorted). `rz | ||
| 134 | 102 | | `RZB_API_KEY` (or the name given by `--api-key-env` / `server.api_key_env`) | API key of the server | |
| 135 | 103 | | `HF_HUB_CACHE`, `HF_HOME` | Location of the model cache | |
| 136 | 104 | | `NO_COLOR` | Disables colours on standard error, and in `rzb tui` | |
| 105 | +| `RZB_TUI_PREFERENCES` | The preferences file of `rzb tui`, instead of `~/.config/razorbill/tui.yaml` | | |
| @@ -49,7 +49,7 @@ The engine is the first one of the build: `mlx` on the Mac, `fake` on Linux (whi | |||
| 49 | rzb tui [--url <url>] [--config <file>] [--api-key-env <name>] | 49 | rzb tui [--url <url>] [--config <file>] [--api-key-env <name>] |
| 50 | ``` | 50 | ``` |
| 51 | 51 | ||
| 52 | -Opens a full-screen interface to a `rzb serve` running on the same machine, and runs until Ctrl-Q or Ctrl-C; the terminal is then restored as it was. It never loads a model itself: it reads the server over HTTP, polling [`GET /rzb/status`](http-api.md#get-rzbstatus) every second. | 52 | +Opens a full-screen interface to a `rzb serve` running on the same machine, and runs until Ctrl-Q or Ctrl-C; the terminal is then restored as it was. It never loads a model itself: it reads the server over HTTP, polling [`GET /rzb/status`](http-api.md#get-rzbstatus) every second (`poll_interval`). |
| 53 | 53 | ||
| 54 | | Option | Type | Default | Description | | 54 | | Option | Type | Default | Description | |
| 55 | | --- | --- | --- | --- | | 55 | | --- | --- | --- | --- | |
| @@ -57,43 +57,11 @@ Opens a full-screen interface to a `rzb serve` running on the same machine, and | |||
| 57 | | `--config <file>` | path | none | The server's configuration file: its `server.host` and `server.port` give the address (`0.0.0.0` and `::` become `127.0.0.1`), its `server.api_key_env` the key variable | | 57 | | `--config <file>` | path | none | The server's configuration file: its `server.host` and `server.port` give the address (`0.0.0.0` and `::` become `127.0.0.1`), its `server.api_key_env` the key variable | |
| 58 | | `--api-key-env <name>` | string | `server.api_key_env`, else `RZB_API_KEY` | Environment variable holding the server's API key; unset or empty: no key | | 58 | | `--api-key-env <name>` | string | `server.api_key_env`, else `RZB_API_KEY` | Environment variable holding the server's API key; unset or empty: no key | |
| 59 | 59 | ||
| 60 | -| Key | Effect | | 60 | +Precedence: these options, then the [preferences file](tui.md#preferences-file-tuiyaml) `~/.config/razorbill/tui.yaml`, then the `--config` file, then the defaults. `NO_COLOR` turns colours off. |
| 61 | -| --- | --- | | ||
| 62 | -| `F1` `F2` `F3` `F4` | Chat, Dashboard, Models, Settings screen | | ||
| 63 | -| `Ctrl-T` | Next screen | | ||
| 64 | -| `Ctrl-Q` | Quit | | ||
| 65 | -| `Ctrl-C` | Stop the answer being generated on the Chat screen; quit otherwise | | ||
| 66 | - | ||
| 67 | -The Models and Settings screens are not built yet. | ||
| 68 | - | ||
| 69 | -**Dashboard** (the first screen): the server's version, uptime and address; the engine's memory as a gauge of active over limit, with cache and peak; the loaded models (name, kind, state, size, then idle time and time left before `keep_alive` unloads them, or busy and waiting requests); the last requests (age, method and path, status, model, prompt+completion tokens, cached tokens, completion tokens per second over the whole request, duration). | ||
| 70 | - | ||
| 71 | -| Key | Effect | | ||
| 72 | -| --- | --- | | ||
| 73 | -| `↑` `↓` `PgUp` `PgDn` `Home` `End` | Select a model | | ||
| 74 | -| `u` | Unload the selected model ([`POST /rzb/models/{id}/unload`](http-api.md#post-rzbmodelsidunload)); the server's answer is shown below the requests, including its refusal while the model is in use | | ||
| 75 | - | ||
| 76 | -**Chat**: a conversation with a model of the server, streamed. It is kept by `rzb tui` and resent whole with each message. The model is the first loaded chat model of `/v1/models`, else the first chat model listed. After each answer: prompt+completion tokens, cached prompt tokens, tokens per second from the first piece to the last. | ||
| 77 | 61 | ||
| 78 | -| Key | Effect | | 62 | +The screens, their keys and the preferences are described in the [`rzb tui` reference](tui.md). |
| 79 | -| --- | --- | | ||
| 80 | -| `Enter` | Send the message, or run a command | | ||
| 81 | -| `Esc` | Stop the answer being generated (what came stays and is part of the conversation) | | ||
| 82 | -| `Ctrl-N` | New conversation | | ||
| 83 | -| `Ctrl-P` | Choose the model (`↑` `↓`, `Enter`; `Esc` closes the list) | | ||
| 84 | -| `Ctrl-R` | Reasoning folded (one line with its length), hidden, then shown | | ||
| 85 | -| `PgUp` `PgDn` | Scroll the conversation | | ||
| 86 | -| `←` `→` `Home` `End` `Ctrl-A` `Ctrl-E` `Backspace` `Delete` | Edit the message | | ||
| 87 | - | ||
| 88 | -| Command | Effect | | ||
| 89 | -| --- | --- | | ||
| 90 | -| `/set <name> <value>` | Sampling for the next messages: `temperature` (0–2), `top_p` (0–1), `top_k` (≥ 0), `min_p` (0–1), `max_tokens` (≥ 1), `thinking` (`on`, `off`) | | ||
| 91 | -| `/set <name>` | Give the setting back to the server's value | | ||
| 92 | -| `/set` | Show the settings | | ||
| 93 | -| `/clear` | New conversation | | ||
| 94 | -| `/help` | The keys and commands | The bottom line shows the connection: `●` connected (version, model, memory), `○` no server (the screen gives the `rzb serve` command to run, with `--config` when one was given), `✕` API key refused or server on another machine. | ||
| 95 | 63 | ||
| 96 | -Errors: a `--url` that is not an http(s) address gives exit code 64; an invalid `--config` file, exit code 2; no terminal on standard input and output, `error: rzb tui needs a terminal …` and exit code 1. | 64 | +Errors: a `--url` that is not an http(s) address gives exit code 64; an invalid `--config` or preferences file, exit code 2; no terminal on standard input and output, `error: rzb tui needs a terminal …` and exit code 1. |
| 97 | 65 | ||
| 98 | ## rzb config validate | 66 | ## rzb config validate |
| 99 | 67 | ||
| @@ -134,3 +102,4 @@ Prints `rzb 0.2.0 (engines: fake, mlx)` (the engines of this build, sorted). `rz | |||
| 134 | | `RZB_API_KEY` (or the name given by `--api-key-env` / `server.api_key_env`) | API key of the server | | 102 | | `RZB_API_KEY` (or the name given by `--api-key-env` / `server.api_key_env`) | API key of the server | |
| 135 | | `HF_HUB_CACHE`, `HF_HOME` | Location of the model cache | | 103 | | `HF_HUB_CACHE`, `HF_HOME` | Location of the model cache | |
| 136 | | `NO_COLOR` | Disables colours on standard error, and in `rzb tui` | | 104 | | `NO_COLOR` | Disables colours on standard error, and in `rzb tui` | |
| 105 | +| `RZB_TUI_PREFERENCES` | The preferences file of `rzb tui`, instead of `~/.config/razorbill/tui.yaml` | | ||
modified
docs/en/reference/configuration.md +2 -0 | @@ -2,6 +2,8 @@ | ||
| 2 | 2 | |
| 3 | 3 | > Every key of the YAML file given to `rzb serve --config <file>`, its type, default and checks. Check a file without starting the server with `rzb config validate <file>`. A commented example is in [`examples/server.yaml`](../../../examples/server.yaml). |
| 4 | 4 | |
| 5 | +The preferences of `rzb tui` have a file of their own: see the [`rzb tui` reference](tui.md#preferences-file-tuiyaml). | |
| 6 | + | |
| 5 | 7 | Every section is optional; an empty file, or no file at all, is a valid configuration. Unknown keys are errors. Every problem of a file is reported at once, with its key path and line number; the exit code is then 2. |
| 6 | 8 | |
| 7 | 9 | ```yaml |
| @@ -2,6 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | > Every key of the YAML file given to `rzb serve --config <file>`, its type, default and checks. Check a file without starting the server with `rzb config validate <file>`. A commented example is in [`examples/server.yaml`](../../../examples/server.yaml). | 3 | > Every key of the YAML file given to `rzb serve --config <file>`, its type, default and checks. Check a file without starting the server with `rzb config validate <file>`. A commented example is in [`examples/server.yaml`](../../../examples/server.yaml). |
| 4 | 4 | ||
| 5 | +The preferences of `rzb tui` have a file of their own: see the [`rzb tui` reference](tui.md#preferences-file-tuiyaml). | ||
| 6 | + | ||
| 5 | Every section is optional; an empty file, or no file at all, is a valid configuration. Unknown keys are errors. Every problem of a file is reported at once, with its key path and line number; the exit code is then 2. | 7 | Every section is optional; an empty file, or no file at all, is a valid configuration. Unknown keys are errors. Every problem of a file is reported at once, with its key path and line number; the exit code is then 2. |
| 6 | 8 | ||
| 7 | ```yaml | 9 | ```yaml |
modified
docs/en/reference/http-api.md +2 -1 | @@ -327,6 +327,7 @@ curl -s http://127.0.0.1:7920/rzb/status | ||
| 327 | 327 | | `version` | string | razorbill's version | |
| 328 | 328 | | `uptime_seconds` | integer | Seconds since the server started | |
| 329 | 329 | | `host`, `port` | string, integer | The configured address (`port` is `0` when the server picked a free port) | |
| 330 | +| `config_file` | string or `null` | The `--config` file as an absolute path; `null` without one | | |
| 330 | 331 | | `models` | array | The models loaded or being loaded, sorted by `key` (table below); `[]` when none | |
| 331 | 332 | | `recent_requests` | array | The last 50 requests answered, newest first, each recorded once its last byte is sent (table below) | |
| 332 | 333 | | `memory` | object or `null` | The engine's memory (table below); `null` when the engine cannot measure it (the Linux build) | |
| @@ -363,7 +364,7 @@ curl -s http://127.0.0.1:7920/rzb/status | ||
| 363 | 364 | Example, after one chat request: |
| 364 | 365 | |
| 365 | 366 | ```json |
| 366 | -{"host": "127.0.0.1", "port": 7920, "uptime_seconds": 34, "version": "0.2.0", | |
| 367 | +{"config_file": "/Users/me/server.yaml", "host": "127.0.0.1", "port": 7920, "uptime_seconds": 34, "version": "0.2.0", | |
| 367 | 368 | "memory": {"active_bytes": 364743776, "cache_bytes": 23594047, "limit_bytes": 32641751449, "peak_bytes": 408882564}, |
| 368 | 369 | "models": [{"busy": false, "idle_seconds": 7, "keep_alive_left_seconds": 592.9, "key": "mlx-community/Qwen3-0.6B-4bit", |
| 369 | 370 | "kind": "chat", "name": "qwen", "queued": 0, "size_bytes": 335450584, "state": "loaded"}], |
| @@ -327,6 +327,7 @@ curl -s http://127.0.0.1:7920/rzb/status | |||
| 327 | | `version` | string | razorbill's version | | 327 | | `version` | string | razorbill's version | |
| 328 | | `uptime_seconds` | integer | Seconds since the server started | | 328 | | `uptime_seconds` | integer | Seconds since the server started | |
| 329 | | `host`, `port` | string, integer | The configured address (`port` is `0` when the server picked a free port) | | 329 | | `host`, `port` | string, integer | The configured address (`port` is `0` when the server picked a free port) | |
| 330 | +| `config_file` | string or `null` | The `--config` file as an absolute path; `null` without one | | ||
| 330 | | `models` | array | The models loaded or being loaded, sorted by `key` (table below); `[]` when none | | 331 | | `models` | array | The models loaded or being loaded, sorted by `key` (table below); `[]` when none | |
| 331 | | `recent_requests` | array | The last 50 requests answered, newest first, each recorded once its last byte is sent (table below) | | 332 | | `recent_requests` | array | The last 50 requests answered, newest first, each recorded once its last byte is sent (table below) | |
| 332 | | `memory` | object or `null` | The engine's memory (table below); `null` when the engine cannot measure it (the Linux build) | | 333 | | `memory` | object or `null` | The engine's memory (table below); `null` when the engine cannot measure it (the Linux build) | |
| @@ -363,7 +364,7 @@ curl -s http://127.0.0.1:7920/rzb/status | |||
| 363 | Example, after one chat request: | 364 | Example, after one chat request: |
| 364 | 365 | ||
| 365 | ```json | 366 | ```json |
| 366 | -{"host": "127.0.0.1", "port": 7920, "uptime_seconds": 34, "version": "0.2.0", | 367 | +{"config_file": "/Users/me/server.yaml", "host": "127.0.0.1", "port": 7920, "uptime_seconds": 34, "version": "0.2.0", |
| 367 | "memory": {"active_bytes": 364743776, "cache_bytes": 23594047, "limit_bytes": 32641751449, "peak_bytes": 408882564}, | 368 | "memory": {"active_bytes": 364743776, "cache_bytes": 23594047, "limit_bytes": 32641751449, "peak_bytes": 408882564}, |
| 368 | "models": [{"busy": false, "idle_seconds": 7, "keep_alive_left_seconds": 592.9, "key": "mlx-community/Qwen3-0.6B-4bit", | 369 | "models": [{"busy": false, "idle_seconds": 7, "keep_alive_left_seconds": 592.9, "key": "mlx-community/Qwen3-0.6B-4bit", |
| 369 | "kind": "chat", "name": "qwen", "queued": 0, "size_bytes": 335450584, "state": "loaded"}], | 370 | "kind": "chat", "name": "qwen", "queued": 0, "size_bytes": 335450584, "state": "loaded"}], |
added
docs/en/reference/tui.md +152 -0 | new file mode 100644 | ||
| @@ -0,0 +1,152 @@ | ||
| 1 | +# Reference: rzb tui | |
| 2 | + | |
| 3 | +> The screens of `rzb tui`, their keys and commands, its preferences file, and what it asks the server. Its command-line options are in the [command-line reference](cli.md#rzb-tui). | |
| 4 | + | |
| 5 | +## The frame | |
| 6 | + | |
| 7 | +| Row | Content | | |
| 8 | +| --- | --- | | |
| 9 | +| First | The tabs ` F1 Chat F2 Dashboard F3 Models F4 Settings `, the current one in reverse video | | |
| 10 | +| Last | The connection on the left, `Ctrl-T next · Ctrl-Q quit` on the right when there is room | | |
| 11 | +| Between | The current screen | | |
| 12 | + | |
| 13 | +| Mark in the last row | Meaning | | |
| 14 | +| --- | --- | | |
| 15 | +| `…` | Waiting for the server's first answer | | |
| 16 | +| `●` | Connected: the server's version and address, the first loaded model, the engine's memory in use over its limit | | |
| 17 | +| `○` | No server answers; every screen shows the `rzb serve` command to run (with `--config` when `rzb tui` got one) | | |
| 18 | +| `✕` | The server refused the API key (401), or it is on another machine (403 `local_only`) | | |
| 19 | + | |
| 20 | +Memory and sizes are in GB of 2³⁰ bytes. | |
| 21 | + | |
| 22 | +## Keys of every screen | |
| 23 | + | |
| 24 | +| Key | Effect | | |
| 25 | +| --- | --- | | |
| 26 | +| `F1` `F2` `F3` `F4` | Chat, Dashboard, Models, Settings | | |
| 27 | +| `Ctrl-T` | Next screen | | |
| 28 | +| `Ctrl-Q` | Quit | | |
| 29 | +| `Ctrl-C` | Stop the answer being generated on the Chat screen; quit otherwise | | |
| 30 | + | |
| 31 | +`rzb tui` opens on the Dashboard. | |
| 32 | + | |
| 33 | +## Dashboard (F2) | |
| 34 | + | |
| 35 | +The server's version, uptime and address; the engine's memory as a gauge of active over limit, with cache and peak (`not reported by this engine` on Linux); the loaded models; the last requests. | |
| 36 | + | |
| 37 | +| Models column | Content | | |
| 38 | +| --- | --- | | |
| 39 | +| `NAME`, `KIND`, `STATE`, `SIZE` | The name of the request that loaded it, `chat` or `embedding`, `loading` or `loaded`, weights on disk | | |
| 40 | +| `ACTIVITY` | `idle 7s, unloads in 9m 52s` (from `keep_alive`), or `busy` / `busy, 2 waiting` | | |
| 41 | + | |
| 42 | +| Requests column | Content | | |
| 43 | +| --- | --- | | |
| 44 | +| `AGE`, `REQUEST`, `STATUS`, `MODEL` | Time since it ended, method and path, status, model | | |
| 45 | +| `TOKENS`, `CACHED` | Prompt+completion tokens, prompt tokens reused from the server's cache | | |
| 46 | +| `TOK/S`, `TIME` | Completion tokens over the whole duration (prompt processing included), duration to the last byte | | |
| 47 | + | |
| 48 | +| Key | Effect | | |
| 49 | +| --- | --- | | |
| 50 | +| `↑` `↓` `PgUp` `PgDn` `Home` `End` | Select a model | | |
| 51 | +| `u` | Unload the selected model; the server's answer shows under the requests (a model in use is refused) | | |
| 52 | + | |
| 53 | +## Chat (F1) | |
| 54 | + | |
| 55 | +A streamed conversation with a chat model of the server. The conversation is kept by `rzb tui` and resent whole with each message; the server's prompt cache makes that cheap. The model is the first loaded chat model of `/v1/models`, else the first chat model listed. After each answer: prompt+completion tokens, cached prompt tokens, tokens per second from the first piece to the last. | |
| 56 | + | |
| 57 | +| Key | Effect | | |
| 58 | +| --- | --- | | |
| 59 | +| `Enter` | Send the message, or run a command | | |
| 60 | +| `Esc` | Stop the answer being generated; what came stays and is part of the conversation | | |
| 61 | +| `Ctrl-N` | New conversation (not while an answer is coming) | | |
| 62 | +| `Ctrl-P` | Choose the model: `↑` `↓`, `Enter`; `Esc` closes the list | | |
| 63 | +| `Ctrl-R` | Reasoning folded (one line with its length), hidden, shown | | |
| 64 | +| `PgUp` `PgDn` | Scroll the conversation | | |
| 65 | +| `←` `→` `Home` `End` `Ctrl-A` `Ctrl-E` `Backspace` `Delete` | Edit the message | | |
| 66 | + | |
| 67 | +| Command | Effect | | |
| 68 | +| --- | --- | | |
| 69 | +| `/set <name> <value>` | Sampling of the next messages: `temperature` (0–2), `top_p` (0–1), `top_k` (≥ 0), `min_p` (0–1), `max_tokens` (≥ 1), `thinking` (`on`, `off`, sent as `chat_template_kwargs.enable_thinking`) | | |
| 70 | +| `/set <name>` | Give the setting back to the server's value | | |
| 71 | +| `/set` | Show the settings | | |
| 72 | +| `/clear` | New conversation | | |
| 73 | +| `/help` | The keys and commands | | |
| 74 | + | |
| 75 | +The session starts with the `chat:` section and the `reasoning` key of the preferences. | |
| 76 | + | |
| 77 | +## Models (F3) | |
| 78 | + | |
| 79 | +The MLX models of the Hugging Face cache (the same as `rzb models list`), read from the disk; downloads in progress; a hint on the selected model. | |
| 80 | + | |
| 81 | +| Column | Content | | |
| 82 | +| --- | --- | | |
| 83 | +| `ID` | The Hugging Face id | | |
| 84 | +| `KIND` | From the server's configuration or from the loaded model; `-` when neither tells | | |
| 85 | +| `SIZE` | Disk space | | |
| 86 | +| `LOADED` | `yes` when the server has it in memory | | |
| 87 | +| `DECLARED AS` | The configuration's ids that point to it | | |
| 88 | + | |
| 89 | +The hint gives the selected model's size and the server's memory in use over its limit, with `more than is free now` when the model would not fit beside what is loaded. | |
| 90 | + | |
| 91 | +| Key | Effect | | |
| 92 | +| --- | --- | | |
| 93 | +| `↑` `↓` `PgUp` `PgDn` `Home` `End` | Select a model | | |
| 94 | +| `p` | Type a Hugging Face id (`org/name`), `Enter` downloads it with the engine of the build (progress shown), `Esc` cancels | | |
| 95 | +| `d`, `Delete` | Remove the selected model from the disk after `y` (any other key keeps it). A loaded model is unloaded first; while the server is using it, nothing is removed | | |
| 96 | +| `r` | Read the cache again | | |
| 97 | + | |
| 98 | +## Settings (F4) | |
| 99 | + | |
| 100 | +Two sections: the preferences, as a form saved to the preferences file; the server's configuration file, the one given to `rzb tui --config`, else the one `GET /rzb/status` reports. | |
| 101 | + | |
| 102 | +| Key | Effect | | |
| 103 | +| --- | --- | | |
| 104 | +| `Tab` `Shift-Tab` `↑` `↓` | Move between the fields | | |
| 105 | +| `Enter` | Check and save the preferences; the first wrong field is named | | |
| 106 | +| `Esc` | Undo the changes not saved | | |
| 107 | +| `Ctrl-O` | Open the server's file in `$VISUAL`, else `$EDITOR`, else `vi`; on return it is checked like `rzb config validate`, then the server reloads it | | |
| 108 | +| `Ctrl-R` | Reload the server's file as it is | | |
| 109 | + | |
| 110 | +After a reload, the screen lists the models unloaded, those unloaded once idle, and the keys that need a restart of the server. A file with problems is not reloaded: the problems are listed with their lines. A server started without `--config` has no file. | |
| 111 | + | |
| 112 | +Saving the preferences applies at once the reasoning display, the chat sampling, the colours and the poll interval; the server URL and the API key variable apply the next time `rzb tui` starts. | |
| 113 | + | |
| 114 | +## Preferences file (tui.yaml) | |
| 115 | + | |
| 116 | +`~/.config/razorbill/tui.yaml`, or the file named by `RZB_TUI_PREFERENCES`. Every key is optional; a missing file means no preferences. The options of `rzb tui` win over the file, and the file wins over the server's `--config` file. | |
| 117 | + | |
| 118 | +| Key | Type | Default | Description | | |
| 119 | +| --- | --- | --- | --- | | |
| 120 | +| `server_url` | `http://…` | from `--config`, else `http://127.0.0.1:7920` | The server | | |
| 121 | +| `api_key_env` | string | `RZB_API_KEY` | Environment variable holding the API key | | |
| 122 | +| `reasoning` | `shown`, `folded`, `hidden` | `folded` | How the Chat screen shows reasoning | | |
| 123 | +| `colors` | boolean | `true` | Colours (`NO_COLOR` turns them off whatever this says) | | |
| 124 | +| `poll_interval` | duration (`500ms`, `2s`) | `1s` | How often `GET /rzb/status` is asked | | |
| 125 | +| `chat.temperature` | number, 0–2 | the server's | Chat sampling | | |
| 126 | +| `chat.top_p`, `chat.min_p` | number, 0–1 | the server's | Chat sampling | | |
| 127 | +| `chat.top_k` | whole number ≥ 0 | the server's | Chat sampling | | |
| 128 | +| `chat.max_tokens` | whole number ≥ 1 | the server's | Chat answer limit | | |
| 129 | +| `chat.thinking` | boolean | the model's | Reasoning on or off | | |
| 130 | + | |
| 131 | +```yaml | |
| 132 | +server_url: http://127.0.0.1:7920 | |
| 133 | +reasoning: hidden | |
| 134 | +poll_interval: 2s | |
| 135 | +chat: | |
| 136 | + temperature: 0.7 | |
| 137 | + max_tokens: 1024 | |
| 138 | +``` | |
| 139 | + | |
| 140 | +Unknown keys and wrong values are reported together, with their lines, and `rzb tui` exits with code 2. The Settings screen writes the file with the keys that are set, and a comment line at the top. | |
| 141 | + | |
| 142 | +## What it asks the server | |
| 143 | + | |
| 144 | +| Request | When | | |
| 145 | +| --- | --- | | |
| 146 | +| [`GET /rzb/status`](http-api.md#get-rzbstatus) | Every `poll_interval` | | |
| 147 | +| `GET /v1/models` | When the Chat screen is first shown, and on `Ctrl-P` | | |
| 148 | +| `POST /v1/chat/completions` | Each message, streamed with `stream_options.include_usage` | | |
| 149 | +| [`POST /rzb/models/{id}/unload`](http-api.md#post-rzbmodelsidunload) | `u` on the Dashboard, `d` then `y` on a loaded model | | |
| 150 | +| [`POST /rzb/config/reload`](http-api.md#post-rzbconfigreload) | `Ctrl-R`, and after `Ctrl-O` | | |
| 151 | + | |
| 152 | +All of them carry `Authorization: Bearer <key>` when a key is set. The `/rzb/` routes only answer the machine running the server. | |
| new file mode 100644 | |||
| @@ -0,0 +1,152 @@ | |||
| 1 | +# Reference: rzb tui | ||
| 2 | + | ||
| 3 | +> The screens of `rzb tui`, their keys and commands, its preferences file, and what it asks the server. Its command-line options are in the [command-line reference](cli.md#rzb-tui). | ||
| 4 | + | ||
| 5 | +## The frame | ||
| 6 | + | ||
| 7 | +| Row | Content | | ||
| 8 | +| --- | --- | | ||
| 9 | +| First | The tabs ` F1 Chat F2 Dashboard F3 Models F4 Settings `, the current one in reverse video | | ||
| 10 | +| Last | The connection on the left, `Ctrl-T next · Ctrl-Q quit` on the right when there is room | | ||
| 11 | +| Between | The current screen | | ||
| 12 | + | ||
| 13 | +| Mark in the last row | Meaning | | ||
| 14 | +| --- | --- | | ||
| 15 | +| `…` | Waiting for the server's first answer | | ||
| 16 | +| `●` | Connected: the server's version and address, the first loaded model, the engine's memory in use over its limit | | ||
| 17 | +| `○` | No server answers; every screen shows the `rzb serve` command to run (with `--config` when `rzb tui` got one) | | ||
| 18 | +| `✕` | The server refused the API key (401), or it is on another machine (403 `local_only`) | | ||
| 19 | + | ||
| 20 | +Memory and sizes are in GB of 2³⁰ bytes. | ||
| 21 | + | ||
| 22 | +## Keys of every screen | ||
| 23 | + | ||
| 24 | +| Key | Effect | | ||
| 25 | +| --- | --- | | ||
| 26 | +| `F1` `F2` `F3` `F4` | Chat, Dashboard, Models, Settings | | ||
| 27 | +| `Ctrl-T` | Next screen | | ||
| 28 | +| `Ctrl-Q` | Quit | | ||
| 29 | +| `Ctrl-C` | Stop the answer being generated on the Chat screen; quit otherwise | | ||
| 30 | + | ||
| 31 | +`rzb tui` opens on the Dashboard. | ||
| 32 | + | ||
| 33 | +## Dashboard (F2) | ||
| 34 | + | ||
| 35 | +The server's version, uptime and address; the engine's memory as a gauge of active over limit, with cache and peak (`not reported by this engine` on Linux); the loaded models; the last requests. | ||
| 36 | + | ||
| 37 | +| Models column | Content | | ||
| 38 | +| --- | --- | | ||
| 39 | +| `NAME`, `KIND`, `STATE`, `SIZE` | The name of the request that loaded it, `chat` or `embedding`, `loading` or `loaded`, weights on disk | | ||
| 40 | +| `ACTIVITY` | `idle 7s, unloads in 9m 52s` (from `keep_alive`), or `busy` / `busy, 2 waiting` | | ||
| 41 | + | ||
| 42 | +| Requests column | Content | | ||
| 43 | +| --- | --- | | ||
| 44 | +| `AGE`, `REQUEST`, `STATUS`, `MODEL` | Time since it ended, method and path, status, model | | ||
| 45 | +| `TOKENS`, `CACHED` | Prompt+completion tokens, prompt tokens reused from the server's cache | | ||
| 46 | +| `TOK/S`, `TIME` | Completion tokens over the whole duration (prompt processing included), duration to the last byte | | ||
| 47 | + | ||
| 48 | +| Key | Effect | | ||
| 49 | +| --- | --- | | ||
| 50 | +| `↑` `↓` `PgUp` `PgDn` `Home` `End` | Select a model | | ||
| 51 | +| `u` | Unload the selected model; the server's answer shows under the requests (a model in use is refused) | | ||
| 52 | + | ||
| 53 | +## Chat (F1) | ||
| 54 | + | ||
| 55 | +A streamed conversation with a chat model of the server. The conversation is kept by `rzb tui` and resent whole with each message; the server's prompt cache makes that cheap. The model is the first loaded chat model of `/v1/models`, else the first chat model listed. After each answer: prompt+completion tokens, cached prompt tokens, tokens per second from the first piece to the last. | ||
| 56 | + | ||
| 57 | +| Key | Effect | | ||
| 58 | +| --- | --- | | ||
| 59 | +| `Enter` | Send the message, or run a command | | ||
| 60 | +| `Esc` | Stop the answer being generated; what came stays and is part of the conversation | | ||
| 61 | +| `Ctrl-N` | New conversation (not while an answer is coming) | | ||
| 62 | +| `Ctrl-P` | Choose the model: `↑` `↓`, `Enter`; `Esc` closes the list | | ||
| 63 | +| `Ctrl-R` | Reasoning folded (one line with its length), hidden, shown | | ||
| 64 | +| `PgUp` `PgDn` | Scroll the conversation | | ||
| 65 | +| `←` `→` `Home` `End` `Ctrl-A` `Ctrl-E` `Backspace` `Delete` | Edit the message | | ||
| 66 | + | ||
| 67 | +| Command | Effect | | ||
| 68 | +| --- | --- | | ||
| 69 | +| `/set <name> <value>` | Sampling of the next messages: `temperature` (0–2), `top_p` (0–1), `top_k` (≥ 0), `min_p` (0–1), `max_tokens` (≥ 1), `thinking` (`on`, `off`, sent as `chat_template_kwargs.enable_thinking`) | | ||
| 70 | +| `/set <name>` | Give the setting back to the server's value | | ||
| 71 | +| `/set` | Show the settings | | ||
| 72 | +| `/clear` | New conversation | | ||
| 73 | +| `/help` | The keys and commands | | ||
| 74 | + | ||
| 75 | +The session starts with the `chat:` section and the `reasoning` key of the preferences. | ||
| 76 | + | ||
| 77 | +## Models (F3) | ||
| 78 | + | ||
| 79 | +The MLX models of the Hugging Face cache (the same as `rzb models list`), read from the disk; downloads in progress; a hint on the selected model. | ||
| 80 | + | ||
| 81 | +| Column | Content | | ||
| 82 | +| --- | --- | | ||
| 83 | +| `ID` | The Hugging Face id | | ||
| 84 | +| `KIND` | From the server's configuration or from the loaded model; `-` when neither tells | | ||
| 85 | +| `SIZE` | Disk space | | ||
| 86 | +| `LOADED` | `yes` when the server has it in memory | | ||
| 87 | +| `DECLARED AS` | The configuration's ids that point to it | | ||
| 88 | + | ||
| 89 | +The hint gives the selected model's size and the server's memory in use over its limit, with `more than is free now` when the model would not fit beside what is loaded. | ||
| 90 | + | ||
| 91 | +| Key | Effect | | ||
| 92 | +| --- | --- | | ||
| 93 | +| `↑` `↓` `PgUp` `PgDn` `Home` `End` | Select a model | | ||
| 94 | +| `p` | Type a Hugging Face id (`org/name`), `Enter` downloads it with the engine of the build (progress shown), `Esc` cancels | | ||
| 95 | +| `d`, `Delete` | Remove the selected model from the disk after `y` (any other key keeps it). A loaded model is unloaded first; while the server is using it, nothing is removed | | ||
| 96 | +| `r` | Read the cache again | | ||
| 97 | + | ||
| 98 | +## Settings (F4) | ||
| 99 | + | ||
| 100 | +Two sections: the preferences, as a form saved to the preferences file; the server's configuration file, the one given to `rzb tui --config`, else the one `GET /rzb/status` reports. | ||
| 101 | + | ||
| 102 | +| Key | Effect | | ||
| 103 | +| --- | --- | | ||
| 104 | +| `Tab` `Shift-Tab` `↑` `↓` | Move between the fields | | ||
| 105 | +| `Enter` | Check and save the preferences; the first wrong field is named | | ||
| 106 | +| `Esc` | Undo the changes not saved | | ||
| 107 | +| `Ctrl-O` | Open the server's file in `$VISUAL`, else `$EDITOR`, else `vi`; on return it is checked like `rzb config validate`, then the server reloads it | | ||
| 108 | +| `Ctrl-R` | Reload the server's file as it is | | ||
| 109 | + | ||
| 110 | +After a reload, the screen lists the models unloaded, those unloaded once idle, and the keys that need a restart of the server. A file with problems is not reloaded: the problems are listed with their lines. A server started without `--config` has no file. | ||
| 111 | + | ||
| 112 | +Saving the preferences applies at once the reasoning display, the chat sampling, the colours and the poll interval; the server URL and the API key variable apply the next time `rzb tui` starts. | ||
| 113 | + | ||
| 114 | +## Preferences file (tui.yaml) | ||
| 115 | + | ||
| 116 | +`~/.config/razorbill/tui.yaml`, or the file named by `RZB_TUI_PREFERENCES`. Every key is optional; a missing file means no preferences. The options of `rzb tui` win over the file, and the file wins over the server's `--config` file. | ||
| 117 | + | ||
| 118 | +| Key | Type | Default | Description | | ||
| 119 | +| --- | --- | --- | --- | | ||
| 120 | +| `server_url` | `http://…` | from `--config`, else `http://127.0.0.1:7920` | The server | | ||
| 121 | +| `api_key_env` | string | `RZB_API_KEY` | Environment variable holding the API key | | ||
| 122 | +| `reasoning` | `shown`, `folded`, `hidden` | `folded` | How the Chat screen shows reasoning | | ||
| 123 | +| `colors` | boolean | `true` | Colours (`NO_COLOR` turns them off whatever this says) | | ||
| 124 | +| `poll_interval` | duration (`500ms`, `2s`) | `1s` | How often `GET /rzb/status` is asked | | ||
| 125 | +| `chat.temperature` | number, 0–2 | the server's | Chat sampling | | ||
| 126 | +| `chat.top_p`, `chat.min_p` | number, 0–1 | the server's | Chat sampling | | ||
| 127 | +| `chat.top_k` | whole number ≥ 0 | the server's | Chat sampling | | ||
| 128 | +| `chat.max_tokens` | whole number ≥ 1 | the server's | Chat answer limit | | ||
| 129 | +| `chat.thinking` | boolean | the model's | Reasoning on or off | | ||
| 130 | + | ||
| 131 | +```yaml | ||
| 132 | +server_url: http://127.0.0.1:7920 | ||
| 133 | +reasoning: hidden | ||
| 134 | +poll_interval: 2s | ||
| 135 | +chat: | ||
| 136 | + temperature: 0.7 | ||
| 137 | + max_tokens: 1024 | ||
| 138 | +``` | ||
| 139 | + | ||
| 140 | +Unknown keys and wrong values are reported together, with their lines, and `rzb tui` exits with code 2. The Settings screen writes the file with the keys that are set, and a comment line at the top. | ||
| 141 | + | ||
| 142 | +## What it asks the server | ||
| 143 | + | ||
| 144 | +| Request | When | | ||
| 145 | +| --- | --- | | ||
| 146 | +| [`GET /rzb/status`](http-api.md#get-rzbstatus) | Every `poll_interval` | | ||
| 147 | +| `GET /v1/models` | When the Chat screen is first shown, and on `Ctrl-P` | | ||
| 148 | +| `POST /v1/chat/completions` | Each message, streamed with `stream_options.include_usage` | | ||
| 149 | +| [`POST /rzb/models/{id}/unload`](http-api.md#post-rzbmodelsidunload) | `u` on the Dashboard, `d` then `y` on a loaded model | | ||
| 150 | +| [`POST /rzb/config/reload`](http-api.md#post-rzbconfigreload) | `Ctrl-R`, and after `Ctrl-O` | | ||
| 151 | + | ||
| 152 | +All of them carry `Authorization: Bearer <key>` when a key is set. The `/rzb/` routes only answer the machine running the server. | ||
added
docs/en/tutorials/chat-from-the-terminal.md +91 -0 | new file mode 100644 | ||
| @@ -0,0 +1,91 @@ | ||
| 1 | +# Tutorial: chat with a local model from the terminal | |
| 2 | + | |
| 3 | +By the end of this tutorial, you will have the server running in one terminal and `rzb tui` in another, you will have chatted with a model on your Mac's GPU, and you will have watched the server load it and answer on the Dashboard. | |
| 4 | + | |
| 5 | +No knowledge of the HTTP API is required. | |
| 6 | + | |
| 7 | +## Prerequisites | |
| 8 | + | |
| 9 | +- A Mac with Apple Silicon and macOS 14 or later. | |
| 10 | +- `rzb` installed with `scripts/install.sh`, as described in [How to build rzb on the Mac](../how-to/build-on-the-mac.md), so that `rzb` runs from any folder. | |
| 11 | +- Two terminal windows, about 400 MB of free disk space, and an internet connection for the download. | |
| 12 | + | |
| 13 | +## Step 1 — Download a small model and describe the server | |
| 14 | + | |
| 15 | +In the first terminal, type: | |
| 16 | + | |
| 17 | +```bash | |
| 18 | +rzb models pull mlx-community/Qwen3-0.6B-4bit | |
| 19 | +mkdir -p ~/rzb-tutorial && cd ~/rzb-tutorial | |
| 20 | +cat > server.yaml <<'YAML' | |
| 21 | +models: | |
| 22 | + - id: qwen | |
| 23 | + source: mlx-community/Qwen3-0.6B-4bit | |
| 24 | +YAML | |
| 25 | +``` | |
| 26 | + | |
| 27 | +The download shows its progress and ends with a line saying the model is downloaded. We now have a model in the cache, and a configuration file that gives it the short name `qwen`. | |
| 28 | + | |
| 29 | +## Step 2 — Open rzb tui before the server | |
| 30 | + | |
| 31 | +Still in the first terminal, type: | |
| 32 | + | |
| 33 | +```bash | |
| 34 | +rzb tui --config server.yaml | |
| 35 | +``` | |
| 36 | + | |
| 37 | +The terminal turns into a full screen. You should see: | |
| 38 | + | |
| 39 | +``` | |
| 40 | + No razorbill server answers at http://127.0.0.1:7920. | |
| 41 | + | |
| 42 | + Start one in another terminal: | |
| 43 | + | |
| 44 | + rzb serve --config server.yaml | |
| 45 | +``` | |
| 46 | + | |
| 47 | +and, on the last row, `○ no server at http://127.0.0.1:7920`. `rzb tui` is only a window on a server: we start the server next. | |
| 48 | + | |
| 49 | +## Step 3 — Start the server | |
| 50 | + | |
| 51 | +In the second terminal, type: | |
| 52 | + | |
| 53 | +```bash | |
| 54 | +cd ~/rzb-tutorial | |
| 55 | +rzb serve --config server.yaml | |
| 56 | +``` | |
| 57 | + | |
| 58 | +Look at the first terminal: within a second the screen changes to the Dashboard, with a line starting with `Server rzb`, the engine's memory, and `none loaded` under Models. The last row now starts with `●`. We have the server and its window side by side. | |
| 59 | + | |
| 60 | +## Step 4 — Send a message | |
| 61 | + | |
| 62 | +In the first terminal, press `F1`. The Chat screen says `Model: qwen`. Type: | |
| 63 | + | |
| 64 | +``` | |
| 65 | +Say hi in five words. | |
| 66 | +``` | |
| 67 | + | |
| 68 | +and press `Enter`. The first answer takes a few seconds while the server loads the model: you see `⋯ waiting for the model…`. Then Qwen3 thinks before answering: a line `⋯ thinking (… words) · Ctrl-R to show` appears, then the answer after `qwen ›`, then a dim line such as `23+41 tokens · 85.3 tok/s`. The exact words and numbers differ on your Mac. | |
| 69 | + | |
| 70 | +We have chatted with a model on the GPU, through the server's OpenAI API. | |
| 71 | + | |
| 72 | +## Step 5 — Look at the reasoning | |
| 73 | + | |
| 74 | +Press `Ctrl-R` twice. The first press hides the reasoning line; the second shows the reasoning in full, in dim lines starting with `⋯`. Send a second message: the conversation is sent again whole. When the server could reuse what it had already read, the line under the answer also shows `… cached`. | |
| 75 | + | |
| 76 | +## Step 6 — Watch the server | |
| 77 | + | |
| 78 | +Press `F2`. Under Models, `qwen` is `loaded`, with its size and the time before the server unloads it if nobody uses it. Under Last requests, your two `POST /v1/chat/completions` are listed with their tokens, speed and duration. | |
| 79 | + | |
| 80 | +## Step 7 — Leave | |
| 81 | + | |
| 82 | +Press `Ctrl-Q`: the terminal comes back as it was. In the second terminal, press `Ctrl-C` to stop the server. | |
| 83 | + | |
| 84 | +## What now? | |
| 85 | + | |
| 86 | +You have run the server and its terminal interface, chatted with a model and watched it work. To go further: | |
| 87 | + | |
| 88 | +- To download or remove models from `rzb tui`: [manage models from rzb tui](../how-to/manage-models-from-the-tui.md). | |
| 89 | +- To change the server's configuration while it runs: [change the server's configuration from rzb tui](../how-to/change-the-server-configuration-from-the-tui.md). | |
| 90 | +- Every screen and key: [rzb tui reference](../reference/tui.md). | |
| 91 | +- Why it is a separate program: [the terminal interface](../explanation/terminal-interface.md). | |
| new file mode 100644 | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | +# Tutorial: chat with a local model from the terminal | ||
| 2 | + | ||
| 3 | +By the end of this tutorial, you will have the server running in one terminal and `rzb tui` in another, you will have chatted with a model on your Mac's GPU, and you will have watched the server load it and answer on the Dashboard. | ||
| 4 | + | ||
| 5 | +No knowledge of the HTTP API is required. | ||
| 6 | + | ||
| 7 | +## Prerequisites | ||
| 8 | + | ||
| 9 | +- A Mac with Apple Silicon and macOS 14 or later. | ||
| 10 | +- `rzb` installed with `scripts/install.sh`, as described in [How to build rzb on the Mac](../how-to/build-on-the-mac.md), so that `rzb` runs from any folder. | ||
| 11 | +- Two terminal windows, about 400 MB of free disk space, and an internet connection for the download. | ||
| 12 | + | ||
| 13 | +## Step 1 — Download a small model and describe the server | ||
| 14 | + | ||
| 15 | +In the first terminal, type: | ||
| 16 | + | ||
| 17 | +```bash | ||
| 18 | +rzb models pull mlx-community/Qwen3-0.6B-4bit | ||
| 19 | +mkdir -p ~/rzb-tutorial && cd ~/rzb-tutorial | ||
| 20 | +cat > server.yaml <<'YAML' | ||
| 21 | +models: | ||
| 22 | + - id: qwen | ||
| 23 | + source: mlx-community/Qwen3-0.6B-4bit | ||
| 24 | +YAML | ||
| 25 | +``` | ||
| 26 | + | ||
| 27 | +The download shows its progress and ends with a line saying the model is downloaded. We now have a model in the cache, and a configuration file that gives it the short name `qwen`. | ||
| 28 | + | ||
| 29 | +## Step 2 — Open rzb tui before the server | ||
| 30 | + | ||
| 31 | +Still in the first terminal, type: | ||
| 32 | + | ||
| 33 | +```bash | ||
| 34 | +rzb tui --config server.yaml | ||
| 35 | +``` | ||
| 36 | + | ||
| 37 | +The terminal turns into a full screen. You should see: | ||
| 38 | + | ||
| 39 | +``` | ||
| 40 | + No razorbill server answers at http://127.0.0.1:7920. | ||
| 41 | + | ||
| 42 | + Start one in another terminal: | ||
| 43 | + | ||
| 44 | + rzb serve --config server.yaml | ||
| 45 | +``` | ||
| 46 | + | ||
| 47 | +and, on the last row, `○ no server at http://127.0.0.1:7920`. `rzb tui` is only a window on a server: we start the server next. | ||
| 48 | + | ||
| 49 | +## Step 3 — Start the server | ||
| 50 | + | ||
| 51 | +In the second terminal, type: | ||
| 52 | + | ||
| 53 | +```bash | ||
| 54 | +cd ~/rzb-tutorial | ||
| 55 | +rzb serve --config server.yaml | ||
| 56 | +``` | ||
| 57 | + | ||
| 58 | +Look at the first terminal: within a second the screen changes to the Dashboard, with a line starting with `Server rzb`, the engine's memory, and `none loaded` under Models. The last row now starts with `●`. We have the server and its window side by side. | ||
| 59 | + | ||
| 60 | +## Step 4 — Send a message | ||
| 61 | + | ||
| 62 | +In the first terminal, press `F1`. The Chat screen says `Model: qwen`. Type: | ||
| 63 | + | ||
| 64 | +``` | ||
| 65 | +Say hi in five words. | ||
| 66 | +``` | ||
| 67 | + | ||
| 68 | +and press `Enter`. The first answer takes a few seconds while the server loads the model: you see `⋯ waiting for the model…`. Then Qwen3 thinks before answering: a line `⋯ thinking (… words) · Ctrl-R to show` appears, then the answer after `qwen ›`, then a dim line such as `23+41 tokens · 85.3 tok/s`. The exact words and numbers differ on your Mac. | ||
| 69 | + | ||
| 70 | +We have chatted with a model on the GPU, through the server's OpenAI API. | ||
| 71 | + | ||
| 72 | +## Step 5 — Look at the reasoning | ||
| 73 | + | ||
| 74 | +Press `Ctrl-R` twice. The first press hides the reasoning line; the second shows the reasoning in full, in dim lines starting with `⋯`. Send a second message: the conversation is sent again whole. When the server could reuse what it had already read, the line under the answer also shows `… cached`. | ||
| 75 | + | ||
| 76 | +## Step 6 — Watch the server | ||
| 77 | + | ||
| 78 | +Press `F2`. Under Models, `qwen` is `loaded`, with its size and the time before the server unloads it if nobody uses it. Under Last requests, your two `POST /v1/chat/completions` are listed with their tokens, speed and duration. | ||
| 79 | + | ||
| 80 | +## Step 7 — Leave | ||
| 81 | + | ||
| 82 | +Press `Ctrl-Q`: the terminal comes back as it was. In the second terminal, press `Ctrl-C` to stop the server. | ||
| 83 | + | ||
| 84 | +## What now? | ||
| 85 | + | ||
| 86 | +You have run the server and its terminal interface, chatted with a model and watched it work. To go further: | ||
| 87 | + | ||
| 88 | +- To download or remove models from `rzb tui`: [manage models from rzb tui](../how-to/manage-models-from-the-tui.md). | ||
| 89 | +- To change the server's configuration while it runs: [change the server's configuration from rzb tui](../how-to/change-the-server-configuration-from-the-tui.md). | ||
| 90 | +- Every screen and key: [rzb tui reference](../reference/tui.md). | ||
| 91 | +- Why it is a separate program: [the terminal interface](../explanation/terminal-interface.md). | ||
modified
docs/fr/README.md +5 -0 | @@ -7,6 +7,7 @@ Cette documentation suit [Diátaxis](https://diataxis.fr) : choisissez la sectio | ||
| 7 | 7 | ## Apprendre — tutoriels |
| 8 | 8 | |
| 9 | 9 | - [Vos premières requêtes à un modèle local](tutorials/premiers-pas.md) : télécharger un modèle, démarrer le serveur, l'appeler avec `curl` et avec la bibliothèque `openai`. |
| 10 | +- [Discuter avec un modèle local depuis le terminal](tutorials/discuter-depuis-le-terminal.md) : le serveur et `rzb tui` côte à côte, une conversation, le Dashboard. | |
| 10 | 11 | |
| 11 | 12 | ## Faire — guides pratiques |
| 12 | 13 | |
| @@ -15,6 +16,8 @@ Cette documentation suit [Diátaxis](https://diataxis.fr) : choisissez la sectio | ||
| 15 | 16 | - [Gérer les modèles](how-to/gerer-les-modeles.md) |
| 16 | 17 | - [Configurer le serveur](how-to/configurer-le-serveur.md) : noms de modèles, valeurs par défaut, verrous, limites, accès réseau. |
| 17 | 18 | - [Surveiller et piloter un serveur en marche](how-to/surveiller-et-piloter-le-serveur.md) : état, libération d'un modèle, rechargement de la configuration. |
| 19 | +- [Gérer les modèles depuis rzb tui](how-to/gerer-les-modeles-depuis-la-tui.md) : télécharger, supprimer, vérifier la taille. | |
| 20 | +- [Changer la configuration du serveur depuis rzb tui](how-to/changer-la-configuration-du-serveur-depuis-la-tui.md) : modifier, vérifier et recharger ; les préférences de la TUI elle-même. | |
| 18 | 21 | - [Utiliser razorbill depuis un client OpenAI](how-to/utiliser-des-clients-openai.md) : Python, JavaScript, LangChain, interfaces de chat. |
| 19 | 22 | - [Obtenir une sortie structurée](how-to/obtenir-une-sortie-structuree.md) |
| 20 | 23 | - [Utiliser l'appel de fonctions](how-to/utiliser-l-appel-de-fonctions.md) |
| @@ -28,6 +31,7 @@ Cette documentation suit [Diátaxis](https://diataxis.fr) : choisissez la sectio | ||
| 28 | 31 | - [API HTTP](reference/api-http.md) : endpoints, champs pris en charge, refusés et ignorés, réponses, streaming, routes d'administration locales. |
| 29 | 32 | - [Fichier de configuration du serveur](reference/configuration.md) : chaque clé, son type, sa valeur par défaut et ses erreurs. |
| 30 | 33 | - [Ligne de commande](reference/ligne-de-commande.md) : `rzb serve`, `rzb tui`, `rzb models`, `rzb config validate`, codes de sortie. |
| 34 | +- [rzb tui](reference/tui.md) : écrans, touches, commandes du chat, le fichier de préférences `tui.yaml`. | |
| 31 | 35 | - [Erreurs de l'API](reference/erreurs.md) : statuts, types et codes. |
| 32 | 36 | |
| 33 | 37 | ## Comprendre — explications |
| @@ -37,3 +41,4 @@ Cette documentation suit [Diátaxis](https://diataxis.fr) : choisissez la sectio | ||
| 37 | 41 | - [Décodage contraint](explanation/decodage-contraint.md) : comment le JSON et les appels d'outils sont garantis, et les limites. |
| 38 | 42 | - [Modèles qui raisonnent](explanation/reflexion.md) : comment le raisonnement est séparé, envoyé ou masqué, et limité. |
| 39 | 43 | - [Compatibilité OpenAI](explanation/compatibilite-openai.md) : ce que « compatible » veut dire ici, et comment c'est vérifié. |
| 44 | +- [L'interface en terminal](explanation/interface-terminal.md) : pourquoi `rzb tui` est un processus à part, comment il atteint ce qu'il montre, ce qui reste local. | |
| @@ -7,6 +7,7 @@ Cette documentation suit [Diátaxis](https://diataxis.fr) : choisissez la sectio | |||
| 7 | ## Apprendre — tutoriels | 7 | ## Apprendre — tutoriels |
| 8 | 8 | ||
| 9 | - [Vos premières requêtes à un modèle local](tutorials/premiers-pas.md) : télécharger un modèle, démarrer le serveur, l'appeler avec `curl` et avec la bibliothèque `openai`. | 9 | - [Vos premières requêtes à un modèle local](tutorials/premiers-pas.md) : télécharger un modèle, démarrer le serveur, l'appeler avec `curl` et avec la bibliothèque `openai`. |
| 10 | +- [Discuter avec un modèle local depuis le terminal](tutorials/discuter-depuis-le-terminal.md) : le serveur et `rzb tui` côte à côte, une conversation, le Dashboard. | ||
| 10 | 11 | ||
| 11 | ## Faire — guides pratiques | 12 | ## Faire — guides pratiques |
| 12 | 13 | ||
| @@ -15,6 +16,8 @@ Cette documentation suit [Diátaxis](https://diataxis.fr) : choisissez la sectio | |||
| 15 | - [Gérer les modèles](how-to/gerer-les-modeles.md) | 16 | - [Gérer les modèles](how-to/gerer-les-modeles.md) |
| 16 | - [Configurer le serveur](how-to/configurer-le-serveur.md) : noms de modèles, valeurs par défaut, verrous, limites, accès réseau. | 17 | - [Configurer le serveur](how-to/configurer-le-serveur.md) : noms de modèles, valeurs par défaut, verrous, limites, accès réseau. |
| 17 | - [Surveiller et piloter un serveur en marche](how-to/surveiller-et-piloter-le-serveur.md) : état, libération d'un modèle, rechargement de la configuration. | 18 | - [Surveiller et piloter un serveur en marche](how-to/surveiller-et-piloter-le-serveur.md) : état, libération d'un modèle, rechargement de la configuration. |
| 19 | +- [Gérer les modèles depuis rzb tui](how-to/gerer-les-modeles-depuis-la-tui.md) : télécharger, supprimer, vérifier la taille. | ||
| 20 | +- [Changer la configuration du serveur depuis rzb tui](how-to/changer-la-configuration-du-serveur-depuis-la-tui.md) : modifier, vérifier et recharger ; les préférences de la TUI elle-même. | ||
| 18 | - [Utiliser razorbill depuis un client OpenAI](how-to/utiliser-des-clients-openai.md) : Python, JavaScript, LangChain, interfaces de chat. | 21 | - [Utiliser razorbill depuis un client OpenAI](how-to/utiliser-des-clients-openai.md) : Python, JavaScript, LangChain, interfaces de chat. |
| 19 | - [Obtenir une sortie structurée](how-to/obtenir-une-sortie-structuree.md) | 22 | - [Obtenir une sortie structurée](how-to/obtenir-une-sortie-structuree.md) |
| 20 | - [Utiliser l'appel de fonctions](how-to/utiliser-l-appel-de-fonctions.md) | 23 | - [Utiliser l'appel de fonctions](how-to/utiliser-l-appel-de-fonctions.md) |
| @@ -28,6 +31,7 @@ Cette documentation suit [Diátaxis](https://diataxis.fr) : choisissez la sectio | |||
| 28 | - [API HTTP](reference/api-http.md) : endpoints, champs pris en charge, refusés et ignorés, réponses, streaming, routes d'administration locales. | 31 | - [API HTTP](reference/api-http.md) : endpoints, champs pris en charge, refusés et ignorés, réponses, streaming, routes d'administration locales. |
| 29 | - [Fichier de configuration du serveur](reference/configuration.md) : chaque clé, son type, sa valeur par défaut et ses erreurs. | 32 | - [Fichier de configuration du serveur](reference/configuration.md) : chaque clé, son type, sa valeur par défaut et ses erreurs. |
| 30 | - [Ligne de commande](reference/ligne-de-commande.md) : `rzb serve`, `rzb tui`, `rzb models`, `rzb config validate`, codes de sortie. | 33 | - [Ligne de commande](reference/ligne-de-commande.md) : `rzb serve`, `rzb tui`, `rzb models`, `rzb config validate`, codes de sortie. |
| 34 | +- [rzb tui](reference/tui.md) : écrans, touches, commandes du chat, le fichier de préférences `tui.yaml`. | ||
| 31 | - [Erreurs de l'API](reference/erreurs.md) : statuts, types et codes. | 35 | - [Erreurs de l'API](reference/erreurs.md) : statuts, types et codes. |
| 32 | 36 | ||
| 33 | ## Comprendre — explications | 37 | ## Comprendre — explications |
| @@ -37,3 +41,4 @@ Cette documentation suit [Diátaxis](https://diataxis.fr) : choisissez la sectio | |||
| 37 | - [Décodage contraint](explanation/decodage-contraint.md) : comment le JSON et les appels d'outils sont garantis, et les limites. | 41 | - [Décodage contraint](explanation/decodage-contraint.md) : comment le JSON et les appels d'outils sont garantis, et les limites. |
| 38 | - [Modèles qui raisonnent](explanation/reflexion.md) : comment le raisonnement est séparé, envoyé ou masqué, et limité. | 42 | - [Modèles qui raisonnent](explanation/reflexion.md) : comment le raisonnement est séparé, envoyé ou masqué, et limité. |
| 39 | - [Compatibilité OpenAI](explanation/compatibilite-openai.md) : ce que « compatible » veut dire ici, et comment c'est vérifié. | 43 | - [Compatibilité OpenAI](explanation/compatibilite-openai.md) : ce que « compatible » veut dire ici, et comment c'est vérifié. |
| 44 | +- [L'interface en terminal](explanation/interface-terminal.md) : pourquoi `rzb tui` est un processus à part, comment il atteint ce qu'il montre, ce qui reste local. | ||
modified
docs/fr/explanation/architecture.md +1 -0 | @@ -54,3 +54,4 @@ MLX fournit des shaders Metal qui doivent être compilés dans un `default.metal | ||
| 54 | 54 | - Comment les modèles sont chargés, partagés et déchargés : [cycle de vie des modèles](cycle-de-vie-des-modeles.md). |
| 55 | 55 | - Comment le JSON et les appels d'outils sont garantis : [décodage contraint](decodage-contraint.md). |
| 56 | 56 | - Comment le raisonnement est séparé des réponses : [modèles qui raisonnent](reflexion.md). |
| 57 | +- Pourquoi `rzb tui` est un processus à part : [l'interface en terminal](interface-terminal.md). | |
| @@ -54,3 +54,4 @@ MLX fournit des shaders Metal qui doivent être compilés dans un `default.metal | |||
| 54 | - Comment les modèles sont chargés, partagés et déchargés : [cycle de vie des modèles](cycle-de-vie-des-modeles.md). | 54 | - Comment les modèles sont chargés, partagés et déchargés : [cycle de vie des modèles](cycle-de-vie-des-modeles.md). |
| 55 | - Comment le JSON et les appels d'outils sont garantis : [décodage contraint](decodage-contraint.md). | 55 | - Comment le JSON et les appels d'outils sont garantis : [décodage contraint](decodage-contraint.md). |
| 56 | - Comment le raisonnement est séparé des réponses : [modèles qui raisonnent](reflexion.md). | 56 | - Comment le raisonnement est séparé des réponses : [modèles qui raisonnent](reflexion.md). |
| 57 | +- Pourquoi `rzb tui` est un processus à part : [l'interface en terminal](interface-terminal.md). | ||
added
docs/fr/explanation/interface-terminal.md +44 -0 | new file mode 100644 | ||
| @@ -0,0 +1,44 @@ | ||
| 1 | +# L'interface en terminal — explication | |
| 2 | + | |
| 3 | +## De quoi s'agit-il ? | |
| 4 | + | |
| 5 | +`rzb tui` est un programme plein écran pour la personne devant le Mac : discuter avec les modèles du serveur, voir ce que le serveur détient, gérer le cache des modèles, changer la configuration. Cette page explique pourquoi c'est un processus à part, comment il atteint ce qu'il montre, et ce qu'il garde volontairement en local. | |
| 6 | + | |
| 7 | +## Un second processus, pas un mode du serveur | |
| 8 | + | |
| 9 | +Le serveur est fait pour tourner longtemps, en arrière-plan, éventuellement lancé à l'ouverture de session. Une fenêtre de terminal est faite pour aller et venir. Mettre l'interface dans `rzb serve` lierait les deux durées de vie : fermer la fenêtre arrêterait le serveur, et un plantage du code d'affichage emporterait les modèles avec lui. En second processus `rzb` sur la même machine, l'interface peut s'ouvrir, se fermer et se rouvrir pendant que le serveur continue de servir tous les autres clients. | |
| 10 | + | |
| 11 | +## Trois façons d'atteindre les choses | |
| 12 | + | |
| 13 | +L'interface utilise le canal qui existe déjà pour chaque sorte de chose : | |
| 14 | + | |
| 15 | +- **L'API OpenAI** pour discuter. L'écran Chat est un client comme un autre ; il envoie la conversation entière à chaque message, comme les clients OpenAI, et le cache de prompt du serveur évite de la relire. Effet de bord utile : l'interface fait travailler la même API que tous les autres clients. | |
| 16 | +- **Les routes `/rzb/`** pour ce que seul le processus du serveur sait : les modèles en mémoire, les files d'attente, la mémoire du moteur, les dernières requêtes, le déchargement d'un modèle, le rechargement de la configuration. | |
| 17 | +- **Le disque** pour ce qui est sur le disque : le cache Hugging Face, lu et nettoyé comme le fait `rzb models`, et le fichier de configuration, ouvert comme n'importe quel fichier. Leur ajouter des routes ferait du serveur un gestionnaire de fichiers. | |
| 18 | + | |
| 19 | +Télécharger demande le moteur, qui vit dans la partie MLX de `rzb`. L'interface elle-même n'embarque pas MLX, pour se compiler et se tester sous Linux comme le serveur ; la ligne de commande lui passe la fonction de téléchargement du moteur. | |
| 20 | + | |
| 21 | +## Ce qui reste local | |
| 22 | + | |
| 23 | +Les routes `/rzb/` ne répondent qu'à la machine elle-même. Elles agissent sur le serveur pour tout le monde et montrent ce que font les autres clients, donc la personne autorisée à s'en servir est celle qui est devant le Mac. `rzb tui` suit la même ligne : il est fait pour un serveur sur la même machine, et un serveur sur une autre répond 403. La redirection de port par `ssh` est le moyen de s'en servir d'ailleurs, parce que le serveur voit alors une connexion locale. | |
| 24 | + | |
| 25 | +## Interroger plutôt qu'écouter des événements | |
| 26 | + | |
| 27 | +Le Dashboard demande l'état chaque seconde. Un rafraîchissement coûte quelques centaines d'octets, ne garde aucune connexion ouverte, et marche pareil avec `curl`. Un flux d'événements serait une deuxième façon d'apprendre le même état, à garder cohérente avec la première, pour un affichage qui change à vitesse humaine. | |
| 28 | + | |
| 29 | +## Le fichier du serveur dans un éditeur, les préférences dans un formulaire | |
| 30 | + | |
| 31 | +La configuration du serveur est un fichier qu'on écrit à la main, avec des commentaires qui expliquent ses choix. Le réécrire depuis un formulaire perdrait ces commentaires, parce que la bibliothèque YAML ne les garde pas. `rzb tui` l'ouvre donc dans l'éditeur de l'utilisateur, le vérifie au retour avec la même validation que `rzb config validate`, et seulement ensuite demande au serveur de le recharger ; un fichier qui a des erreurs n'atteint jamais le serveur. Les préférences de l'interface sont un petit fichier qu'elle écrit elle-même, donc un formulaire est la façon la plus simple de les changer. | |
| 32 | + | |
| 33 | +## Alternatives écartées | |
| 34 | + | |
| 35 | +- **L'interface dans `rzb serve`** (`rzb serve --tui`) : un seul processus, mais la vie du serveur dépendrait d'un terminal. | |
| 36 | +- **Des événements envoyés par le serveur pour le Dashboard** : des mises à jour immédiates, au prix d'un second protocole pour la même information. | |
| 37 | +- **Des formulaires pour le fichier du serveur** : confortables, mais les commentaires seraient perdus à chaque enregistrement. | |
| 38 | +- **Des routes pour le cache des modèles** (`/rzb/models` pour lister, télécharger, supprimer) : l'interface n'aurait pas besoin du disque, mais le serveur prendrait des tâches de gestion de fichiers que `rzb models` couvre déjà. | |
| 39 | + | |
| 40 | +## Lien avec le reste | |
| 41 | + | |
| 42 | +- Les routes qu'elle appelle : [référence de l'API HTTP](../reference/api-http.md#routes-dadministration-locales-rzb) ; pourquoi elles existent : [compatibilité OpenAI](compatibilite-openai.md#des-routes-à-nous-sous-rzb). | |
| 43 | +- La place de son module : [architecture](architecture.md). | |
| 44 | +- S'en servir : [tutoriel](../tutorials/discuter-depuis-le-terminal.md), [référence](../reference/tui.md). | |
| new file mode 100644 | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | +# L'interface en terminal — explication | ||
| 2 | + | ||
| 3 | +## De quoi s'agit-il ? | ||
| 4 | + | ||
| 5 | +`rzb tui` est un programme plein écran pour la personne devant le Mac : discuter avec les modèles du serveur, voir ce que le serveur détient, gérer le cache des modèles, changer la configuration. Cette page explique pourquoi c'est un processus à part, comment il atteint ce qu'il montre, et ce qu'il garde volontairement en local. | ||
| 6 | + | ||
| 7 | +## Un second processus, pas un mode du serveur | ||
| 8 | + | ||
| 9 | +Le serveur est fait pour tourner longtemps, en arrière-plan, éventuellement lancé à l'ouverture de session. Une fenêtre de terminal est faite pour aller et venir. Mettre l'interface dans `rzb serve` lierait les deux durées de vie : fermer la fenêtre arrêterait le serveur, et un plantage du code d'affichage emporterait les modèles avec lui. En second processus `rzb` sur la même machine, l'interface peut s'ouvrir, se fermer et se rouvrir pendant que le serveur continue de servir tous les autres clients. | ||
| 10 | + | ||
| 11 | +## Trois façons d'atteindre les choses | ||
| 12 | + | ||
| 13 | +L'interface utilise le canal qui existe déjà pour chaque sorte de chose : | ||
| 14 | + | ||
| 15 | +- **L'API OpenAI** pour discuter. L'écran Chat est un client comme un autre ; il envoie la conversation entière à chaque message, comme les clients OpenAI, et le cache de prompt du serveur évite de la relire. Effet de bord utile : l'interface fait travailler la même API que tous les autres clients. | ||
| 16 | +- **Les routes `/rzb/`** pour ce que seul le processus du serveur sait : les modèles en mémoire, les files d'attente, la mémoire du moteur, les dernières requêtes, le déchargement d'un modèle, le rechargement de la configuration. | ||
| 17 | +- **Le disque** pour ce qui est sur le disque : le cache Hugging Face, lu et nettoyé comme le fait `rzb models`, et le fichier de configuration, ouvert comme n'importe quel fichier. Leur ajouter des routes ferait du serveur un gestionnaire de fichiers. | ||
| 18 | + | ||
| 19 | +Télécharger demande le moteur, qui vit dans la partie MLX de `rzb`. L'interface elle-même n'embarque pas MLX, pour se compiler et se tester sous Linux comme le serveur ; la ligne de commande lui passe la fonction de téléchargement du moteur. | ||
| 20 | + | ||
| 21 | +## Ce qui reste local | ||
| 22 | + | ||
| 23 | +Les routes `/rzb/` ne répondent qu'à la machine elle-même. Elles agissent sur le serveur pour tout le monde et montrent ce que font les autres clients, donc la personne autorisée à s'en servir est celle qui est devant le Mac. `rzb tui` suit la même ligne : il est fait pour un serveur sur la même machine, et un serveur sur une autre répond 403. La redirection de port par `ssh` est le moyen de s'en servir d'ailleurs, parce que le serveur voit alors une connexion locale. | ||
| 24 | + | ||
| 25 | +## Interroger plutôt qu'écouter des événements | ||
| 26 | + | ||
| 27 | +Le Dashboard demande l'état chaque seconde. Un rafraîchissement coûte quelques centaines d'octets, ne garde aucune connexion ouverte, et marche pareil avec `curl`. Un flux d'événements serait une deuxième façon d'apprendre le même état, à garder cohérente avec la première, pour un affichage qui change à vitesse humaine. | ||
| 28 | + | ||
| 29 | +## Le fichier du serveur dans un éditeur, les préférences dans un formulaire | ||
| 30 | + | ||
| 31 | +La configuration du serveur est un fichier qu'on écrit à la main, avec des commentaires qui expliquent ses choix. Le réécrire depuis un formulaire perdrait ces commentaires, parce que la bibliothèque YAML ne les garde pas. `rzb tui` l'ouvre donc dans l'éditeur de l'utilisateur, le vérifie au retour avec la même validation que `rzb config validate`, et seulement ensuite demande au serveur de le recharger ; un fichier qui a des erreurs n'atteint jamais le serveur. Les préférences de l'interface sont un petit fichier qu'elle écrit elle-même, donc un formulaire est la façon la plus simple de les changer. | ||
| 32 | + | ||
| 33 | +## Alternatives écartées | ||
| 34 | + | ||
| 35 | +- **L'interface dans `rzb serve`** (`rzb serve --tui`) : un seul processus, mais la vie du serveur dépendrait d'un terminal. | ||
| 36 | +- **Des événements envoyés par le serveur pour le Dashboard** : des mises à jour immédiates, au prix d'un second protocole pour la même information. | ||
| 37 | +- **Des formulaires pour le fichier du serveur** : confortables, mais les commentaires seraient perdus à chaque enregistrement. | ||
| 38 | +- **Des routes pour le cache des modèles** (`/rzb/models` pour lister, télécharger, supprimer) : l'interface n'aurait pas besoin du disque, mais le serveur prendrait des tâches de gestion de fichiers que `rzb models` couvre déjà. | ||
| 39 | + | ||
| 40 | +## Lien avec le reste | ||
| 41 | + | ||
| 42 | +- Les routes qu'elle appelle : [référence de l'API HTTP](../reference/api-http.md#routes-dadministration-locales-rzb) ; pourquoi elles existent : [compatibilité OpenAI](compatibilite-openai.md#des-routes-à-nous-sous-rzb). | ||
| 43 | +- La place de son module : [architecture](architecture.md). | ||
| 44 | +- S'en servir : [tutoriel](../tutorials/discuter-depuis-le-terminal.md), [référence](../reference/tui.md). | ||
added
docs/fr/how-to/changer-la-configuration-du-serveur-depuis-la-tui.md +37 -0 | new file mode 100644 | ||
| @@ -0,0 +1,37 @@ | ||
| 1 | +# Changer la configuration du serveur depuis rzb tui | |
| 2 | + | |
| 3 | +Ce guide montre comment modifier depuis `rzb tui` le fichier de configuration du serveur en marche, le faire vérifier et recharger, et comment changer les préférences de `rzb tui` lui-même. Il suppose que le serveur a été démarré avec `rzb serve --config <fichier>`. | |
| 4 | + | |
| 5 | +## Modifier le fichier du serveur | |
| 6 | + | |
| 7 | +1. Appuie sur `F4`. Sous Server configuration, la ligne `file:` nomme le fichier. | |
| 8 | +2. Appuie sur `Ctrl-O`. Le fichier s'ouvre dans ton éditeur (`$VISUAL`, sinon `$EDITOR`, sinon `vi`). | |
| 9 | +3. Modifie-le, enregistre, et quitte l'éditeur. | |
| 10 | +4. De retour dans `rzb tui`, lis le résultat sous la section : | |
| 11 | + - les problèmes sont listés avec leurs numéros de ligne, et le serveur garde sa configuration : appuie sur `Ctrl-O` pour corriger le fichier ; | |
| 12 | + - sinon le serveur l'a rechargé, et la ligne dit combien de modèles sont déclarés, quels modèles chargés ont été déchargés, et quelles clés `server:` ne s'appliquent qu'après un redémarrage. | |
| 13 | +5. Si des clés demandent un redémarrage, arrête le serveur et relance-le. | |
| 14 | + | |
| 15 | +Pour choisir l'éditeur le temps d'une session : `EDITOR=nano rzb tui --config server.yaml`. | |
| 16 | + | |
| 17 | +## Recharger un fichier modifié ailleurs | |
| 18 | + | |
| 19 | +Modifie le fichier avec n'importe quel outil, puis appuie sur `Ctrl-R` sur l'écran Settings. C'est la même chose que `curl -X POST http://127.0.0.1:7920/rzb/config/reload`. | |
| 20 | + | |
| 21 | +## Changer les préférences de rzb tui | |
| 22 | + | |
| 23 | +1. Sur l'écran Settings, passe d'un champ à l'autre avec `Tab` ou les flèches, et tape. | |
| 24 | +2. Appuie sur `Entrée` pour enregistrer. Un champ faux est nommé et rien n'est enregistré ; `Échap` annule les changements. | |
| 25 | + | |
| 26 | +L'affichage du raisonnement, l'échantillonnage du chat, les couleurs et l'intervalle d'interrogation changent tout de suite ; l'URL du serveur et la variable de la clé d'API s'appliquent au prochain démarrage de `rzb tui`. | |
| 27 | + | |
| 28 | +## Variantes | |
| 29 | + | |
| 30 | +- **La ligne du fichier indique none** : le serveur tourne sans `--config`. Arrête-le et relance-le avec un fichier ; `rzb tui` ne peut pas en ajouter un à un serveur en marche. | |
| 31 | +- **Le serveur a une clé d'API** : lance `rzb tui` avec `--api-key-env` qui nomme sa variable, ou renseigne `api_key_env` dans les préférences. | |
| 32 | + | |
| 33 | +## Voir aussi | |
| 34 | + | |
| 35 | +- Ce que change un rechargement, clé par clé : [référence de la configuration](../reference/configuration.md#rechargement). | |
| 36 | +- Le fichier de préférences : [référence de rzb tui](../reference/tui.md#fichier-de-préférences-tuiyaml). | |
| 37 | +- La même chose depuis le shell : [surveiller et piloter un serveur en marche](surveiller-et-piloter-le-serveur.md#appliquer-un-changement-de-configuration-sans-redémarrer). | |
| new file mode 100644 | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | +# Changer la configuration du serveur depuis rzb tui | ||
| 2 | + | ||
| 3 | +Ce guide montre comment modifier depuis `rzb tui` le fichier de configuration du serveur en marche, le faire vérifier et recharger, et comment changer les préférences de `rzb tui` lui-même. Il suppose que le serveur a été démarré avec `rzb serve --config <fichier>`. | ||
| 4 | + | ||
| 5 | +## Modifier le fichier du serveur | ||
| 6 | + | ||
| 7 | +1. Appuie sur `F4`. Sous Server configuration, la ligne `file:` nomme le fichier. | ||
| 8 | +2. Appuie sur `Ctrl-O`. Le fichier s'ouvre dans ton éditeur (`$VISUAL`, sinon `$EDITOR`, sinon `vi`). | ||
| 9 | +3. Modifie-le, enregistre, et quitte l'éditeur. | ||
| 10 | +4. De retour dans `rzb tui`, lis le résultat sous la section : | ||
| 11 | + - les problèmes sont listés avec leurs numéros de ligne, et le serveur garde sa configuration : appuie sur `Ctrl-O` pour corriger le fichier ; | ||
| 12 | + - sinon le serveur l'a rechargé, et la ligne dit combien de modèles sont déclarés, quels modèles chargés ont été déchargés, et quelles clés `server:` ne s'appliquent qu'après un redémarrage. | ||
| 13 | +5. Si des clés demandent un redémarrage, arrête le serveur et relance-le. | ||
| 14 | + | ||
| 15 | +Pour choisir l'éditeur le temps d'une session : `EDITOR=nano rzb tui --config server.yaml`. | ||
| 16 | + | ||
| 17 | +## Recharger un fichier modifié ailleurs | ||
| 18 | + | ||
| 19 | +Modifie le fichier avec n'importe quel outil, puis appuie sur `Ctrl-R` sur l'écran Settings. C'est la même chose que `curl -X POST http://127.0.0.1:7920/rzb/config/reload`. | ||
| 20 | + | ||
| 21 | +## Changer les préférences de rzb tui | ||
| 22 | + | ||
| 23 | +1. Sur l'écran Settings, passe d'un champ à l'autre avec `Tab` ou les flèches, et tape. | ||
| 24 | +2. Appuie sur `Entrée` pour enregistrer. Un champ faux est nommé et rien n'est enregistré ; `Échap` annule les changements. | ||
| 25 | + | ||
| 26 | +L'affichage du raisonnement, l'échantillonnage du chat, les couleurs et l'intervalle d'interrogation changent tout de suite ; l'URL du serveur et la variable de la clé d'API s'appliquent au prochain démarrage de `rzb tui`. | ||
| 27 | + | ||
| 28 | +## Variantes | ||
| 29 | + | ||
| 30 | +- **La ligne du fichier indique none** : le serveur tourne sans `--config`. Arrête-le et relance-le avec un fichier ; `rzb tui` ne peut pas en ajouter un à un serveur en marche. | ||
| 31 | +- **Le serveur a une clé d'API** : lance `rzb tui` avec `--api-key-env` qui nomme sa variable, ou renseigne `api_key_env` dans les préférences. | ||
| 32 | + | ||
| 33 | +## Voir aussi | ||
| 34 | + | ||
| 35 | +- Ce que change un rechargement, clé par clé : [référence de la configuration](../reference/configuration.md#rechargement). | ||
| 36 | +- Le fichier de préférences : [référence de rzb tui](../reference/tui.md#fichier-de-préférences-tuiyaml). | ||
| 37 | +- La même chose depuis le shell : [surveiller et piloter un serveur en marche](surveiller-et-piloter-le-serveur.md#appliquer-un-changement-de-configuration-sans-redémarrer). | ||
added
docs/fr/how-to/gerer-les-modeles-depuis-la-tui.md +32 -0 | new file mode 100644 | ||
| @@ -0,0 +1,32 @@ | ||
| 1 | +# Gérer les modèles depuis rzb tui | |
| 2 | + | |
| 3 | +Ce guide montre comment télécharger, supprimer et vérifier des modèles sur l'écran Models de `rzb tui`. Il suppose que `rzb tui` est ouvert ; lance-le avec `--config` pour voir les modèles que déclare le serveur. | |
| 4 | + | |
| 5 | +## Télécharger un modèle | |
| 6 | + | |
| 7 | +1. Appuie sur `F3`. | |
| 8 | +2. Appuie sur `p`, tape l'id Hugging Face, par exemple `mlx-community/Qwen3-1.7B-4bit`, et appuie sur `Entrée`. | |
| 9 | +3. Suis la ligne `↓` : elle montre la progression. À la fin, `downloaded …` s'affiche et le modèle est dans la liste. | |
| 10 | + | |
| 11 | +Le téléchargement est celui que fait `rzb models pull`, avec la même règle : seuls les modèles au format MLX sont listés. Appuie sur `Échap` au lieu d'`Entrée` pour renoncer avant qu'il commence. | |
| 12 | + | |
| 13 | +## Supprimer un modèle | |
| 14 | + | |
| 15 | +1. Choisis-le avec `↑` `↓`. | |
| 16 | +2. Appuie sur `d`, puis sur `y`. Toute autre touche le garde. | |
| 17 | + | |
| 18 | +Quand le serveur a ce modèle chargé, il est d'abord déchargé. Si une requête l'utilise, rien n'est supprimé et l'écran dit pourquoi : réessaie quand le Dashboard le montre au repos. | |
| 19 | + | |
| 20 | +## Vérifier qu'un modèle tient avant de le charger | |
| 21 | + | |
| 22 | +Choisis-le : la ligne sous la liste donne sa taille et la mémoire du serveur utilisée sur sa limite, et indique `more than is free now` quand il ne tiendrait pas à côté des modèles déjà chargés. Le serveur décharge alors les modèles au repos pour faire de la place, ou répond 503 quand il ne peut pas. | |
| 23 | + | |
| 24 | +## Variantes | |
| 25 | + | |
| 26 | +- **Tu as téléchargé un modèle dans un autre terminal** (`rzb models pull`) : appuie sur `r` pour relire le cache. | |
| 27 | +- **`DECLARED AS` est vide pour tous les modèles** : `rzb tui` a été lancé sans `--config` et le serveur tourne sans, donc aucun nom déclaré n'est connu. | |
| 28 | + | |
| 29 | +## Voir aussi | |
| 30 | + | |
| 31 | +- Chaque colonne et chaque touche de l'écran : [référence de rzb tui](../reference/tui.md#models-f3). | |
| 32 | +- Les mêmes tâches en ligne de commande : [gérer les modèles](gerer-les-modeles.md). | |
| new file mode 100644 | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | +# Gérer les modèles depuis rzb tui | ||
| 2 | + | ||
| 3 | +Ce guide montre comment télécharger, supprimer et vérifier des modèles sur l'écran Models de `rzb tui`. Il suppose que `rzb tui` est ouvert ; lance-le avec `--config` pour voir les modèles que déclare le serveur. | ||
| 4 | + | ||
| 5 | +## Télécharger un modèle | ||
| 6 | + | ||
| 7 | +1. Appuie sur `F3`. | ||
| 8 | +2. Appuie sur `p`, tape l'id Hugging Face, par exemple `mlx-community/Qwen3-1.7B-4bit`, et appuie sur `Entrée`. | ||
| 9 | +3. Suis la ligne `↓` : elle montre la progression. À la fin, `downloaded …` s'affiche et le modèle est dans la liste. | ||
| 10 | + | ||
| 11 | +Le téléchargement est celui que fait `rzb models pull`, avec la même règle : seuls les modèles au format MLX sont listés. Appuie sur `Échap` au lieu d'`Entrée` pour renoncer avant qu'il commence. | ||
| 12 | + | ||
| 13 | +## Supprimer un modèle | ||
| 14 | + | ||
| 15 | +1. Choisis-le avec `↑` `↓`. | ||
| 16 | +2. Appuie sur `d`, puis sur `y`. Toute autre touche le garde. | ||
| 17 | + | ||
| 18 | +Quand le serveur a ce modèle chargé, il est d'abord déchargé. Si une requête l'utilise, rien n'est supprimé et l'écran dit pourquoi : réessaie quand le Dashboard le montre au repos. | ||
| 19 | + | ||
| 20 | +## Vérifier qu'un modèle tient avant de le charger | ||
| 21 | + | ||
| 22 | +Choisis-le : la ligne sous la liste donne sa taille et la mémoire du serveur utilisée sur sa limite, et indique `more than is free now` quand il ne tiendrait pas à côté des modèles déjà chargés. Le serveur décharge alors les modèles au repos pour faire de la place, ou répond 503 quand il ne peut pas. | ||
| 23 | + | ||
| 24 | +## Variantes | ||
| 25 | + | ||
| 26 | +- **Tu as téléchargé un modèle dans un autre terminal** (`rzb models pull`) : appuie sur `r` pour relire le cache. | ||
| 27 | +- **`DECLARED AS` est vide pour tous les modèles** : `rzb tui` a été lancé sans `--config` et le serveur tourne sans, donc aucun nom déclaré n'est connu. | ||
| 28 | + | ||
| 29 | +## Voir aussi | ||
| 30 | + | ||
| 31 | +- Chaque colonne et chaque touche de l'écran : [référence de rzb tui](../reference/tui.md#models-f3). | ||
| 32 | +- Les mêmes tâches en ligne de commande : [gérer les modèles](gerer-les-modeles.md). | ||
modified
docs/fr/reference/api-http.md +2 -1 | @@ -327,6 +327,7 @@ curl -s http://127.0.0.1:7920/rzb/status | ||
| 327 | 327 | | `version` | chaîne | La version de razorbill | |
| 328 | 328 | | `uptime_seconds` | entier | Secondes écoulées depuis le démarrage du serveur | |
| 329 | 329 | | `host`, `port` | chaîne, entier | L'adresse configurée (`port` vaut `0` quand le serveur a choisi un port libre) | |
| 330 | +| `config_file` | chaîne ou `null` | Le fichier `--config` en chemin absolu ; `null` sans lui | | |
| 330 | 331 | | `models` | tableau | Les modèles chargés ou en cours de chargement, triés par `key` (tableau ci-dessous) ; `[]` s'il n'y en a aucun | |
| 331 | 332 | | `recent_requests` | tableau | Les 50 dernières requêtes traitées, la plus récente d'abord, chacune enregistrée une fois son dernier octet envoyé (tableau ci-dessous) | |
| 332 | 333 | | `memory` | objet ou `null` | La mémoire du moteur (tableau ci-dessous) ; `null` quand le moteur ne sait pas la mesurer (la version Linux) | |
| @@ -363,7 +364,7 @@ curl -s http://127.0.0.1:7920/rzb/status | ||
| 363 | 364 | Exemple, après une requête de chat : |
| 364 | 365 | |
| 365 | 366 | ```json |
| 366 | -{"host": "127.0.0.1", "port": 7920, "uptime_seconds": 34, "version": "0.2.0", | |
| 367 | +{"config_file": "/Users/me/server.yaml", "host": "127.0.0.1", "port": 7920, "uptime_seconds": 34, "version": "0.2.0", | |
| 367 | 368 | "memory": {"active_bytes": 364743776, "cache_bytes": 23594047, "limit_bytes": 32641751449, "peak_bytes": 408882564}, |
| 368 | 369 | "models": [{"busy": false, "idle_seconds": 7, "keep_alive_left_seconds": 592.9, "key": "mlx-community/Qwen3-0.6B-4bit", |
| 369 | 370 | "kind": "chat", "name": "qwen", "queued": 0, "size_bytes": 335450584, "state": "loaded"}], |
| @@ -327,6 +327,7 @@ curl -s http://127.0.0.1:7920/rzb/status | |||
| 327 | | `version` | chaîne | La version de razorbill | | 327 | | `version` | chaîne | La version de razorbill | |
| 328 | | `uptime_seconds` | entier | Secondes écoulées depuis le démarrage du serveur | | 328 | | `uptime_seconds` | entier | Secondes écoulées depuis le démarrage du serveur | |
| 329 | | `host`, `port` | chaîne, entier | L'adresse configurée (`port` vaut `0` quand le serveur a choisi un port libre) | | 329 | | `host`, `port` | chaîne, entier | L'adresse configurée (`port` vaut `0` quand le serveur a choisi un port libre) | |
| 330 | +| `config_file` | chaîne ou `null` | Le fichier `--config` en chemin absolu ; `null` sans lui | | ||
| 330 | | `models` | tableau | Les modèles chargés ou en cours de chargement, triés par `key` (tableau ci-dessous) ; `[]` s'il n'y en a aucun | | 331 | | `models` | tableau | Les modèles chargés ou en cours de chargement, triés par `key` (tableau ci-dessous) ; `[]` s'il n'y en a aucun | |
| 331 | | `recent_requests` | tableau | Les 50 dernières requêtes traitées, la plus récente d'abord, chacune enregistrée une fois son dernier octet envoyé (tableau ci-dessous) | | 332 | | `recent_requests` | tableau | Les 50 dernières requêtes traitées, la plus récente d'abord, chacune enregistrée une fois son dernier octet envoyé (tableau ci-dessous) | |
| 332 | | `memory` | objet ou `null` | La mémoire du moteur (tableau ci-dessous) ; `null` quand le moteur ne sait pas la mesurer (la version Linux) | | 333 | | `memory` | objet ou `null` | La mémoire du moteur (tableau ci-dessous) ; `null` quand le moteur ne sait pas la mesurer (la version Linux) | |
| @@ -363,7 +364,7 @@ curl -s http://127.0.0.1:7920/rzb/status | |||
| 363 | Exemple, après une requête de chat : | 364 | Exemple, après une requête de chat : |
| 364 | 365 | ||
| 365 | ```json | 366 | ```json |
| 366 | -{"host": "127.0.0.1", "port": 7920, "uptime_seconds": 34, "version": "0.2.0", | 367 | +{"config_file": "/Users/me/server.yaml", "host": "127.0.0.1", "port": 7920, "uptime_seconds": 34, "version": "0.2.0", |
| 367 | "memory": {"active_bytes": 364743776, "cache_bytes": 23594047, "limit_bytes": 32641751449, "peak_bytes": 408882564}, | 368 | "memory": {"active_bytes": 364743776, "cache_bytes": 23594047, "limit_bytes": 32641751449, "peak_bytes": 408882564}, |
| 368 | "models": [{"busy": false, "idle_seconds": 7, "keep_alive_left_seconds": 592.9, "key": "mlx-community/Qwen3-0.6B-4bit", | 369 | "models": [{"busy": false, "idle_seconds": 7, "keep_alive_left_seconds": 592.9, "key": "mlx-community/Qwen3-0.6B-4bit", |
| 369 | "kind": "chat", "name": "qwen", "queued": 0, "size_bytes": 335450584, "state": "loaded"}], | 370 | "kind": "chat", "name": "qwen", "queued": 0, "size_bytes": 335450584, "state": "loaded"}], |
modified
docs/fr/reference/configuration.md +2 -0 | @@ -2,6 +2,8 @@ | ||
| 2 | 2 | |
| 3 | 3 | > Chaque clé du fichier YAML passé à `rzb serve --config <fichier>`, son type, sa valeur par défaut et ses contrôles. Pour vérifier un fichier sans démarrer le serveur : `rzb config validate <fichier>`. Un exemple commenté se trouve dans [`examples/server.yaml`](../../../examples/server.yaml). |
| 4 | 4 | |
| 5 | +Les préférences de `rzb tui` ont leur propre fichier : voir la [référence de `rzb tui`](tui.md#fichier-de-préférences-tuiyaml). | |
| 6 | + | |
| 5 | 7 | Toutes les sections sont facultatives ; un fichier vide, ou pas de fichier du tout, est une configuration valide. Les clés inconnues sont des erreurs. Tous les problèmes d'un fichier sont signalés en une fois, avec le chemin de la clé et le numéro de ligne ; le code de sortie est alors 2. |
| 6 | 8 | |
| 7 | 9 | ```yaml |
| @@ -2,6 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | > Chaque clé du fichier YAML passé à `rzb serve --config <fichier>`, son type, sa valeur par défaut et ses contrôles. Pour vérifier un fichier sans démarrer le serveur : `rzb config validate <fichier>`. Un exemple commenté se trouve dans [`examples/server.yaml`](../../../examples/server.yaml). | 3 | > Chaque clé du fichier YAML passé à `rzb serve --config <fichier>`, son type, sa valeur par défaut et ses contrôles. Pour vérifier un fichier sans démarrer le serveur : `rzb config validate <fichier>`. Un exemple commenté se trouve dans [`examples/server.yaml`](../../../examples/server.yaml). |
| 4 | 4 | ||
| 5 | +Les préférences de `rzb tui` ont leur propre fichier : voir la [référence de `rzb tui`](tui.md#fichier-de-préférences-tuiyaml). | ||
| 6 | + | ||
| 5 | Toutes les sections sont facultatives ; un fichier vide, ou pas de fichier du tout, est une configuration valide. Les clés inconnues sont des erreurs. Tous les problèmes d'un fichier sont signalés en une fois, avec le chemin de la clé et le numéro de ligne ; le code de sortie est alors 2. | 7 | Toutes les sections sont facultatives ; un fichier vide, ou pas de fichier du tout, est une configuration valide. Les clés inconnues sont des erreurs. Tous les problèmes d'un fichier sont signalés en une fois, avec le chemin de la clé et le numéro de ligne ; le code de sortie est alors 2. |
| 6 | 8 | ||
| 7 | ```yaml | 9 | ```yaml |
modified
docs/fr/reference/ligne-de-commande.md +5 -36 | @@ -49,7 +49,7 @@ Le moteur est le premier de la compilation : `mlx` sur le Mac, `fake` sous Linux | ||
| 49 | 49 | rzb tui [--url <url>] [--config <fichier>] [--api-key-env <nom>] |
| 50 | 50 | ``` |
| 51 | 51 | |
| 52 | -Ouvre une interface plein écran sur un `rzb serve` qui tourne sur la même machine, jusqu'à Ctrl-Q ou Ctrl-C ; le terminal est alors remis tel qu'il était. Elle ne charge jamais de modèle elle-même : elle lit le serveur par HTTP, en interrogeant [`GET /rzb/status`](api-http.md#get-rzbstatus) chaque seconde. | |
| 52 | +Ouvre une interface plein écran sur un `rzb serve` qui tourne sur la même machine, jusqu'à Ctrl-Q ou Ctrl-C ; le terminal est alors remis tel qu'il était. Elle ne charge jamais de modèle elle-même : elle lit le serveur par HTTP, en interrogeant [`GET /rzb/status`](api-http.md#get-rzbstatus) chaque seconde (`poll_interval`). | |
| 53 | 53 | |
| 54 | 54 | | Option | Type | Défaut | Description | |
| 55 | 55 | | --- | --- | --- | --- | |
| @@ -57,43 +57,11 @@ Ouvre une interface plein écran sur un `rzb serve` qui tourne sur la même mach | ||
| 57 | 57 | | `--config <fichier>` | chemin | aucun | Le fichier de configuration du serveur : ses `server.host` et `server.port` donnent l'adresse (`0.0.0.0` et `::` deviennent `127.0.0.1`), son `server.api_key_env` la variable de la clé | |
| 58 | 58 | | `--api-key-env <nom>` | chaîne | `server.api_key_env`, sinon `RZB_API_KEY` | Variable d'environnement qui contient la clé d'API du serveur ; absente ou vide : pas de clé | |
| 59 | 59 | |
| 60 | -| Touche | Effet | | |
| 61 | -| --- | --- | | |
| 62 | -| `F1` `F2` `F3` `F4` | Écran Chat, Dashboard, Models, Settings | | |
| 63 | -| `Ctrl-T` | Écran suivant | | |
| 64 | -| `Ctrl-Q` | Quitter | | |
| 65 | -| `Ctrl-C` | Arrêter la réponse en cours sur l'écran Chat ; quitter sinon | | |
| 66 | - | |
| 67 | -Les écrans Models et Settings ne sont pas encore construits. | |
| 68 | - | |
| 69 | -**Dashboard** (le premier écran) : la version, la durée de fonctionnement et l'adresse du serveur ; la mémoire du moteur en jauge (active sur limite), avec le cache et le maximum ; les modèles chargés (nom, type, état, taille, puis temps d'inactivité et temps restant avant que `keep_alive` les décharge, ou occupation et requêtes en attente) ; les dernières requêtes (âge, méthode et chemin, statut, modèle, tokens prompt+complétion, tokens en cache, tokens de complétion par seconde sur toute la requête, durée). | |
| 70 | - | |
| 71 | -| Touche | Effet | | |
| 72 | -| --- | --- | | |
| 73 | -| `↑` `↓` `PgUp` `PgDn` `Home` `End` | Choisir un modèle | | |
| 74 | -| `u` | Décharger le modèle choisi ([`POST /rzb/models/{id}/unload`](api-http.md#post-rzbmodelsidunload)) ; la réponse du serveur s'affiche sous les requêtes, y compris son refus quand le modèle est en cours d'utilisation | | |
| 75 | - | |
| 76 | -**Chat** : une conversation en flux avec un modèle du serveur. Elle est gardée par `rzb tui` et renvoyée entière à chaque message. Le modèle est le premier modèle de chat chargé de `/v1/models`, sinon le premier modèle de chat listé. Après chaque réponse : tokens prompt+complétion, tokens du prompt repris du cache, tokens par seconde du premier morceau au dernier. | |
| 60 | +Priorité : ces options, puis le [fichier de préférences](tui.md#fichier-de-préférences-tuiyaml) `~/.config/razorbill/tui.yaml`, puis le fichier `--config`, puis les valeurs par défaut. `NO_COLOR` désactive les couleurs. | |
| 77 | 61 | |
| 78 | -| Touche | Effet | | |
| 79 | -| --- | --- | | |
| 80 | -| `Entrée` | Envoyer le message, ou lancer une commande | | |
| 81 | -| `Échap` | Arrêter la réponse en cours (ce qui est arrivé reste et fait partie de la conversation) | | |
| 82 | -| `Ctrl-N` | Nouvelle conversation | | |
| 83 | -| `Ctrl-P` | Choisir le modèle (`↑` `↓`, `Entrée` ; `Échap` ferme la liste) | | |
| 84 | -| `Ctrl-R` | Raisonnement replié (une ligne avec sa longueur), masqué, puis affiché | | |
| 85 | -| `PgUp` `PgDn` | Faire défiler la conversation | | |
| 86 | -| `←` `→` `Home` `End` `Ctrl-A` `Ctrl-E` `Retour arrière` `Suppr` | Modifier le message | | |
| 87 | - | |
| 88 | -| Commande | Effet | | |
| 89 | -| --- | --- | | |
| 90 | -| `/set <nom> <valeur>` | Échantillonnage des messages suivants : `temperature` (0–2), `top_p` (0–1), `top_k` (≥ 0), `min_p` (0–1), `max_tokens` (≥ 1), `thinking` (`on`, `off`) | | |
| 91 | -| `/set <nom>` | Rendre le réglage à la valeur du serveur | | |
| 92 | -| `/set` | Afficher les réglages | | |
| 93 | -| `/clear` | Nouvelle conversation | | |
| 94 | -| `/help` | Les touches et les commandes | La ligne du bas montre la connexion : `●` connecté (version, modèle, mémoire), `○` pas de serveur (l'écran donne la commande `rzb serve` à lancer, avec `--config` quand il a été donné), `✕` clé d'API refusée ou serveur sur une autre machine. | |
| 62 | +Les écrans, leurs touches et les préférences sont décrits dans la [référence de `rzb tui`](tui.md). | |
| 95 | 63 | |
| 96 | -Erreurs : un `--url` qui n'est pas une adresse http(s) donne le code de sortie 64 ; un fichier `--config` invalide, le code 2 ; pas de terminal sur l'entrée et la sortie standard, `error: rzb tui needs a terminal …` et le code 1. | |
| 64 | +Erreurs : un `--url` qui n'est pas une adresse http(s) donne le code de sortie 64 ; un fichier `--config` ou de préférences invalide, le code 2 ; pas de terminal sur l'entrée et la sortie standard, `error: rzb tui needs a terminal …` et le code 1. | |
| 97 | 65 | |
| 98 | 66 | ## rzb config validate |
| 99 | 67 | |
| @@ -134,3 +102,4 @@ Affiche `rzb 0.2.0 (engines: fake, mlx)` (les moteurs de cette compilation, tri | ||
| 134 | 102 | | `RZB_API_KEY` (ou le nom donné par `--api-key-env` / `server.api_key_env`) | Clé d'API du serveur | |
| 135 | 103 | | `HF_HUB_CACHE`, `HF_HOME` | Emplacement du cache des modèles | |
| 136 | 104 | | `NO_COLOR` | Désactive les couleurs sur la sortie d'erreur, et dans `rzb tui` | |
| 105 | +| `RZB_TUI_PREFERENCES` | Le fichier de préférences de `rzb tui`, au lieu de `~/.config/razorbill/tui.yaml` | | |
| @@ -49,7 +49,7 @@ Le moteur est le premier de la compilation : `mlx` sur le Mac, `fake` sous Linux | |||
| 49 | rzb tui [--url <url>] [--config <fichier>] [--api-key-env <nom>] | 49 | rzb tui [--url <url>] [--config <fichier>] [--api-key-env <nom>] |
| 50 | ``` | 50 | ``` |
| 51 | 51 | ||
| 52 | -Ouvre une interface plein écran sur un `rzb serve` qui tourne sur la même machine, jusqu'à Ctrl-Q ou Ctrl-C ; le terminal est alors remis tel qu'il était. Elle ne charge jamais de modèle elle-même : elle lit le serveur par HTTP, en interrogeant [`GET /rzb/status`](api-http.md#get-rzbstatus) chaque seconde. | 52 | +Ouvre une interface plein écran sur un `rzb serve` qui tourne sur la même machine, jusqu'à Ctrl-Q ou Ctrl-C ; le terminal est alors remis tel qu'il était. Elle ne charge jamais de modèle elle-même : elle lit le serveur par HTTP, en interrogeant [`GET /rzb/status`](api-http.md#get-rzbstatus) chaque seconde (`poll_interval`). |
| 53 | 53 | ||
| 54 | | Option | Type | Défaut | Description | | 54 | | Option | Type | Défaut | Description | |
| 55 | | --- | --- | --- | --- | | 55 | | --- | --- | --- | --- | |
| @@ -57,43 +57,11 @@ Ouvre une interface plein écran sur un `rzb serve` qui tourne sur la même mach | |||
| 57 | | `--config <fichier>` | chemin | aucun | Le fichier de configuration du serveur : ses `server.host` et `server.port` donnent l'adresse (`0.0.0.0` et `::` deviennent `127.0.0.1`), son `server.api_key_env` la variable de la clé | | 57 | | `--config <fichier>` | chemin | aucun | Le fichier de configuration du serveur : ses `server.host` et `server.port` donnent l'adresse (`0.0.0.0` et `::` deviennent `127.0.0.1`), son `server.api_key_env` la variable de la clé | |
| 58 | | `--api-key-env <nom>` | chaîne | `server.api_key_env`, sinon `RZB_API_KEY` | Variable d'environnement qui contient la clé d'API du serveur ; absente ou vide : pas de clé | | 58 | | `--api-key-env <nom>` | chaîne | `server.api_key_env`, sinon `RZB_API_KEY` | Variable d'environnement qui contient la clé d'API du serveur ; absente ou vide : pas de clé | |
| 59 | 59 | ||
| 60 | -| Touche | Effet | | 60 | +Priorité : ces options, puis le [fichier de préférences](tui.md#fichier-de-préférences-tuiyaml) `~/.config/razorbill/tui.yaml`, puis le fichier `--config`, puis les valeurs par défaut. `NO_COLOR` désactive les couleurs. |
| 61 | -| --- | --- | | ||
| 62 | -| `F1` `F2` `F3` `F4` | Écran Chat, Dashboard, Models, Settings | | ||
| 63 | -| `Ctrl-T` | Écran suivant | | ||
| 64 | -| `Ctrl-Q` | Quitter | | ||
| 65 | -| `Ctrl-C` | Arrêter la réponse en cours sur l'écran Chat ; quitter sinon | | ||
| 66 | - | ||
| 67 | -Les écrans Models et Settings ne sont pas encore construits. | ||
| 68 | - | ||
| 69 | -**Dashboard** (le premier écran) : la version, la durée de fonctionnement et l'adresse du serveur ; la mémoire du moteur en jauge (active sur limite), avec le cache et le maximum ; les modèles chargés (nom, type, état, taille, puis temps d'inactivité et temps restant avant que `keep_alive` les décharge, ou occupation et requêtes en attente) ; les dernières requêtes (âge, méthode et chemin, statut, modèle, tokens prompt+complétion, tokens en cache, tokens de complétion par seconde sur toute la requête, durée). | ||
| 70 | - | ||
| 71 | -| Touche | Effet | | ||
| 72 | -| --- | --- | | ||
| 73 | -| `↑` `↓` `PgUp` `PgDn` `Home` `End` | Choisir un modèle | | ||
| 74 | -| `u` | Décharger le modèle choisi ([`POST /rzb/models/{id}/unload`](api-http.md#post-rzbmodelsidunload)) ; la réponse du serveur s'affiche sous les requêtes, y compris son refus quand le modèle est en cours d'utilisation | | ||
| 75 | - | ||
| 76 | -**Chat** : une conversation en flux avec un modèle du serveur. Elle est gardée par `rzb tui` et renvoyée entière à chaque message. Le modèle est le premier modèle de chat chargé de `/v1/models`, sinon le premier modèle de chat listé. Après chaque réponse : tokens prompt+complétion, tokens du prompt repris du cache, tokens par seconde du premier morceau au dernier. | ||
| 77 | 61 | ||
| 78 | -| Touche | Effet | | 62 | +Les écrans, leurs touches et les préférences sont décrits dans la [référence de `rzb tui`](tui.md). |
| 79 | -| --- | --- | | ||
| 80 | -| `Entrée` | Envoyer le message, ou lancer une commande | | ||
| 81 | -| `Échap` | Arrêter la réponse en cours (ce qui est arrivé reste et fait partie de la conversation) | | ||
| 82 | -| `Ctrl-N` | Nouvelle conversation | | ||
| 83 | -| `Ctrl-P` | Choisir le modèle (`↑` `↓`, `Entrée` ; `Échap` ferme la liste) | | ||
| 84 | -| `Ctrl-R` | Raisonnement replié (une ligne avec sa longueur), masqué, puis affiché | | ||
| 85 | -| `PgUp` `PgDn` | Faire défiler la conversation | | ||
| 86 | -| `←` `→` `Home` `End` `Ctrl-A` `Ctrl-E` `Retour arrière` `Suppr` | Modifier le message | | ||
| 87 | - | ||
| 88 | -| Commande | Effet | | ||
| 89 | -| --- | --- | | ||
| 90 | -| `/set <nom> <valeur>` | Échantillonnage des messages suivants : `temperature` (0–2), `top_p` (0–1), `top_k` (≥ 0), `min_p` (0–1), `max_tokens` (≥ 1), `thinking` (`on`, `off`) | | ||
| 91 | -| `/set <nom>` | Rendre le réglage à la valeur du serveur | | ||
| 92 | -| `/set` | Afficher les réglages | | ||
| 93 | -| `/clear` | Nouvelle conversation | | ||
| 94 | -| `/help` | Les touches et les commandes | La ligne du bas montre la connexion : `●` connecté (version, modèle, mémoire), `○` pas de serveur (l'écran donne la commande `rzb serve` à lancer, avec `--config` quand il a été donné), `✕` clé d'API refusée ou serveur sur une autre machine. | ||
| 95 | 63 | ||
| 96 | -Erreurs : un `--url` qui n'est pas une adresse http(s) donne le code de sortie 64 ; un fichier `--config` invalide, le code 2 ; pas de terminal sur l'entrée et la sortie standard, `error: rzb tui needs a terminal …` et le code 1. | 64 | +Erreurs : un `--url` qui n'est pas une adresse http(s) donne le code de sortie 64 ; un fichier `--config` ou de préférences invalide, le code 2 ; pas de terminal sur l'entrée et la sortie standard, `error: rzb tui needs a terminal …` et le code 1. |
| 97 | 65 | ||
| 98 | ## rzb config validate | 66 | ## rzb config validate |
| 99 | 67 | ||
| @@ -134,3 +102,4 @@ Affiche `rzb 0.2.0 (engines: fake, mlx)` (les moteurs de cette compilation, tri | |||
| 134 | | `RZB_API_KEY` (ou le nom donné par `--api-key-env` / `server.api_key_env`) | Clé d'API du serveur | | 102 | | `RZB_API_KEY` (ou le nom donné par `--api-key-env` / `server.api_key_env`) | Clé d'API du serveur | |
| 135 | | `HF_HUB_CACHE`, `HF_HOME` | Emplacement du cache des modèles | | 103 | | `HF_HUB_CACHE`, `HF_HOME` | Emplacement du cache des modèles | |
| 136 | | `NO_COLOR` | Désactive les couleurs sur la sortie d'erreur, et dans `rzb tui` | | 104 | | `NO_COLOR` | Désactive les couleurs sur la sortie d'erreur, et dans `rzb tui` | |
| 105 | +| `RZB_TUI_PREFERENCES` | Le fichier de préférences de `rzb tui`, au lieu de `~/.config/razorbill/tui.yaml` | | ||
added
docs/fr/reference/tui.md +152 -0 | new file mode 100644 | ||
| @@ -0,0 +1,152 @@ | ||
| 1 | +# Référence : rzb tui | |
| 2 | + | |
| 3 | +> Les écrans de `rzb tui`, leurs touches et commandes, son fichier de préférences, et ce qu'il demande au serveur. Ses options de ligne de commande sont dans la [référence de la ligne de commande](ligne-de-commande.md#rzb-tui). | |
| 4 | + | |
| 5 | +## Le cadre | |
| 6 | + | |
| 7 | +| Ligne | Contenu | | |
| 8 | +| --- | --- | | |
| 9 | +| Première | Les onglets ` F1 Chat F2 Dashboard F3 Models F4 Settings `, l'onglet courant en vidéo inverse | | |
| 10 | +| Dernière | La connexion à gauche, `Ctrl-T next · Ctrl-Q quit` à droite quand il reste de la place | | |
| 11 | +| Entre les deux | L'écran courant | | |
| 12 | + | |
| 13 | +| Signe de la dernière ligne | Signification | | |
| 14 | +| --- | --- | | |
| 15 | +| `…` | En attente de la première réponse du serveur | | |
| 16 | +| `●` | Connecté : la version et l'adresse du serveur, le premier modèle chargé, la mémoire du moteur utilisée sur sa limite | | |
| 17 | +| `○` | Aucun serveur ne répond ; chaque écran donne la commande `rzb serve` à lancer (avec `--config` quand `rzb tui` en a reçu un) | | |
| 18 | +| `✕` | Le serveur a refusé la clé d'API (401), ou il est sur une autre machine (403 `local_only`) | | |
| 19 | + | |
| 20 | +Les mémoires et les tailles sont en Go de 2³⁰ octets. | |
| 21 | + | |
| 22 | +## Touches de tous les écrans | |
| 23 | + | |
| 24 | +| Touche | Effet | | |
| 25 | +| --- | --- | | |
| 26 | +| `F1` `F2` `F3` `F4` | Chat, Dashboard, Models, Settings | | |
| 27 | +| `Ctrl-T` | Écran suivant | | |
| 28 | +| `Ctrl-Q` | Quitter | | |
| 29 | +| `Ctrl-C` | Arrêter la réponse en cours sur l'écran Chat ; quitter sinon | | |
| 30 | + | |
| 31 | +`rzb tui` s'ouvre sur le Dashboard. | |
| 32 | + | |
| 33 | +## Dashboard (F2) | |
| 34 | + | |
| 35 | +La version, la durée de fonctionnement et l'adresse du serveur ; la mémoire du moteur en jauge (active sur limite), avec le cache et le maximum (`not reported by this engine` sous Linux) ; les modèles chargés ; les dernières requêtes. | |
| 36 | + | |
| 37 | +| Colonne des modèles | Contenu | | |
| 38 | +| --- | --- | | |
| 39 | +| `NAME`, `KIND`, `STATE`, `SIZE` | Le nom de la requête qui l'a chargé, `chat` ou `embedding`, `loading` ou `loaded`, les poids sur le disque | | |
| 40 | +| `ACTIVITY` | `idle 7s, unloads in 9m 52s` (d'après `keep_alive`), ou `busy` / `busy, 2 waiting` | | |
| 41 | + | |
| 42 | +| Colonne des requêtes | Contenu | | |
| 43 | +| --- | --- | | |
| 44 | +| `AGE`, `REQUEST`, `STATUS`, `MODEL` | Temps écoulé depuis sa fin, méthode et chemin, statut, modèle | | |
| 45 | +| `TOKENS`, `CACHED` | Tokens prompt+complétion, tokens du prompt repris du cache du serveur | | |
| 46 | +| `TOK/S`, `TIME` | Tokens de complétion sur toute la durée (traitement du prompt compris), durée jusqu'au dernier octet | | |
| 47 | + | |
| 48 | +| Touche | Effet | | |
| 49 | +| --- | --- | | |
| 50 | +| `↑` `↓` `PgUp` `PgDn` `Home` `End` | Choisir un modèle | | |
| 51 | +| `u` | Décharger le modèle choisi ; la réponse du serveur s'affiche sous les requêtes (un modèle en cours d'utilisation est refusé) | | |
| 52 | + | |
| 53 | +## Chat (F1) | |
| 54 | + | |
| 55 | +Une conversation en flux avec un modèle de chat du serveur. La conversation est gardée par `rzb tui` et renvoyée entière à chaque message ; le cache de prompt du serveur rend cela peu coûteux. Le modèle est le premier modèle de chat chargé de `/v1/models`, sinon le premier modèle de chat listé. Après chaque réponse : tokens prompt+complétion, tokens du prompt repris du cache, tokens par seconde du premier morceau au dernier. | |
| 56 | + | |
| 57 | +| Touche | Effet | | |
| 58 | +| --- | --- | | |
| 59 | +| `Entrée` | Envoyer le message, ou lancer une commande | | |
| 60 | +| `Échap` | Arrêter la réponse en cours ; ce qui est arrivé reste et fait partie de la conversation | | |
| 61 | +| `Ctrl-N` | Nouvelle conversation (pas pendant une réponse) | | |
| 62 | +| `Ctrl-P` | Choisir le modèle : `↑` `↓`, `Entrée` ; `Échap` ferme la liste | | |
| 63 | +| `Ctrl-R` | Raisonnement replié (une ligne avec sa longueur), masqué, affiché | | |
| 64 | +| `PgUp` `PgDn` | Faire défiler la conversation | | |
| 65 | +| `←` `→` `Home` `End` `Ctrl-A` `Ctrl-E` `Retour arrière` `Suppr` | Modifier le message | | |
| 66 | + | |
| 67 | +| Commande | Effet | | |
| 68 | +| --- | --- | | |
| 69 | +| `/set <nom> <valeur>` | Échantillonnage des messages suivants : `temperature` (0–2), `top_p` (0–1), `top_k` (≥ 0), `min_p` (0–1), `max_tokens` (≥ 1), `thinking` (`on`, `off`, envoyé comme `chat_template_kwargs.enable_thinking`) | | |
| 70 | +| `/set <nom>` | Rendre le réglage à la valeur du serveur | | |
| 71 | +| `/set` | Afficher les réglages | | |
| 72 | +| `/clear` | Nouvelle conversation | | |
| 73 | +| `/help` | Les touches et les commandes | | |
| 74 | + | |
| 75 | +La session commence avec la section `chat:` et la clé `reasoning` des préférences. | |
| 76 | + | |
| 77 | +## Models (F3) | |
| 78 | + | |
| 79 | +Les modèles MLX du cache Hugging Face (les mêmes que `rzb models list`), lus sur le disque ; les téléchargements en cours ; une indication sur le modèle choisi. | |
| 80 | + | |
| 81 | +| Colonne | Contenu | | |
| 82 | +| --- | --- | | |
| 83 | +| `ID` | L'id Hugging Face | | |
| 84 | +| `KIND` | D'après la configuration du serveur ou le modèle chargé ; `-` quand ni l'une ni l'autre ne le dit | | |
| 85 | +| `SIZE` | Place sur le disque | | |
| 86 | +| `LOADED` | `yes` quand le serveur l'a en mémoire | | |
| 87 | +| `DECLARED AS` | Les ids de la configuration qui pointent vers lui | | |
| 88 | + | |
| 89 | +L'indication donne la taille du modèle choisi et la mémoire du serveur utilisée sur sa limite, avec `more than is free now` quand le modèle ne tiendrait pas à côté de ce qui est chargé. | |
| 90 | + | |
| 91 | +| Touche | Effet | | |
| 92 | +| --- | --- | | |
| 93 | +| `↑` `↓` `PgUp` `PgDn` `Home` `End` | Choisir un modèle | | |
| 94 | +| `p` | Taper un id Hugging Face (`org/nom`) ; `Entrée` le télécharge avec le moteur de la compilation (progression affichée), `Échap` annule | | |
| 95 | +| `d`, `Suppr` | Supprimer du disque le modèle choisi après `y` (toute autre touche le garde). Un modèle chargé est d'abord déchargé ; tant que le serveur l'utilise, rien n'est supprimé | | |
| 96 | +| `r` | Relire le cache | | |
| 97 | + | |
| 98 | +## Settings (F4) | |
| 99 | + | |
| 100 | +Deux sections : les préférences, en formulaire enregistré dans le fichier de préférences ; le fichier de configuration du serveur, celui donné à `rzb tui --config`, sinon celui qu'indique `GET /rzb/status`. | |
| 101 | + | |
| 102 | +| Touche | Effet | | |
| 103 | +| --- | --- | | |
| 104 | +| `Tab` `Maj-Tab` `↑` `↓` | Passer d'un champ à l'autre | | |
| 105 | +| `Entrée` | Vérifier et enregistrer les préférences ; le premier champ faux est nommé | | |
| 106 | +| `Échap` | Annuler les changements non enregistrés | | |
| 107 | +| `Ctrl-O` | Ouvrir le fichier du serveur dans `$VISUAL`, sinon `$EDITOR`, sinon `vi` ; au retour il est vérifié comme par `rzb config validate`, puis le serveur le recharge | | |
| 108 | +| `Ctrl-R` | Recharger le fichier du serveur tel qu'il est | | |
| 109 | + | |
| 110 | +Après un rechargement, l'écran liste les modèles déchargés, ceux qui le seront une fois au repos, et les clés qui demandent un redémarrage du serveur. Un fichier qui a des problèmes n'est pas rechargé : les problèmes sont listés avec leurs lignes. Un serveur démarré sans `--config` n'a pas de fichier. | |
| 111 | + | |
| 112 | +Enregistrer les préférences applique tout de suite l'affichage du raisonnement, l'échantillonnage du chat, les couleurs et l'intervalle d'interrogation ; l'URL du serveur et la variable de la clé d'API s'appliquent au prochain démarrage de `rzb tui`. | |
| 113 | + | |
| 114 | +## Fichier de préférences (tui.yaml) | |
| 115 | + | |
| 116 | +`~/.config/razorbill/tui.yaml`, ou le fichier nommé par `RZB_TUI_PREFERENCES`. Chaque clé est facultative ; un fichier absent signifie aucune préférence. Les options de `rzb tui` l'emportent sur le fichier, et le fichier l'emporte sur le fichier `--config` du serveur. | |
| 117 | + | |
| 118 | +| Clé | Type | Défaut | Description | | |
| 119 | +| --- | --- | --- | --- | | |
| 120 | +| `server_url` | `http://…` | celle de `--config`, sinon `http://127.0.0.1:7920` | Le serveur | | |
| 121 | +| `api_key_env` | chaîne | `RZB_API_KEY` | Variable d'environnement qui contient la clé d'API | | |
| 122 | +| `reasoning` | `shown`, `folded`, `hidden` | `folded` | Comment l'écran Chat montre le raisonnement | | |
| 123 | +| `colors` | booléen | `true` | Couleurs (`NO_COLOR` les désactive quoi qu'il dise) | | |
| 124 | +| `poll_interval` | durée (`500ms`, `2s`) | `1s` | Fréquence des appels à `GET /rzb/status` | | |
| 125 | +| `chat.temperature` | nombre, 0–2 | celle du serveur | Échantillonnage du chat | | |
| 126 | +| `chat.top_p`, `chat.min_p` | nombre, 0–1 | celles du serveur | Échantillonnage du chat | | |
| 127 | +| `chat.top_k` | entier ≥ 0 | celle du serveur | Échantillonnage du chat | | |
| 128 | +| `chat.max_tokens` | entier ≥ 1 | celle du serveur | Limite des réponses du chat | | |
| 129 | +| `chat.thinking` | booléen | celle du modèle | Raisonnement activé ou non | | |
| 130 | + | |
| 131 | +```yaml | |
| 132 | +server_url: http://127.0.0.1:7920 | |
| 133 | +reasoning: hidden | |
| 134 | +poll_interval: 2s | |
| 135 | +chat: | |
| 136 | + temperature: 0.7 | |
| 137 | + max_tokens: 1024 | |
| 138 | +``` | |
| 139 | + | |
| 140 | +Les clés inconnues et les valeurs fausses sont signalées ensemble, avec leurs lignes, et `rzb tui` sort avec le code 2. L'écran Settings écrit le fichier avec les clés renseignées, et une ligne de commentaire en tête. | |
| 141 | + | |
| 142 | +## Ce qu'il demande au serveur | |
| 143 | + | |
| 144 | +| Requête | Quand | | |
| 145 | +| --- | --- | | |
| 146 | +| [`GET /rzb/status`](api-http.md#get-rzbstatus) | Toutes les `poll_interval` | | |
| 147 | +| `GET /v1/models` | À la première ouverture de l'écran Chat, et sur `Ctrl-P` | | |
| 148 | +| `POST /v1/chat/completions` | À chaque message, en flux avec `stream_options.include_usage` | | |
| 149 | +| [`POST /rzb/models/{id}/unload`](api-http.md#post-rzbmodelsidunload) | `u` sur le Dashboard, `d` puis `y` sur un modèle chargé | | |
| 150 | +| [`POST /rzb/config/reload`](api-http.md#post-rzbconfigreload) | `Ctrl-R`, et après `Ctrl-O` | | |
| 151 | + | |
| 152 | +Toutes portent `Authorization: Bearer <clé>` quand une clé est définie. Les routes `/rzb/` ne répondent qu'à la machine qui fait tourner le serveur. | |
| new file mode 100644 | |||
| @@ -0,0 +1,152 @@ | |||
| 1 | +# Référence : rzb tui | ||
| 2 | + | ||
| 3 | +> Les écrans de `rzb tui`, leurs touches et commandes, son fichier de préférences, et ce qu'il demande au serveur. Ses options de ligne de commande sont dans la [référence de la ligne de commande](ligne-de-commande.md#rzb-tui). | ||
| 4 | + | ||
| 5 | +## Le cadre | ||
| 6 | + | ||
| 7 | +| Ligne | Contenu | | ||
| 8 | +| --- | --- | | ||
| 9 | +| Première | Les onglets ` F1 Chat F2 Dashboard F3 Models F4 Settings `, l'onglet courant en vidéo inverse | | ||
| 10 | +| Dernière | La connexion à gauche, `Ctrl-T next · Ctrl-Q quit` à droite quand il reste de la place | | ||
| 11 | +| Entre les deux | L'écran courant | | ||
| 12 | + | ||
| 13 | +| Signe de la dernière ligne | Signification | | ||
| 14 | +| --- | --- | | ||
| 15 | +| `…` | En attente de la première réponse du serveur | | ||
| 16 | +| `●` | Connecté : la version et l'adresse du serveur, le premier modèle chargé, la mémoire du moteur utilisée sur sa limite | | ||
| 17 | +| `○` | Aucun serveur ne répond ; chaque écran donne la commande `rzb serve` à lancer (avec `--config` quand `rzb tui` en a reçu un) | | ||
| 18 | +| `✕` | Le serveur a refusé la clé d'API (401), ou il est sur une autre machine (403 `local_only`) | | ||
| 19 | + | ||
| 20 | +Les mémoires et les tailles sont en Go de 2³⁰ octets. | ||
| 21 | + | ||
| 22 | +## Touches de tous les écrans | ||
| 23 | + | ||
| 24 | +| Touche | Effet | | ||
| 25 | +| --- | --- | | ||
| 26 | +| `F1` `F2` `F3` `F4` | Chat, Dashboard, Models, Settings | | ||
| 27 | +| `Ctrl-T` | Écran suivant | | ||
| 28 | +| `Ctrl-Q` | Quitter | | ||
| 29 | +| `Ctrl-C` | Arrêter la réponse en cours sur l'écran Chat ; quitter sinon | | ||
| 30 | + | ||
| 31 | +`rzb tui` s'ouvre sur le Dashboard. | ||
| 32 | + | ||
| 33 | +## Dashboard (F2) | ||
| 34 | + | ||
| 35 | +La version, la durée de fonctionnement et l'adresse du serveur ; la mémoire du moteur en jauge (active sur limite), avec le cache et le maximum (`not reported by this engine` sous Linux) ; les modèles chargés ; les dernières requêtes. | ||
| 36 | + | ||
| 37 | +| Colonne des modèles | Contenu | | ||
| 38 | +| --- | --- | | ||
| 39 | +| `NAME`, `KIND`, `STATE`, `SIZE` | Le nom de la requête qui l'a chargé, `chat` ou `embedding`, `loading` ou `loaded`, les poids sur le disque | | ||
| 40 | +| `ACTIVITY` | `idle 7s, unloads in 9m 52s` (d'après `keep_alive`), ou `busy` / `busy, 2 waiting` | | ||
| 41 | + | ||
| 42 | +| Colonne des requêtes | Contenu | | ||
| 43 | +| --- | --- | | ||
| 44 | +| `AGE`, `REQUEST`, `STATUS`, `MODEL` | Temps écoulé depuis sa fin, méthode et chemin, statut, modèle | | ||
| 45 | +| `TOKENS`, `CACHED` | Tokens prompt+complétion, tokens du prompt repris du cache du serveur | | ||
| 46 | +| `TOK/S`, `TIME` | Tokens de complétion sur toute la durée (traitement du prompt compris), durée jusqu'au dernier octet | | ||
| 47 | + | ||
| 48 | +| Touche | Effet | | ||
| 49 | +| --- | --- | | ||
| 50 | +| `↑` `↓` `PgUp` `PgDn` `Home` `End` | Choisir un modèle | | ||
| 51 | +| `u` | Décharger le modèle choisi ; la réponse du serveur s'affiche sous les requêtes (un modèle en cours d'utilisation est refusé) | | ||
| 52 | + | ||
| 53 | +## Chat (F1) | ||
| 54 | + | ||
| 55 | +Une conversation en flux avec un modèle de chat du serveur. La conversation est gardée par `rzb tui` et renvoyée entière à chaque message ; le cache de prompt du serveur rend cela peu coûteux. Le modèle est le premier modèle de chat chargé de `/v1/models`, sinon le premier modèle de chat listé. Après chaque réponse : tokens prompt+complétion, tokens du prompt repris du cache, tokens par seconde du premier morceau au dernier. | ||
| 56 | + | ||
| 57 | +| Touche | Effet | | ||
| 58 | +| --- | --- | | ||
| 59 | +| `Entrée` | Envoyer le message, ou lancer une commande | | ||
| 60 | +| `Échap` | Arrêter la réponse en cours ; ce qui est arrivé reste et fait partie de la conversation | | ||
| 61 | +| `Ctrl-N` | Nouvelle conversation (pas pendant une réponse) | | ||
| 62 | +| `Ctrl-P` | Choisir le modèle : `↑` `↓`, `Entrée` ; `Échap` ferme la liste | | ||
| 63 | +| `Ctrl-R` | Raisonnement replié (une ligne avec sa longueur), masqué, affiché | | ||
| 64 | +| `PgUp` `PgDn` | Faire défiler la conversation | | ||
| 65 | +| `←` `→` `Home` `End` `Ctrl-A` `Ctrl-E` `Retour arrière` `Suppr` | Modifier le message | | ||
| 66 | + | ||
| 67 | +| Commande | Effet | | ||
| 68 | +| --- | --- | | ||
| 69 | +| `/set <nom> <valeur>` | Échantillonnage des messages suivants : `temperature` (0–2), `top_p` (0–1), `top_k` (≥ 0), `min_p` (0–1), `max_tokens` (≥ 1), `thinking` (`on`, `off`, envoyé comme `chat_template_kwargs.enable_thinking`) | | ||
| 70 | +| `/set <nom>` | Rendre le réglage à la valeur du serveur | | ||
| 71 | +| `/set` | Afficher les réglages | | ||
| 72 | +| `/clear` | Nouvelle conversation | | ||
| 73 | +| `/help` | Les touches et les commandes | | ||
| 74 | + | ||
| 75 | +La session commence avec la section `chat:` et la clé `reasoning` des préférences. | ||
| 76 | + | ||
| 77 | +## Models (F3) | ||
| 78 | + | ||
| 79 | +Les modèles MLX du cache Hugging Face (les mêmes que `rzb models list`), lus sur le disque ; les téléchargements en cours ; une indication sur le modèle choisi. | ||
| 80 | + | ||
| 81 | +| Colonne | Contenu | | ||
| 82 | +| --- | --- | | ||
| 83 | +| `ID` | L'id Hugging Face | | ||
| 84 | +| `KIND` | D'après la configuration du serveur ou le modèle chargé ; `-` quand ni l'une ni l'autre ne le dit | | ||
| 85 | +| `SIZE` | Place sur le disque | | ||
| 86 | +| `LOADED` | `yes` quand le serveur l'a en mémoire | | ||
| 87 | +| `DECLARED AS` | Les ids de la configuration qui pointent vers lui | | ||
| 88 | + | ||
| 89 | +L'indication donne la taille du modèle choisi et la mémoire du serveur utilisée sur sa limite, avec `more than is free now` quand le modèle ne tiendrait pas à côté de ce qui est chargé. | ||
| 90 | + | ||
| 91 | +| Touche | Effet | | ||
| 92 | +| --- | --- | | ||
| 93 | +| `↑` `↓` `PgUp` `PgDn` `Home` `End` | Choisir un modèle | | ||
| 94 | +| `p` | Taper un id Hugging Face (`org/nom`) ; `Entrée` le télécharge avec le moteur de la compilation (progression affichée), `Échap` annule | | ||
| 95 | +| `d`, `Suppr` | Supprimer du disque le modèle choisi après `y` (toute autre touche le garde). Un modèle chargé est d'abord déchargé ; tant que le serveur l'utilise, rien n'est supprimé | | ||
| 96 | +| `r` | Relire le cache | | ||
| 97 | + | ||
| 98 | +## Settings (F4) | ||
| 99 | + | ||
| 100 | +Deux sections : les préférences, en formulaire enregistré dans le fichier de préférences ; le fichier de configuration du serveur, celui donné à `rzb tui --config`, sinon celui qu'indique `GET /rzb/status`. | ||
| 101 | + | ||
| 102 | +| Touche | Effet | | ||
| 103 | +| --- | --- | | ||
| 104 | +| `Tab` `Maj-Tab` `↑` `↓` | Passer d'un champ à l'autre | | ||
| 105 | +| `Entrée` | Vérifier et enregistrer les préférences ; le premier champ faux est nommé | | ||
| 106 | +| `Échap` | Annuler les changements non enregistrés | | ||
| 107 | +| `Ctrl-O` | Ouvrir le fichier du serveur dans `$VISUAL`, sinon `$EDITOR`, sinon `vi` ; au retour il est vérifié comme par `rzb config validate`, puis le serveur le recharge | | ||
| 108 | +| `Ctrl-R` | Recharger le fichier du serveur tel qu'il est | | ||
| 109 | + | ||
| 110 | +Après un rechargement, l'écran liste les modèles déchargés, ceux qui le seront une fois au repos, et les clés qui demandent un redémarrage du serveur. Un fichier qui a des problèmes n'est pas rechargé : les problèmes sont listés avec leurs lignes. Un serveur démarré sans `--config` n'a pas de fichier. | ||
| 111 | + | ||
| 112 | +Enregistrer les préférences applique tout de suite l'affichage du raisonnement, l'échantillonnage du chat, les couleurs et l'intervalle d'interrogation ; l'URL du serveur et la variable de la clé d'API s'appliquent au prochain démarrage de `rzb tui`. | ||
| 113 | + | ||
| 114 | +## Fichier de préférences (tui.yaml) | ||
| 115 | + | ||
| 116 | +`~/.config/razorbill/tui.yaml`, ou le fichier nommé par `RZB_TUI_PREFERENCES`. Chaque clé est facultative ; un fichier absent signifie aucune préférence. Les options de `rzb tui` l'emportent sur le fichier, et le fichier l'emporte sur le fichier `--config` du serveur. | ||
| 117 | + | ||
| 118 | +| Clé | Type | Défaut | Description | | ||
| 119 | +| --- | --- | --- | --- | | ||
| 120 | +| `server_url` | `http://…` | celle de `--config`, sinon `http://127.0.0.1:7920` | Le serveur | | ||
| 121 | +| `api_key_env` | chaîne | `RZB_API_KEY` | Variable d'environnement qui contient la clé d'API | | ||
| 122 | +| `reasoning` | `shown`, `folded`, `hidden` | `folded` | Comment l'écran Chat montre le raisonnement | | ||
| 123 | +| `colors` | booléen | `true` | Couleurs (`NO_COLOR` les désactive quoi qu'il dise) | | ||
| 124 | +| `poll_interval` | durée (`500ms`, `2s`) | `1s` | Fréquence des appels à `GET /rzb/status` | | ||
| 125 | +| `chat.temperature` | nombre, 0–2 | celle du serveur | Échantillonnage du chat | | ||
| 126 | +| `chat.top_p`, `chat.min_p` | nombre, 0–1 | celles du serveur | Échantillonnage du chat | | ||
| 127 | +| `chat.top_k` | entier ≥ 0 | celle du serveur | Échantillonnage du chat | | ||
| 128 | +| `chat.max_tokens` | entier ≥ 1 | celle du serveur | Limite des réponses du chat | | ||
| 129 | +| `chat.thinking` | booléen | celle du modèle | Raisonnement activé ou non | | ||
| 130 | + | ||
| 131 | +```yaml | ||
| 132 | +server_url: http://127.0.0.1:7920 | ||
| 133 | +reasoning: hidden | ||
| 134 | +poll_interval: 2s | ||
| 135 | +chat: | ||
| 136 | + temperature: 0.7 | ||
| 137 | + max_tokens: 1024 | ||
| 138 | +``` | ||
| 139 | + | ||
| 140 | +Les clés inconnues et les valeurs fausses sont signalées ensemble, avec leurs lignes, et `rzb tui` sort avec le code 2. L'écran Settings écrit le fichier avec les clés renseignées, et une ligne de commentaire en tête. | ||
| 141 | + | ||
| 142 | +## Ce qu'il demande au serveur | ||
| 143 | + | ||
| 144 | +| Requête | Quand | | ||
| 145 | +| --- | --- | | ||
| 146 | +| [`GET /rzb/status`](api-http.md#get-rzbstatus) | Toutes les `poll_interval` | | ||
| 147 | +| `GET /v1/models` | À la première ouverture de l'écran Chat, et sur `Ctrl-P` | | ||
| 148 | +| `POST /v1/chat/completions` | À chaque message, en flux avec `stream_options.include_usage` | | ||
| 149 | +| [`POST /rzb/models/{id}/unload`](api-http.md#post-rzbmodelsidunload) | `u` sur le Dashboard, `d` puis `y` sur un modèle chargé | | ||
| 150 | +| [`POST /rzb/config/reload`](api-http.md#post-rzbconfigreload) | `Ctrl-R`, et après `Ctrl-O` | | ||
| 151 | + | ||
| 152 | +Toutes portent `Authorization: Bearer <clé>` quand une clé est définie. Les routes `/rzb/` ne répondent qu'à la machine qui fait tourner le serveur. | ||
added
docs/fr/tutorials/discuter-depuis-le-terminal.md +91 -0 | new file mode 100644 | ||
| @@ -0,0 +1,91 @@ | ||
| 1 | +# Tutoriel : discuter avec un modèle local depuis le terminal | |
| 2 | + | |
| 3 | +À la fin de ce tutoriel, le serveur tournera dans un terminal et `rzb tui` dans un autre, tu auras discuté avec un modèle sur le GPU de ton Mac, et tu auras regardé le serveur le charger et répondre sur le Dashboard. | |
| 4 | + | |
| 5 | +Aucune connaissance de l'API HTTP n'est nécessaire. | |
| 6 | + | |
| 7 | +## Prérequis | |
| 8 | + | |
| 9 | +- Un Mac Apple Silicon sous macOS 14 ou plus récent. | |
| 10 | +- `rzb` installé avec `scripts/install.sh`, comme décrit dans [Compiler rzb sur le Mac](../how-to/compiler-sur-le-mac.md), pour que `rzb` se lance depuis n'importe quel dossier. | |
| 11 | +- Deux fenêtres de terminal, environ 400 Mo d'espace disque libre, et une connexion internet pour le téléchargement. | |
| 12 | + | |
| 13 | +## Étape 1 — Télécharger un petit modèle et décrire le serveur | |
| 14 | + | |
| 15 | +Dans le premier terminal, tape : | |
| 16 | + | |
| 17 | +```bash | |
| 18 | +rzb models pull mlx-community/Qwen3-0.6B-4bit | |
| 19 | +mkdir -p ~/rzb-tutoriel && cd ~/rzb-tutoriel | |
| 20 | +cat > server.yaml <<'YAML' | |
| 21 | +models: | |
| 22 | + - id: qwen | |
| 23 | + source: mlx-community/Qwen3-0.6B-4bit | |
| 24 | +YAML | |
| 25 | +``` | |
| 26 | + | |
| 27 | +Le téléchargement affiche sa progression et se termine par une ligne qui dit que le modèle est téléchargé. Nous avons maintenant un modèle dans le cache, et un fichier de configuration qui lui donne le nom court `qwen`. | |
| 28 | + | |
| 29 | +## Étape 2 — Ouvrir rzb tui avant le serveur | |
| 30 | + | |
| 31 | +Toujours dans le premier terminal, tape : | |
| 32 | + | |
| 33 | +```bash | |
| 34 | +rzb tui --config server.yaml | |
| 35 | +``` | |
| 36 | + | |
| 37 | +Le terminal passe en plein écran. Tu dois voir : | |
| 38 | + | |
| 39 | +``` | |
| 40 | + No razorbill server answers at http://127.0.0.1:7920. | |
| 41 | + | |
| 42 | + Start one in another terminal: | |
| 43 | + | |
| 44 | + rzb serve --config server.yaml | |
| 45 | +``` | |
| 46 | + | |
| 47 | +et, sur la dernière ligne, `○ no server at http://127.0.0.1:7920`. `rzb tui` n'est qu'une fenêtre sur un serveur : nous démarrons le serveur ensuite. | |
| 48 | + | |
| 49 | +## Étape 3 — Démarrer le serveur | |
| 50 | + | |
| 51 | +Dans le second terminal, tape : | |
| 52 | + | |
| 53 | +```bash | |
| 54 | +cd ~/rzb-tutoriel | |
| 55 | +rzb serve --config server.yaml | |
| 56 | +``` | |
| 57 | + | |
| 58 | +Regarde le premier terminal : en une seconde, l'écran passe au Dashboard, avec une ligne qui commence par `Server rzb`, la mémoire du moteur, et `none loaded` sous Models. La dernière ligne commence maintenant par `●`. Nous avons le serveur et sa fenêtre côte à côte. | |
| 59 | + | |
| 60 | +## Étape 4 — Envoyer un message | |
| 61 | + | |
| 62 | +Dans le premier terminal, appuie sur `F1`. L'écran Chat indique `Model: qwen`. Tape : | |
| 63 | + | |
| 64 | +``` | |
| 65 | +Say hi in five words. | |
| 66 | +``` | |
| 67 | + | |
| 68 | +et appuie sur `Entrée`. La première réponse prend quelques secondes, le temps que le serveur charge le modèle : tu vois `⋯ waiting for the model…`. Puis Qwen3 réfléchit avant de répondre : une ligne `⋯ thinking (… words) · Ctrl-R to show` apparaît, puis la réponse après `qwen ›`, puis une ligne atténuée comme `23+41 tokens · 85.3 tok/s`. Les mots et les chiffres exacts diffèrent sur ton Mac. | |
| 69 | + | |
| 70 | +Nous avons discuté avec un modèle sur le GPU, à travers l'API OpenAI du serveur. | |
| 71 | + | |
| 72 | +## Étape 5 — Regarder le raisonnement | |
| 73 | + | |
| 74 | +Appuie deux fois sur `Ctrl-R`. Le premier appui masque la ligne de raisonnement ; le second affiche le raisonnement en entier, en lignes atténuées qui commencent par `⋯`. Envoie un deuxième message : la conversation est renvoyée entière. Quand le serveur a pu réutiliser ce qu'il avait déjà lu, la ligne sous la réponse indique aussi `… cached`. | |
| 75 | + | |
| 76 | +## Étape 6 — Regarder le serveur | |
| 77 | + | |
| 78 | +Appuie sur `F2`. Sous Models, `qwen` est `loaded`, avec sa taille et le temps avant que le serveur le décharge si personne ne s'en sert. Sous Last requests, tes deux `POST /v1/chat/completions` sont listés avec leurs tokens, leur vitesse et leur durée. | |
| 79 | + | |
| 80 | +## Étape 7 — Partir | |
| 81 | + | |
| 82 | +Appuie sur `Ctrl-Q` : le terminal revient tel qu'il était. Dans le second terminal, appuie sur `Ctrl-C` pour arrêter le serveur. | |
| 83 | + | |
| 84 | +## Et maintenant ? | |
| 85 | + | |
| 86 | +Tu as fait tourner le serveur et son interface en terminal, discuté avec un modèle et regardé le serveur travailler. Pour aller plus loin : | |
| 87 | + | |
| 88 | +- Pour télécharger ou supprimer des modèles depuis `rzb tui` : [gérer les modèles depuis rzb tui](../how-to/gerer-les-modeles-depuis-la-tui.md). | |
| 89 | +- Pour changer la configuration du serveur pendant qu'il tourne : [changer la configuration du serveur depuis rzb tui](../how-to/changer-la-configuration-du-serveur-depuis-la-tui.md). | |
| 90 | +- Chaque écran et chaque touche : [référence de rzb tui](../reference/tui.md). | |
| 91 | +- Pourquoi c'est un programme à part : [l'interface en terminal](../explanation/interface-terminal.md). | |
| new file mode 100644 | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | +# Tutoriel : discuter avec un modèle local depuis le terminal | ||
| 2 | + | ||
| 3 | +À la fin de ce tutoriel, le serveur tournera dans un terminal et `rzb tui` dans un autre, tu auras discuté avec un modèle sur le GPU de ton Mac, et tu auras regardé le serveur le charger et répondre sur le Dashboard. | ||
| 4 | + | ||
| 5 | +Aucune connaissance de l'API HTTP n'est nécessaire. | ||
| 6 | + | ||
| 7 | +## Prérequis | ||
| 8 | + | ||
| 9 | +- Un Mac Apple Silicon sous macOS 14 ou plus récent. | ||
| 10 | +- `rzb` installé avec `scripts/install.sh`, comme décrit dans [Compiler rzb sur le Mac](../how-to/compiler-sur-le-mac.md), pour que `rzb` se lance depuis n'importe quel dossier. | ||
| 11 | +- Deux fenêtres de terminal, environ 400 Mo d'espace disque libre, et une connexion internet pour le téléchargement. | ||
| 12 | + | ||
| 13 | +## Étape 1 — Télécharger un petit modèle et décrire le serveur | ||
| 14 | + | ||
| 15 | +Dans le premier terminal, tape : | ||
| 16 | + | ||
| 17 | +```bash | ||
| 18 | +rzb models pull mlx-community/Qwen3-0.6B-4bit | ||
| 19 | +mkdir -p ~/rzb-tutoriel && cd ~/rzb-tutoriel | ||
| 20 | +cat > server.yaml <<'YAML' | ||
| 21 | +models: | ||
| 22 | + - id: qwen | ||
| 23 | + source: mlx-community/Qwen3-0.6B-4bit | ||
| 24 | +YAML | ||
| 25 | +``` | ||
| 26 | + | ||
| 27 | +Le téléchargement affiche sa progression et se termine par une ligne qui dit que le modèle est téléchargé. Nous avons maintenant un modèle dans le cache, et un fichier de configuration qui lui donne le nom court `qwen`. | ||
| 28 | + | ||
| 29 | +## Étape 2 — Ouvrir rzb tui avant le serveur | ||
| 30 | + | ||
| 31 | +Toujours dans le premier terminal, tape : | ||
| 32 | + | ||
| 33 | +```bash | ||
| 34 | +rzb tui --config server.yaml | ||
| 35 | +``` | ||
| 36 | + | ||
| 37 | +Le terminal passe en plein écran. Tu dois voir : | ||
| 38 | + | ||
| 39 | +``` | ||
| 40 | + No razorbill server answers at http://127.0.0.1:7920. | ||
| 41 | + | ||
| 42 | + Start one in another terminal: | ||
| 43 | + | ||
| 44 | + rzb serve --config server.yaml | ||
| 45 | +``` | ||
| 46 | + | ||
| 47 | +et, sur la dernière ligne, `○ no server at http://127.0.0.1:7920`. `rzb tui` n'est qu'une fenêtre sur un serveur : nous démarrons le serveur ensuite. | ||
| 48 | + | ||
| 49 | +## Étape 3 — Démarrer le serveur | ||
| 50 | + | ||
| 51 | +Dans le second terminal, tape : | ||
| 52 | + | ||
| 53 | +```bash | ||
| 54 | +cd ~/rzb-tutoriel | ||
| 55 | +rzb serve --config server.yaml | ||
| 56 | +``` | ||
| 57 | + | ||
| 58 | +Regarde le premier terminal : en une seconde, l'écran passe au Dashboard, avec une ligne qui commence par `Server rzb`, la mémoire du moteur, et `none loaded` sous Models. La dernière ligne commence maintenant par `●`. Nous avons le serveur et sa fenêtre côte à côte. | ||
| 59 | + | ||
| 60 | +## Étape 4 — Envoyer un message | ||
| 61 | + | ||
| 62 | +Dans le premier terminal, appuie sur `F1`. L'écran Chat indique `Model: qwen`. Tape : | ||
| 63 | + | ||
| 64 | +``` | ||
| 65 | +Say hi in five words. | ||
| 66 | +``` | ||
| 67 | + | ||
| 68 | +et appuie sur `Entrée`. La première réponse prend quelques secondes, le temps que le serveur charge le modèle : tu vois `⋯ waiting for the model…`. Puis Qwen3 réfléchit avant de répondre : une ligne `⋯ thinking (… words) · Ctrl-R to show` apparaît, puis la réponse après `qwen ›`, puis une ligne atténuée comme `23+41 tokens · 85.3 tok/s`. Les mots et les chiffres exacts diffèrent sur ton Mac. | ||
| 69 | + | ||
| 70 | +Nous avons discuté avec un modèle sur le GPU, à travers l'API OpenAI du serveur. | ||
| 71 | + | ||
| 72 | +## Étape 5 — Regarder le raisonnement | ||
| 73 | + | ||
| 74 | +Appuie deux fois sur `Ctrl-R`. Le premier appui masque la ligne de raisonnement ; le second affiche le raisonnement en entier, en lignes atténuées qui commencent par `⋯`. Envoie un deuxième message : la conversation est renvoyée entière. Quand le serveur a pu réutiliser ce qu'il avait déjà lu, la ligne sous la réponse indique aussi `… cached`. | ||
| 75 | + | ||
| 76 | +## Étape 6 — Regarder le serveur | ||
| 77 | + | ||
| 78 | +Appuie sur `F2`. Sous Models, `qwen` est `loaded`, avec sa taille et le temps avant que le serveur le décharge si personne ne s'en sert. Sous Last requests, tes deux `POST /v1/chat/completions` sont listés avec leurs tokens, leur vitesse et leur durée. | ||
| 79 | + | ||
| 80 | +## Étape 7 — Partir | ||
| 81 | + | ||
| 82 | +Appuie sur `Ctrl-Q` : le terminal revient tel qu'il était. Dans le second terminal, appuie sur `Ctrl-C` pour arrêter le serveur. | ||
| 83 | + | ||
| 84 | +## Et maintenant ? | ||
| 85 | + | ||
| 86 | +Tu as fait tourner le serveur et son interface en terminal, discuté avec un modèle et regardé le serveur travailler. Pour aller plus loin : | ||
| 87 | + | ||
| 88 | +- Pour télécharger ou supprimer des modèles depuis `rzb tui` : [gérer les modèles depuis rzb tui](../how-to/gerer-les-modeles-depuis-la-tui.md). | ||
| 89 | +- Pour changer la configuration du serveur pendant qu'il tourne : [changer la configuration du serveur depuis rzb tui](../how-to/changer-la-configuration-du-serveur-depuis-la-tui.md). | ||
| 90 | +- Chaque écran et chaque touche : [référence de rzb tui](../reference/tui.md). | ||
| 91 | +- Pourquoi c'est un programme à part : [l'interface en terminal](../explanation/interface-terminal.md). | ||