🐛 Bug: Fix the bug where the remote configuration file cannot be parsed.
Browse files- .gitignore +2 -1
- utils.py +6 -6
.gitignore
CHANGED
@@ -11,4 +11,5 @@ node_modules
|
|
11 |
*.png
|
12 |
*.db
|
13 |
.aider*
|
14 |
-
.idea
|
|
|
|
11 |
*.png
|
12 |
*.db
|
13 |
.aider*
|
14 |
+
.idea
|
15 |
+
docker-compose-test.yml
|
utils.py
CHANGED
@@ -58,7 +58,7 @@ def update_initial_model(api_url, api):
|
|
58 |
# print(models_id)
|
59 |
return models_id
|
60 |
except Exception as e:
|
61 |
-
print("error:", e)
|
62 |
import traceback
|
63 |
traceback.print_exc()
|
64 |
return []
|
@@ -110,11 +110,11 @@ def update_config(config_data):
|
|
110 |
|
111 |
# 读取YAML配置文件
|
112 |
async def load_config(app=None):
|
|
|
|
|
|
|
|
|
113 |
try:
|
114 |
-
from ruamel.yaml import YAML
|
115 |
-
yaml = YAML()
|
116 |
-
yaml.preserve_quotes = True
|
117 |
-
yaml.indent(mapping=2, sequence=4, offset=2)
|
118 |
with open('api.yaml', 'r', encoding='utf-8') as file:
|
119 |
conf = yaml.load(file)
|
120 |
|
@@ -144,7 +144,7 @@ async def load_config(app=None):
|
|
144 |
response = await app.state.client.get(config_url)
|
145 |
# logger.info(f"Fetching config from {response.text}")
|
146 |
response.raise_for_status()
|
147 |
-
config_data = yaml.
|
148 |
# 更新配置
|
149 |
# logger.info(config_data)
|
150 |
if config_data:
|
|
|
58 |
# print(models_id)
|
59 |
return models_id
|
60 |
except Exception as e:
|
61 |
+
# print("error:", e)
|
62 |
import traceback
|
63 |
traceback.print_exc()
|
64 |
return []
|
|
|
110 |
|
111 |
# 读取YAML配置文件
|
112 |
async def load_config(app=None):
|
113 |
+
from ruamel.yaml import YAML
|
114 |
+
yaml = YAML()
|
115 |
+
yaml.preserve_quotes = True
|
116 |
+
yaml.indent(mapping=2, sequence=4, offset=2)
|
117 |
try:
|
|
|
|
|
|
|
|
|
118 |
with open('api.yaml', 'r', encoding='utf-8') as file:
|
119 |
conf = yaml.load(file)
|
120 |
|
|
|
144 |
response = await app.state.client.get(config_url)
|
145 |
# logger.info(f"Fetching config from {response.text}")
|
146 |
response.raise_for_status()
|
147 |
+
config_data = yaml.load(response.text)
|
148 |
# 更新配置
|
149 |
# logger.info(config_data)
|
150 |
if config_data:
|