🐛 Bug: Fix the bug where the sheet page cannot fully display when there are too many models.
Browse files
main.py
CHANGED
@@ -1321,7 +1321,8 @@ async def get_edit_sheet(row_id: str, x_api_key: str = Depends(get_api_key)):
|
|
1321 |
Div("Models", class_="text-lg font-semibold mb-2"),
|
1322 |
Div(
|
1323 |
*model_list,
|
1324 |
-
id="models-container"
|
|
|
1325 |
),
|
1326 |
button.button(
|
1327 |
"Add Model",
|
@@ -1349,7 +1350,8 @@ async def get_edit_sheet(row_id: str, x_api_key: str = Depends(get_api_key)):
|
|
1349 |
),
|
1350 |
class_="container mx-auto p-4 max-w-2xl"
|
1351 |
)
|
1352 |
-
)
|
|
|
1353 |
)
|
1354 |
|
1355 |
result = sheet.Sheet(
|
@@ -1429,7 +1431,7 @@ def update_row_data(row_id, updated_data):
|
|
1429 |
|
1430 |
def save_api_yaml():
|
1431 |
with open(API_YAML_PATH, "w", encoding="utf-8") as f:
|
1432 |
-
yaml.
|
1433 |
|
1434 |
@frontend_router.post("/submit/{row_id}", response_class=HTMLResponse, dependencies=[Depends(frontend_rate_limit_dependency)])
|
1435 |
async def submit_form(
|
|
|
1321 |
Div("Models", class_="text-lg font-semibold mb-2"),
|
1322 |
Div(
|
1323 |
*model_list,
|
1324 |
+
id="models-container",
|
1325 |
+
class_="space-y-2 max-h-[40vh] overflow-y-auto"
|
1326 |
),
|
1327 |
button.button(
|
1328 |
"Add Model",
|
|
|
1350 |
),
|
1351 |
class_="container mx-auto p-4 max-w-2xl"
|
1352 |
)
|
1353 |
+
),
|
1354 |
+
class_="max-h-[90vh] overflow-y-auto"
|
1355 |
)
|
1356 |
|
1357 |
result = sheet.Sheet(
|
|
|
1431 |
|
1432 |
def save_api_yaml():
|
1433 |
with open(API_YAML_PATH, "w", encoding="utf-8") as f:
|
1434 |
+
yaml.round_trip_dump(app.state.config, f)
|
1435 |
|
1436 |
@frontend_router.post("/submit/{row_id}", response_class=HTMLResponse, dependencies=[Depends(frontend_rate_limit_dependency)])
|
1437 |
async def submit_form(
|
utils.py
CHANGED
@@ -110,7 +110,7 @@ def update_config(config_data):
|
|
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)
|
@@ -126,8 +126,8 @@ async def load_config(app=None):
|
|
126 |
except FileNotFoundError:
|
127 |
logger.error("'api.yaml' not found. Please check the file path.")
|
128 |
config, api_keys_db, api_list = [], [], []
|
129 |
-
except
|
130 |
-
logger.error("配置文件 'api.yaml' 格式不正确。请检查 YAML
|
131 |
config, api_keys_db, api_list = [], [], []
|
132 |
except OSError as e:
|
133 |
logger.error(f"open 'api.yaml' failed: {e}")
|
|
|
110 |
|
111 |
# 读取YAML配置文件
|
112 |
async def load_config(app=None):
|
113 |
+
from ruamel.yaml import YAML, YAMLError
|
114 |
yaml = YAML()
|
115 |
yaml.preserve_quotes = True
|
116 |
yaml.indent(mapping=2, sequence=4, offset=2)
|
|
|
126 |
except FileNotFoundError:
|
127 |
logger.error("'api.yaml' not found. Please check the file path.")
|
128 |
config, api_keys_db, api_list = [], [], []
|
129 |
+
except YAMLError as e:
|
130 |
+
logger.error("配置文件 'api.yaml' 格式不正确。请检查 YAML 格式。%s", e)
|
131 |
config, api_keys_db, api_list = [], [], []
|
132 |
except OSError as e:
|
133 |
logger.error(f"open 'api.yaml' failed: {e}")
|