From fab7170954b8aa21779156a4be640cd909e5796c Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 23 Apr 2026 11:29:57 +0800 Subject: [PATCH] Add multi-user support: update create_session to accept user_id parameter and use ahserver's get_user() in create_session.dspy --- .../__pycache__/__init__.cpython-310.pyc | Bin 0 -> 152 bytes hermes_web_cli/init.py | 4 ++-- wwwroot/.new_session.ui.swp | Bin 12288 -> 0 bytes wwwroot/sessions/create_session.dspy | 8 +++++--- 4 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 hermes_web_cli/__pycache__/__init__.cpython-310.pyc delete mode 100644 wwwroot/.new_session.ui.swp diff --git a/hermes_web_cli/__pycache__/__init__.cpython-310.pyc b/hermes_web_cli/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..66989cf7040aa2804239b4ae4846399098f6d88f GIT binary patch literal 152 zcmd1j<>g`kf;jHynIQTxh(HF6K#l_t7qb9~6oz01O-8?!3`HPe1o6vSKSe(ywJ0~W zI5AVdD77HJ7|PWxPfgNI&dG#wPO2Tq&|)Sa H!NLFlUA-dm literal 0 HcmV?d00001 diff --git a/hermes_web_cli/init.py b/hermes_web_cli/init.py index 254b17a..2bbc243 100644 --- a/hermes_web_cli/init.py +++ b/hermes_web_cli/init.py @@ -134,7 +134,7 @@ def test_service_connection(url: str, apikey: str = "") -> Tuple[bool, str]: return False, f"Error: {str(e)}" # Session management -def create_session(service_id: str, user_message: str = "") -> str: +def create_session(service_id: str, user_id: str, user_message: str = "") -> str: """Create a new session with a Hermes service.""" try: # Get service configuration @@ -158,7 +158,7 @@ def create_session(service_id: str, user_message: str = "") -> str: response = requests.post( f"{service_url.rstrip('/')}/api/v1/sessions", json={ - "user_id": "web-cli-user", # This could be made configurable + "user_id": user_id, "initial_message": user_message if user_message else None }, headers=headers, diff --git a/wwwroot/.new_session.ui.swp b/wwwroot/.new_session.ui.swp deleted file mode 100644 index ce130edaab88e67efb9708940d144244e0c3c084..0000000000000000000000000000000000000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