-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #189 from SecretiveShell/pydantic-config
Update the config system to use Pydantic internally, bridging the gap between the YAML and args. YAML is still the preferred method to configure TabbyAPI, but args are no longer separately maintained.
- Loading branch information
Showing
22 changed files
with
1,092 additions
and
632 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -213,3 +213,6 @@ openapi.json | |
|
||
# Infinity-emb cache | ||
.infinity_cache/ | ||
|
||
# Backup files | ||
*.bak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import json | ||
from loguru import logger | ||
|
||
from common.tabby_config import config, generate_config_file | ||
from endpoints.server import export_openapi | ||
|
||
|
||
def branch_to_actions() -> bool: | ||
"""Checks if a optional action needs to be run.""" | ||
|
||
if config.actions.export_openapi: | ||
openapi_json = export_openapi() | ||
|
||
with open(config.actions.openapi_export_path, "w") as f: | ||
f.write(json.dumps(openapi_json)) | ||
logger.info( | ||
"Successfully wrote OpenAPI spec to " | ||
+ f"{config.actions.openapi_export_path}" | ||
) | ||
elif config.actions.export_config: | ||
generate_config_file(filename=config.actions.config_export_path) | ||
else: | ||
# did not branch | ||
return False | ||
|
||
# branched and ran an action | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.