mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-08 10:47:52 +02:00
fix cassette hashing
This commit is contained in:
@@ -24,14 +24,16 @@ function decompressData(compressedString: string): NockCassetteData {
|
||||
return msgpack.decode(decompressed) as NockCassetteData;
|
||||
}
|
||||
|
||||
// deno-lint-ignore no-unused-vars
|
||||
class HashedCassette {
|
||||
hash: string;
|
||||
private recording = true;
|
||||
|
||||
constructor(
|
||||
private readonly cassettePath: string,
|
||||
private readonly hash: string
|
||||
) {}
|
||||
hash: string
|
||||
) {
|
||||
this.hash = hash;
|
||||
}
|
||||
|
||||
async enter() {
|
||||
try {
|
||||
|
||||
@@ -63,7 +63,7 @@ class HashedCassette:
|
||||
content = f.read()
|
||||
try:
|
||||
cassette_data = serializer.deserialize(content)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
os.remove(self.cassette_path)
|
||||
else:
|
||||
existing_hash = cassette_data.get("cassette_hash")
|
||||
@@ -96,7 +96,7 @@ class HashedCassette:
|
||||
content = f.read()
|
||||
try:
|
||||
cassette_data = serializer.deserialize(content)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
return result
|
||||
# Update the cassette data with the expected hash.
|
||||
if cassette_data.get("cassette_hash") != self.hash_value:
|
||||
|
||||
Reference in New Issue
Block a user