diff --git a/features/conversation-assistant/macos/install.sh b/features/conversation-assistant/macos/install.sh index 6ed20a34e..5ec53c6c6 100755 --- a/features/conversation-assistant/macos/install.sh +++ b/features/conversation-assistant/macos/install.sh @@ -158,22 +158,30 @@ discover_service_url() { # Try to discover conversation-assistant service from service-registry local registry_url="${SERVICE_REGISTRY_URL:-http://localhost:30000}" - # Try to discover the service + # Try to discover the service (POST with JSON body) local discovery_response - discovery_response=$(curl -s --connect-timeout 2 "$registry_url/registry/discover?serviceName=conversation-assistant&healthy=true" 2>/dev/null || echo "") + discovery_response=$(curl -s --connect-timeout 2 \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"serviceName":"conversation-assistant","healthy":true}' \ + "$registry_url/registry/discover" 2>/dev/null || echo "") if [[ -n "$discovery_response" && "$discovery_response" != *"error"* ]]; then - # Parse the first instance's URL from JSON response + # Parse the first service's URL from JSON response local service_url service_url=$(echo "$discovery_response" | python3 -c " import sys, json try: data = json.load(sys.stdin) - if data.get('instances') and len(data['instances']) > 0: - inst = data['instances'][0] - ip = inst.get('ipAddress', 'localhost') - port = inst.get('port', 3105) - print(f'http://{ip}:{port}') + services = data.get('services', []) + if services and len(services) > 0: + svc = services[0] + # Prefer host (domain) over ipAddress for proper SSL/routing + host = svc.get('host') or svc.get('ipAddress', 'localhost') + port = svc.get('port', 3105) + # Use https if host is a domain name + scheme = 'https' if '.' in host and not host.replace('.','').isdigit() else 'http' + print(f'{scheme}://{host}:{port}') except: pass " 2>/dev/null)