mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-23 11:36:38 +08:00
Feat: Hash doc id to avoid duplicate name. (#12573)
### What problem does this PR solve? Feat: Hash doc id to avoid duplicate name. ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -13,6 +13,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
import xxhash
|
||||
|
||||
|
||||
def string_to_bytes(string):
|
||||
return string if isinstance(
|
||||
@ -22,3 +24,6 @@ def string_to_bytes(string):
|
||||
def bytes_to_string(byte):
|
||||
return byte.decode(encoding="utf-8")
|
||||
|
||||
# 128 bit = 32 character
|
||||
def hash128(data: str) -> str:
|
||||
return xxhash.xxh128(data).hexdigest()
|
||||
|
||||
Reference in New Issue
Block a user