diff --git a/wwwroot/hermes_services/list/index.dspy b/wwwroot/hermes_services/list/index.dspy index 734df8c..4f00989 100644 --- a/wwwroot/hermes_services/list/index.dspy +++ b/wwwroot/hermes_services/list/index.dspy @@ -1,33 +1,20 @@ # Get hermes_services list for code dropdown # This .dspy file uses functions released by load_hermes_web_cli() -def main(): - """Get hermes_services records for code component dropdown.""" - try: - # Use the function provided by hermes-web-cli module - services = get_all_services() - - # Format for code component (value, text pairs) - result = [] - for service in services: - result.append({ - "value": str(service.get('id')), - "text": service.get('name', f"Service {service.get('id')}") - }) - - return { - "status": "success", - "data": result, - "total": len(result) - } - 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)) \ No newline at end of file +try: + # Use the function provided by hermes-web-cli module + services = get_all_services() + + # Format for code component (value, text pairs) + result = [] + for service in services: + result.append({ + "value": str(service.get('id')), + "text": service.get('name', f"Service {service.get('id')}") + }) + + # Return array directly for code component + print(json.dumps(result, ensure_ascii=False)) +except Exception as e: + # On error or no data, return empty array + print(json.dumps([], ensure_ascii=False)) \ No newline at end of file