diff --git a/src/agentscope/studio/_app_online.py b/src/agentscope/studio/_app_online.py index 521283d0a..8bb9b380d 100644 --- a/src/agentscope/studio/_app_online.py +++ b/src/agentscope/studio/_app_online.py @@ -3,6 +3,8 @@ import ipaddress import json import os +import uuid +import time import secrets import tempfile from typing import Tuple, Any @@ -196,6 +198,22 @@ def _home() -> str: return render_template("login.html", client_id=CLIENT_ID, ip=IP, port=PORT) +@_app.route("/login_as_guest") +def login_as_guest() -> str: + """Render the workstation page without login.""" + user_login = f"guest_{uuid.uuid4().hex}_{int(time.time())}" + session["verification_token"] = generate_verification_token() + session["user_login"] = user_login + session["jwt_token"] = generate_jwt( + user_login=user_login, + access_token="access_token", + verification_token=session["verification_token"], + secret_key=SECRET_KEY, + version="online", + ) + return redirect(url_for("_workstation_online")) + + @_app.route("/logout") def logout() -> str: """ @@ -208,7 +226,7 @@ def logout() -> str: @_app.route("/oauth/callback") def oauth_callback() -> str: """ - Github oauth callback. + GitHub oauth callback. """ code = request.args.get("code") if not code: diff --git a/src/agentscope/studio/static/css/login.css b/src/agentscope/studio/static/css/login.css index 8ec8a7ea8..43d2cd761 100644 --- a/src/agentscope/studio/static/css/login.css +++ b/src/agentscope/studio/static/css/login.css @@ -49,6 +49,38 @@ body { cursor: not-allowed; } +#loginGuestButton { + color: #a0a0a0; + font-size: 12px; + padding: 5px 8px; + cursor: pointer; + box-shadow: none; + transition: transform 0.2s; + margin-top: 0.5rem; + display: inline-block; + width: auto; + background: none; + border: none; + text-decoration: underline; +} + +#loginGuestButton:hover { + transform: scale(1.01); + text-decoration: underline; +} + +#loginGuestButton:active { + transform: scale(1); + text-decoration: underline; +} + +#loginGuestButton:disabled { + color: #d3d3d3; + cursor: not-allowed; + text-decoration: none; + transform: none; +} + .terms { background: #fff; padding: 20px; diff --git a/src/agentscope/studio/templates/login.html b/src/agentscope/studio/templates/login.html index 1fc27a641..1df6d5ef3 100644 --- a/src/agentscope/studio/templates/login.html +++ b/src/agentscope/studio/templates/login.html @@ -72,6 +72,9 @@