Spaces:
Sleeping
Sleeping
Update python.app
Browse files- python.app +8 -0
python.app
CHANGED
|
@@ -72,6 +72,14 @@ def iter_structure_chunks(node, max_tokens=1024, min_tokens=200):
|
|
| 72 |
if buffer:
|
| 73 |
yield node, buffer
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
import hashlib, json
|
| 76 |
def stable_id(*parts):
|
| 77 |
s = "||".join(p for p in parts if p)
|
|
|
|
| 72 |
if buffer:
|
| 73 |
yield node, buffer
|
| 74 |
|
| 75 |
+
import hashlib, json
|
| 76 |
+
def stable_id(*parts):
|
| 77 |
+
s = "||".join(p for p in parts if p)
|
| 78 |
+
return hashlib.sha256(s.encode("utf-8")).hexdigest()[:16]
|
| 79 |
+
|
| 80 |
+
node_id = stable_id(source.sha256 or source.url, "/".join(path), numbering or "")
|
| 81 |
+
chunk_id = stable_id(node_id, str(idx))
|
| 82 |
+
|
| 83 |
import hashlib, json
|
| 84 |
def stable_id(*parts):
|
| 85 |
s = "||".join(p for p in parts if p)
|