yumoqing 5d4e70da8e feat: complete missing UI files and API endpoints for hermes-web-cli
- Added all missing .ui files referenced in index.ui:
  * new_session.ui
  * sessions.ui
  * services.ui
  * settings.ui
  * session_detail.ui
  * add_service.ui
  * edit_service.ui

- Created corresponding .dspy API endpoints with proper directory structure:
  * /hermes-web-cli/services → services/index.dspy
  * /hermes-web-cli/services/list → services/list/index.dspy
  * /hermes-web-cli/services/{id} → services/id/index.dspy
  * /hermes-web-cli/services/test?id={id} → services/test/index.dspy
  * /hermes-web-cli/sessions (POST) → sessions/index.dspy
  * /hermes-web-cli/sessions/messages?session_id={id} → sessions/messages/index.dspy
  * /hermes-web-cli/settings → settings/index.dspy
  * /hermes-web-cli/settings/reset → settings/reset/index.dspy

- Fixed UI styling to comply with bricks-framework (removed nested style objects)
- Updated URL references to use query parameters instead of path parameters for dynamic routes
- All files follow production-ready module development specifications
2026-04-22 11:22:44 +08:00

29 lines
836 B
Plaintext

# This is a controlled Python script (.dspy file) that will be executed by the web framework
# It provides the API endpoint for /hermes-web-cli/sessions/recent
import json
from hermes_web_cli.init import get_recent_sessions
def main():
"""Main function to handle the recent sessions API request."""
try:
# Get recent sessions from the module
sessions = get_recent_sessions(limit=5)
# Return as JSON response
return {
"status": "success",
"data": sessions,
"total": len(sessions)
}
except Exception as e:
return {
"status": "error",
"message": str(e),
"data": [],
"total": 0
}
# Execute and return JSON response
result = main()
print(json.dumps(result, ensure_ascii=False))