mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 21:39:00 +08:00
fix: Fix return type annotation in truncate function (#2044)
### What problem does this PR solve? Fix return type annotation in truncate function ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
4580ad2fd7
commit
59ba34e167
@ -85,6 +85,6 @@ def num_tokens_from_string(string: str) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def truncate(string: str, max_len: int) -> int:
|
||||
def truncate(string: str, max_len: int) -> str:
|
||||
"""Returns truncated text if the length of text exceed max_len."""
|
||||
return encoder.decode(encoder.encode(string)[:max_len])
|
||||
|
Loading…
x
Reference in New Issue
Block a user