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

37 lines
1.1 KiB
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/services/list
import json
from hermes_web_cli.init import get_all_services
def main():
"""Main function to handle the services list API request for select dropdowns."""
try:
# Get all services from the module
services = get_all_services()
# Format for select dropdown (value, label pairs)
service_options = []
for service in services:
service_options.append({
"value": service.get("id"),
"label": service.get("name", f"Service {service.get('id')}")
})
# Return as JSON response
return {
"status": "success",
"data": service_options,
"total": len(service_options)
}
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))