import urllib.request, urllib.parse, json # First test: exactly what user provided params1 = urllib.parse.urlencode({ "q": "散景 浅景深 逆光 光斑 背景虚化 轮廓光", "capability_id": "CAP-001", "types": "strategy,case,tool", "top_k": 10, "min_score": 3 }) try: req1 = urllib.request.Request(f'http://localhost:8000/api/knowledge/search?{params1}') with urllib.request.urlopen(req1) as f: print('Search 1 (all types): count =', json.loads(f.read().decode('utf-8')).get('count', 0)) except Exception as e: print('Search 1 error:', e) # Second test: only one type params2 = urllib.parse.urlencode({ "q": "散景 浅景深 逆光 光斑 背景虚化 轮廓光", "capability_id": "CAP-001", "types": "case", "top_k": 10, "min_score": 3 }) try: req2 = urllib.request.Request(f'http://localhost:8000/api/knowledge/search?{params2}') with urllib.request.urlopen(req2) as f: print('Search 2 (single type case): count =', json.loads(f.read().decode('utf-8')).get('count', 0)) except Exception as e: print('Search 2 error:', e) # Third test: no types filter params3 = urllib.parse.urlencode({ "q": "散景 浅景深 逆光 光斑 背景虚化 轮廓光", "capability_id": "CAP-001", "top_k": 10, "min_score": 3 }) try: req3 = urllib.request.Request(f'http://localhost:8000/api/knowledge/search?{params3}') with urllib.request.urlopen(req3) as f: print('Search 3 (no types filter): count =', json.loads(f.read().decode('utf-8')).get('count', 0)) except Exception as e: print('Search 3 error:', e)