Compare commits
2 commits
c7bacb674f
...
0d9812490a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d9812490a | ||
|
|
b158809c19 |
1 changed files with 6 additions and 0 deletions
|
|
@ -126,6 +126,12 @@ class _CacheManager:
|
||||||
return f"Error: missing required fields: {', '.join(sorted(missing))}"
|
return f"Error: missing required fields: {', '.join(sorted(missing))}"
|
||||||
if "content" in data or "contents" in data or "raw" in data:
|
if "content" in data or "contents" in data or "raw" in data:
|
||||||
return "Error: cache entries must not contain raw file contents."
|
return "Error: cache entries must not contain raw file contents."
|
||||||
|
if "confidence" in data:
|
||||||
|
c = data["confidence"]
|
||||||
|
if not isinstance(c, (int, float)) or not (0.0 <= c <= 1.0):
|
||||||
|
return "Error: confidence must be a float between 0.0 and 1.0"
|
||||||
|
if "confidence_reason" in data and not isinstance(data["confidence_reason"], str):
|
||||||
|
return "Error: confidence_reason must be a string"
|
||||||
try:
|
try:
|
||||||
with open(cache_file, "w") as f:
|
with open(cache_file, "w") as f:
|
||||||
json.dump(data, f, indent=2)
|
json.dump(data, f, indent=2)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue