|
| 1 | +import asyncio |
| 2 | +import os |
| 3 | +from argparse import ArgumentParser |
| 4 | +from pathlib import Path |
| 5 | + |
| 6 | +from dotenv import load_dotenv |
| 7 | + |
| 8 | +from src.mcp_client_pupper.main import main |
| 9 | +from src.mcp_client_pupper.puppy_voice_assistant import PuppyVoiceAssistant |
| 10 | + |
| 11 | +BASE_URL = "https://open-webui.dmhosted.duckdns.org" |
| 12 | +DEFAULT_MODEL = "gpt-oss:20b" |
| 13 | +ROSBRIDGE_ADDRESS = "ws://localhost:9090" |
| 14 | +DEFAULT_PUPPY_API_URL = "http://localhost:5080" |
| 15 | + |
| 16 | +if __name__ == "__main__": |
| 17 | + load_dotenv() |
| 18 | + parser = ArgumentParser() |
| 19 | + parser.add_argument( |
| 20 | + "--llm-base-url", |
| 21 | + type=str, |
| 22 | + help="Base URL to reach the LLM (without path)", |
| 23 | + default=os.getenv("OPENAI_BASE_URL", BASE_URL), |
| 24 | + ) |
| 25 | + parser.add_argument( |
| 26 | + "--llm-model", |
| 27 | + type=str, |
| 28 | + help="LLM model. To be chosen among the ones available at the specified `--llm-base-url`", |
| 29 | + default=os.getenv("OPENAI_MODEL", DEFAULT_MODEL), |
| 30 | + ) |
| 31 | + parser.add_argument( |
| 32 | + "--mcp-server-config", |
| 33 | + type=Path, |
| 34 | + help="Path to the MCP server configuration JSON file.", |
| 35 | + default=Path("./servers_config.json"), |
| 36 | + ) |
| 37 | + parser.add_argument( |
| 38 | + "--puppy-api-url", |
| 39 | + type=str, |
| 40 | + help="URL of the HTTP API for the Puppy State API", |
| 41 | + default=os.getenv("PUPPY_API_URL", DEFAULT_PUPPY_API_URL), |
| 42 | + ) |
| 43 | + parser.add_argument( |
| 44 | + "--input-device", |
| 45 | + type=int, |
| 46 | + default=1, |
| 47 | + help=f"Id of The input device (aka microphone)\navailable devices {PuppyVoiceAssistant.available_devices()}", |
| 48 | + ) |
| 49 | + parser.add_argument( |
| 50 | + "--whisper-model", |
| 51 | + default="small.en", |
| 52 | + type=str, |
| 53 | + help="Whisper.cpp model, default to %(default)s", |
| 54 | + ) |
| 55 | + parser.add_argument( |
| 56 | + "--silence-threshold", |
| 57 | + default=16, |
| 58 | + type=int, |
| 59 | + help="The duration of silence after which the inference will be running, defaults to %(default)s", |
| 60 | + ) |
| 61 | + parser.add_argument( |
| 62 | + "--block-duration", |
| 63 | + default=30, |
| 64 | + help="Minimum time audio updates in ms, default to %(default)s", |
| 65 | + ) |
| 66 | + parser.add_argument( # TODO: remove; it is only used in MCP Server |
| 67 | + "--rosbridge-address", |
| 68 | + type=str, |
| 69 | + help="Address of the websocket on which rosbridge is exposed. Format: 'ws://<address>:<port>'", |
| 70 | + default=os.getenv("ROSBRIDGE_ADDRESS", ROSBRIDGE_ADDRESS), |
| 71 | + ) |
| 72 | + args = parser.parse_args() |
| 73 | + |
| 74 | + asyncio.run(main(args)) |
0 commit comments