Add native Windows compatibility layer

This commit is contained in:
pewdiepie-archdaemon
2026-06-01 15:09:47 +09:00
parent ead7c01822
commit 0888a3b3e6
54 changed files with 1104 additions and 267 deletions
+3 -3
View File
@@ -173,7 +173,7 @@ def _entry_from_modelinfo(mi, overrides):
def main():
with open(DATA_PATH) as f:
with open(DATA_PATH, encoding="utf-8") as f:
catalog = json.load(f)
by_name = {m["name"]: m for m in catalog}
existing = set(by_name)
@@ -214,12 +214,12 @@ def main():
return
# Backup + merge
with open(DATA_PATH + ".bak", "w") as f:
with open(DATA_PATH + ".bak", "w", encoding="utf-8") as f:
json.dump(catalog, f, indent=2)
for name, entry in to_add.items():
by_name[name] = entry
merged = list(by_name.values())
with open(DATA_PATH, "w") as f:
with open(DATA_PATH, "w", encoding="utf-8") as f:
json.dump(merged, f, indent=2)
print(f"\nAdded/updated {len(to_add)} models. Catalog now {len(merged)} (was {len(catalog)}).")
+2 -2
View File
@@ -29,7 +29,7 @@ def main():
if not os.path.exists(path):
print(f" {label}: not found, skipping")
continue
with open(path, "r") as f:
with open(path, "r", encoding="utf-8") as f:
entries = json.load(f)
count = 0
for e in entries:
@@ -37,7 +37,7 @@ def main():
e["owner"] = owner
count += 1
if count:
with open(path, "w") as f:
with open(path, "w", encoding="utf-8") as f:
json.dump(entries, f, ensure_ascii=False, indent=2)
print(f" {label}: claimed {count} entries")
+1 -1
View File
@@ -117,7 +117,7 @@ def load_model():
cls_name_from_index = ""
if model_index.exists():
try:
idx = json.loads(model_index.read_text())
idx = json.loads(model_index.read_text(encoding="utf-8"))
cls_name_from_index = idx.get("_class_name", "")
if hasattr(diffusers, cls_name_from_index):
pipeline_cls = getattr(diffusers, cls_name_from_index)
+3 -3
View File
@@ -39,7 +39,7 @@ def migrate_memories():
logger.info("No memory FAISS index found, skipping memory migration")
return
ids = json.loads(open(ids_path).read())
ids = json.loads(open(ids_path, encoding="utf-8").read())
if not ids:
logger.info("Memory FAISS index is empty, skipping")
return
@@ -47,7 +47,7 @@ def migrate_memories():
# Load memory texts
memories = {}
if os.path.exists(memory_path):
for mem in json.loads(open(memory_path).read()):
for mem in json.loads(open(memory_path, encoding="utf-8").read()):
memories[mem.get("id", "")] = mem
embed = get_embedding_client()
@@ -97,7 +97,7 @@ def migrate_rag():
logger.info("No RAG DocStore found, skipping RAG migration")
return
data = json.loads(open(docs_path).read())
data = json.loads(open(docs_path, encoding="utf-8").read())
ids = data.get("ids", [])
documents = data.get("documents", [])
metadatas = data.get("metadatas", [])