test prompt from knowledge object

This commit is contained in:
tsukasa
2023-09-18 11:28:21 +08:00
parent 805dc88de2
commit 441583b7f8
7 changed files with 71 additions and 38 deletions
+5 -1
View File
@@ -44,7 +44,11 @@ class ObjectID: # pylint: disable=too-few-public-methods
@staticmethod
def new_chunk_id(chunk_hash: HashValue):
return ObjectID(chunk_hash.value)
assert len(chunk_hash.value) == 32, "ObjectID must be 32 bytes long"
return ObjectID(bytes([ObjectType.Chunk]) + chunk_hash.value[1:])
def get_object_type(self) -> ObjectType:
return ObjectType(self.value[0])
@staticmethod
def hash_data(data: bytes):