From 62a666e16ef26b3003ba35d59bddda9ec1650b62 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 22 Apr 2026 13:17:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3hermes=5Fservices=20li?= =?UTF-8?q?st=E7=AB=AF=E7=82=B9=E8=BF=94=E5=9B=9E=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E7=9B=B4=E6=8E=A5=E8=BF=94=E5=9B=9E=E6=95=B0=E7=BB=84?= =?UTF-8?q?=E4=BE=9Bcode=E7=BB=84=E4=BB=B6=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/hermes_services/list/index.dspy | 47 +++++++++---------------- 1 file changed, 17 insertions(+), 30 deletions(-) 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