We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9dfebd8 + 8ebe4ce commit 8295a5dCopy full SHA for 8295a5d
kirara_ai/config/__init__.py
@@ -0,0 +1,14 @@
1
+import os
2
+
3
+# 读取DATA_PATH环境变量,若未能找到则以当前工作目录为根文件夹存储在$PWD/data目录下。
4
+DATA_PATH = os.path.abspath(
5
+ os.environ.get("DATA_PATH", os.path.join(os.getcwd(), "data"))
6
+)
7
+# 按照规范插件应该在PLUGIN_PATH目录下存储对应的文件。
8
+PLUGIN_PATH = os.path.join(DATA_PATH, "plugins")
9
10
+if os.path.exists(DATA_PATH) is False:
11
+ os.makedirs(DATA_PATH)
12
13
+if os.path.exists(PLUGIN_PATH) is False:
14
+ os.makedirs(PLUGIN_PATH)
kirara_ai/config/config_loader.py
@@ -8,8 +8,9 @@
from ruamel.yaml import YAML
from ..logger import get_logger
+from . import DATA_PATH
-CONFIG_FILE = "data/config.yaml"
+CONFIG_FILE = os.path.join(DATA_PATH, "config.yaml")
15
T = TypeVar("T", bound=BaseModel)
16
0 commit comments