-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: streamline CLI and logging initialization
- Simplify CLI command initialization by integrating dependency injection - Optimize logging setup with cached initialization functions - Remove redundant model list and fallback configurations - Update API keys for model configurations
- Loading branch information
Showing
15 changed files
with
83 additions
and
212 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
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 |
---|---|---|
@@ -1,20 +1,8 @@ | ||
from typing import Annotated | ||
import typer_di | ||
|
||
import typer | ||
|
||
import llm_cli as lc | ||
import llm_cli.cmd as lcm | ||
import llm_cli.config as lcc | ||
import llm_cli.utils as lcu | ||
|
||
app: typer.Typer = typer.Typer(name="llm-cli", no_args_is_help=True) | ||
app = typer_di.TyperDI(name="llm-cli", no_args_is_help=True) | ||
lcu.add_command(app, lcm.repo.app) | ||
lcu.add_command(app, lcm.commit.app) | ||
|
||
|
||
@app.callback() | ||
def init(model: Annotated[str | None, typer.Option()] = None) -> None: | ||
lc.logging.init() | ||
cfg: lcc.Config = lcc.get_config() | ||
if model: | ||
cfg.completion.model = model |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import typer | ||
import typer_di | ||
|
||
import llm_cli.utils as lcu | ||
from llm_cli import cmd as lcm | ||
|
||
app: typer.Typer = typer.Typer(name="repo", no_args_is_help=True) | ||
app = typer_di.TyperDI(name="repo", no_args_is_help=True) | ||
lcu.add_command(app, lcm.repo.description.app) | ||
lcu.add_command(app, lcm.repo.topics.app) |
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import asyncio | ||
|
||
import typer | ||
import typer_di | ||
|
||
app: typer.Typer = typer.Typer(name="description", no_args_is_help=True) | ||
import llm_cli.utils as lcu | ||
|
||
app = typer_di.TyperDI(name="description") | ||
|
||
|
||
@app.command() | ||
def main() -> None: | ||
def main(_: None = typer_di.Depends(lcu.get_config)) -> None: | ||
from ._main import main | ||
|
||
asyncio.run(main()) |
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import asyncio | ||
|
||
import typer | ||
import typer_di | ||
|
||
app: typer.Typer = typer.Typer(name="topics", no_args_is_help=True) | ||
import llm_cli.utils as lcu | ||
|
||
app = typer_di.TyperDI(name="topics") | ||
|
||
|
||
@app.command() | ||
def main() -> None: | ||
def main(_: None = typer_di.Depends(lcu.get_config)) -> None: | ||
from ._main import main | ||
|
||
asyncio.run(main()) |
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.