Add web GUI mode via textual-serve
Run `gniza web` or `gniza --web` to serve the TUI as a web app on port 8080. Use --port to change. Requires textual-serve. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -431,7 +431,10 @@ run_cli() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# ── Mode selection ───────────────────────────────────────────
|
# ── Mode selection ───────────────────────────────────────────
|
||||||
if [[ -n "$SUBCOMMAND" ]]; then
|
if [[ "$SUBCOMMAND" == "web" || " $* " == *" --web "* ]]; then
|
||||||
|
# Web GUI mode
|
||||||
|
PYTHONPATH="$GNIZA_DIR:${PYTHONPATH:-}" exec python3 -m tui --web "$@"
|
||||||
|
elif [[ -n "$SUBCOMMAND" ]]; then
|
||||||
# Explicit subcommand: always CLI
|
# Explicit subcommand: always CLI
|
||||||
run_cli
|
run_cli
|
||||||
elif [[ "$FORCE_CLI" == "true" ]]; then
|
elif [[ "$FORCE_CLI" == "true" ]]; then
|
||||||
|
|||||||
@@ -1,9 +1,20 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
from tui.app import GnizaApp
|
from tui.app import GnizaApp
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
app = GnizaApp()
|
if "--web" in sys.argv:
|
||||||
app.run()
|
from textual_serve.server import Server
|
||||||
|
port = 8080
|
||||||
|
for i, arg in enumerate(sys.argv):
|
||||||
|
if arg == "--port" and i + 1 < len(sys.argv):
|
||||||
|
port = int(sys.argv[i + 1])
|
||||||
|
server = Server("python3 -m tui", host="0.0.0.0", port=port)
|
||||||
|
server.serve()
|
||||||
|
else:
|
||||||
|
app = GnizaApp()
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user