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:
Magicbook1108
2026-01-15 14:02:15 +08:00
committed by GitHub
parent 9a10558f80
commit b40a7b2e7d
4 changed files with 18 additions and 4 deletions

View File

@ -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()