|
@@ -53,13 +53,13 @@ def search():
|
|
|
data = request.get_json()
|
|
|
if not data:
|
|
|
return jsonify({'error': '请求必须包含JSON数据'}), 400
|
|
|
-
|
|
|
image_url = data.get('url')
|
|
|
if not image_url:
|
|
|
return jsonify({'error': '缺少url参数'}), 400
|
|
|
if not isinstance(image_url, str) or not (image_url.startswith('http://') or image_url.startswith('https://')):
|
|
|
return jsonify({'error': '无效的图片URL'}), 400
|
|
|
|
|
|
+ print(f"search payload, type:{type(data)}, data: {data}")
|
|
|
# 获取可选参数
|
|
|
limit = data.get('limit', config.TOP_K)
|
|
|
min_score = data.get('min_score', config.MIN_SCORE)
|
|
@@ -73,17 +73,15 @@ def search():
|
|
|
|
|
|
if limit <= 0:
|
|
|
return jsonify({'error': 'limit必须大于0'}), 400
|
|
|
- if min_score < 0 or min_score > 100:
|
|
|
- return jsonify({'error': 'min_score必须在0到100之间'}), 400
|
|
|
- if max_score < 0 or max_score > 100:
|
|
|
- return jsonify({'error': 'max_score必须在0到100之间'}), 400
|
|
|
+ if min_score < 0 or min_score > 1.0:
|
|
|
+ return jsonify({'error': 'min_score必须在0到1之间'}), 400
|
|
|
+ if max_score < 0 or max_score > 1.0:
|
|
|
+ return jsonify({'error': 'max_score必须在0到1之间'}), 400
|
|
|
if min_score > max_score:
|
|
|
return jsonify({'error': 'min_score不能大于max_score'}), 400
|
|
|
except ValueError:
|
|
|
return jsonify({'error': '参数类型错误'}), 400
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ print(f"search apply limit:{limit} min_score:{min_score} max_score:{max_score}")
|
|
|
|
|
|
start_search_time = time.time()
|
|
|
|