Fix the async issue while running on Windows

This commit is contained in:
Samuel Chan
2024-12-27 12:01:50 +08:00
parent 45cea6e9ff
commit 42b3690e71

View File

@@ -1,7 +1,7 @@
import asyncio import asyncio
import inspect import inspect
import json import json
import os import os, sys
from contextlib import asynccontextmanager from contextlib import asynccontextmanager
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union
@@ -20,6 +20,9 @@ from lightrag.utils import logger
from ..base import BaseGraphStorage from ..base import BaseGraphStorage
if sys.platform.startswith("win"):
import asyncio.windows_events
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
class AGEQueryException(Exception): class AGEQueryException(Exception):
"""Exception for the AGE queries.""" """Exception for the AGE queries."""