Remove log_transcript config and enforce JSON AI output
This commit is contained in:
parent
c3503fbbde
commit
1423e44008
8 changed files with 198 additions and 62 deletions
18
src/leld.py
18
src/leld.py
|
|
@ -71,7 +71,7 @@ class Daemon:
|
|||
cfg.stt.device,
|
||||
)
|
||||
self.ai_processor: LlamaProcessor | None = None
|
||||
self.log_transcript = cfg.logging.log_transcript or verbose
|
||||
self.log_transcript = verbose
|
||||
self.vocabulary = VocabularyEngine(cfg.vocabulary, cfg.domain_inference)
|
||||
self._stt_hint_kwargs_cache: dict[str, Any] | None = None
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ class Daemon:
|
|||
prev = self.state
|
||||
self.state = state
|
||||
if prev != state:
|
||||
logging.info("state: %s -> %s", prev, state)
|
||||
logging.debug("state: %s -> %s", prev, state)
|
||||
|
||||
def get_state(self):
|
||||
with self.lock:
|
||||
|
|
@ -118,7 +118,7 @@ class Daemon:
|
|||
self.record = record
|
||||
prev = self.state
|
||||
self.state = State.RECORDING
|
||||
logging.info("state: %s -> %s", prev, self.state)
|
||||
logging.debug("state: %s -> %s", prev, self.state)
|
||||
logging.info("recording started")
|
||||
if self.timer:
|
||||
self.timer.cancel()
|
||||
|
|
@ -145,10 +145,10 @@ class Daemon:
|
|||
self.record = None
|
||||
if self.timer:
|
||||
self.timer.cancel()
|
||||
self.timer = None
|
||||
self.timer = None
|
||||
prev = self.state
|
||||
self.state = State.STT
|
||||
logging.info("state: %s -> %s", prev, self.state)
|
||||
logging.debug("state: %s -> %s", prev, self.state)
|
||||
|
||||
if stream is None or record is None:
|
||||
logging.warning("recording resources are unavailable during stop")
|
||||
|
|
@ -189,7 +189,7 @@ class Daemon:
|
|||
return
|
||||
|
||||
if self.log_transcript:
|
||||
logging.info("stt: %s", text)
|
||||
logging.debug("stt: %s", text)
|
||||
else:
|
||||
logging.info("stt produced %d chars", len(text))
|
||||
|
||||
|
|
@ -214,7 +214,7 @@ class Daemon:
|
|||
text = self.vocabulary.apply_deterministic_replacements(text).strip()
|
||||
|
||||
if self.log_transcript:
|
||||
logging.info("processed: %s", text)
|
||||
logging.debug("processed: %s", text)
|
||||
else:
|
||||
logging.info("processed text length: %d", len(text))
|
||||
|
||||
|
|
@ -353,7 +353,7 @@ def main():
|
|||
|
||||
logging.basicConfig(
|
||||
stream=sys.stderr,
|
||||
level=logging.INFO,
|
||||
level=logging.DEBUG if args.verbose else logging.INFO,
|
||||
format="lel: %(asctime)s %(levelname)s %(message)s",
|
||||
)
|
||||
cfg = load(args.config)
|
||||
|
|
@ -366,8 +366,6 @@ def main():
|
|||
json.dumps(redacted_dict(cfg), indent=2),
|
||||
)
|
||||
|
||||
if args.verbose:
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
try:
|
||||
desktop = get_desktop_adapter()
|
||||
daemon = Daemon(cfg, desktop, verbose=args.verbose)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue