oasis.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/sh
  2. CURRENT_DIR=$(pwd)
  3. MODE=$1
  4. MODEL_PATH="$CURRENT_DIR/src/AI/oasis-42-1-chat.Q4_K_M.gguf"
  5. CONFIG_FILE="$CURRENT_DIR/src/configs/oasis-config.json"
  6. show_help() {
  7. cat <<'EOF'
  8. Usage: sh oasis.sh [mode] [-- <option>=<value> ...]
  9. Modes:
  10. gui Launch the Oasis web GUI (default).
  11. server Launch only the Oasis backend in headless / pub mode.
  12. help, -h Show this help message.
  13. GUI options (forwarded to the backend):
  14. --host=<ip> Hostname / IP the web UI listens on (default: localhost).
  15. Use 0.0.0.0 to expose on a VPS.
  16. --port=<n> Port for the web UI (default: 3000).
  17. --allow-host=<host> Extra hostname allowed when behind a reverse proxy.
  18. --public Public-hosting mode: disables POST and redacts content
  19. from people who haven't opted in to public hosting.
  20. --offline Don't try to connect to Oasis peers / pubs.
  21. --no-open Don't auto-open a browser tab on launch (useful on a VPS).
  22. --debug Verbose logging.
  23. Examples:
  24. sh oasis.sh
  25. sh oasis.sh server
  26. sh oasis.sh --host=0.0.0.0 --port=8080 --no-open
  27. sh oasis.sh --public --no-open --host=0.0.0.0 --port=8080
  28. sh oasis.sh --allow-host=oasis.example.com --no-open
  29. EOF
  30. }
  31. if [ -f "$CONFIG_FILE" ]; then
  32. if [ -f "$MODEL_PATH" ]; then
  33. sed -i.bak 's/"aiMod": *"off"/"aiMod": "on"/' "$CONFIG_FILE"
  34. else
  35. sed -i.bak 's/"aiMod": *"on"/"aiMod": "off"/' "$CONFIG_FILE"
  36. fi
  37. rm -f "$CONFIG_FILE.bak"
  38. fi
  39. case "$MODE" in
  40. help|-h|--help)
  41. show_help
  42. exit 0
  43. ;;
  44. server|pub)
  45. cd "$CURRENT_DIR/src/server" || exit 1
  46. exec node SSB_server.js start
  47. ;;
  48. gui)
  49. shift
  50. cd "$CURRENT_DIR/src/backend" || exit 1
  51. exec node backend.js "$@"
  52. ;;
  53. *)
  54. cd "$CURRENT_DIR/src/backend" || exit 1
  55. exec node backend.js "$@"
  56. ;;
  57. esac