diff --git a/python/signal_bot/commands/inventory.py b/python/signal_bot/commands/inventory.py index f0ca9b3..9d78074 100644 --- a/python/signal_bot/commands/inventory.py +++ b/python/signal_bot/commands/inventory.py @@ -92,6 +92,7 @@ def handle_inventory_update( Uses the LLM to extract structured items, then pushes to the van_inventory API. """ try: + logger.info(f"Processing inventory update from {message.source}") if message.attachments: image_data = signal.get_attachment(message.attachments[0]) raw_response = llm.chat_with_image( @@ -110,8 +111,12 @@ def handle_inventory_update( signal.reply(message, "Send a photo of a receipt or a text list of items to update inventory.") return InventoryUpdate() + logger.info(f"{raw_response=}") + new_items = parse_llm_response(raw_response) + logger.info(f"{new_items=}") + for item in new_items: _upsert_item(api_url, item) diff --git a/python/signal_bot/main.py b/python/signal_bot/main.py index ecb7f19..c4db567 100644 --- a/python/signal_bot/main.py +++ b/python/signal_bot/main.py @@ -113,7 +113,7 @@ def dispatch( "status": status_action, "inventory": inventory_action, } - + logger.info(f"f{source=} running {cmd=} with {message=}") action = commands.get(cmd) if action is None: if message.attachments: @@ -184,7 +184,10 @@ def run_loop( raise -def main(log_level: Annotated[str, typer.Option()] = "INFO") -> None: +def main( + log_level: Annotated[str, typer.Option()] = "INFO", + llm_timeout: Annotated[int, typer.Option()] = 600, +) -> None: """Run the Signal command and control bot.""" configure_logger(log_level) signal_api_url = getenv("SIGNAL_API_URL") @@ -218,7 +221,7 @@ def main(log_level: Annotated[str, typer.Option()] = "INFO") -> None: with ( SignalClient(config.signal_api_url, config.phone_number) as signal, - LLMClient(model=llm_model, host=llm_host, port=llm_port) as llm, + LLMClient(model=llm_model, host=llm_host, port=llm_port, timeout=llm_timeout) as llm, ): registry = DeviceRegistry(signal, engine) run_loop(config, signal, llm, registry)