mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-29 22:56:36 +08:00
Fix: overlap cannot be properly applied (#12828)
### What problem does this PR solve? Overlap cannot be properly applied. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -14,6 +14,7 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
def get_float(v):
|
||||
"""
|
||||
Convert a value to float, handling None and exceptions gracefully.
|
||||
@ -39,8 +40,19 @@ def get_float(v):
|
||||
42.0
|
||||
"""
|
||||
if v is None:
|
||||
return float('-inf')
|
||||
return float("-inf")
|
||||
try:
|
||||
return float(v)
|
||||
except Exception:
|
||||
return float('-inf')
|
||||
return float("-inf")
|
||||
|
||||
|
||||
def normalize_overlapped_percent(overlapped_percent):
|
||||
try:
|
||||
value = float(overlapped_percent)
|
||||
except (TypeError, ValueError):
|
||||
return 0
|
||||
if 0 < value < 1:
|
||||
value *= 100
|
||||
value = int(value)
|
||||
return max(0, min(value, 90))
|
||||
|
||||
Reference in New Issue
Block a user