Add OmniVoice TTS module with config, API, profiles and CLI
- Create modules/omnivoice/ with VoiceAPI, VoiceProfiles, CLI - Add config manager integration with local model support - Add app/komAI.py entry point - Add tests/test_omnivoice.py - Clone OmniVoice to external/ for development - Add omnivoice config to global.yaml
This commit is contained in:
90
app/komAI.py
Normal file
90
app/komAI.py
Normal file
@@ -0,0 +1,90 @@
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
import src.utils.config_manager as config
|
||||
import src.utils.log_manager as log
|
||||
|
||||
from modules.omnivoice import register_config, register_logging
|
||||
|
||||
|
||||
def init():
|
||||
cfg = config.config
|
||||
|
||||
try:
|
||||
register_config()
|
||||
except Exception as e:
|
||||
print(f"Failed to register omnivoice config: {e}")
|
||||
|
||||
cfg.load()
|
||||
|
||||
log.register_global_params()
|
||||
log.register(module="app", log_console=True, log_file="app.log")
|
||||
log.setup()
|
||||
|
||||
logger = log.get_logger("app")
|
||||
logger.print("komAI initialized")
|
||||
|
||||
try:
|
||||
register_logging()
|
||||
except Exception as e:
|
||||
logger.print(f"Failed to register omnivoice logging: {e}", level="warning")
|
||||
|
||||
return logger
|
||||
|
||||
|
||||
def init_cli():
|
||||
import src.utils.config_manager as config
|
||||
|
||||
cfg = config.config
|
||||
|
||||
try:
|
||||
from modules.omnivoice import register_config
|
||||
|
||||
register_config()
|
||||
except Exception as e:
|
||||
print(f"Failed to register omnivoice config: {e}")
|
||||
|
||||
cfg.load()
|
||||
|
||||
|
||||
def run_cli(args=None):
|
||||
from modules.omnivoice.cli import main as cli_main
|
||||
|
||||
return cli_main(args)
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
argv = argv or sys.argv[1:]
|
||||
|
||||
parser = argparse.ArgumentParser(prog="komAI")
|
||||
subparsers = parser.add_subparsers()
|
||||
|
||||
p_voice = subparsers.add_parser("voice", help="OmniVoice TTS")
|
||||
p_voice.add_argument("command", help="clone|design|auto")
|
||||
p_voice.add_argument("args", nargs=argparse.REMAINDER)
|
||||
|
||||
p_shell = subparsers.add_parser("shell", help="Interactive shell")
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
if hasattr(args, "command") and args.command:
|
||||
cmd_args = [args.command] + args.args
|
||||
return run_cli(cmd_args)
|
||||
|
||||
if args.command == "shell" or (not argv):
|
||||
init()
|
||||
print("komAI shell. Use Ctrl+C to exit.")
|
||||
try:
|
||||
import code
|
||||
|
||||
code.interact(local=locals())
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
return 0
|
||||
|
||||
parser.print_help()
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user