()
| 18 | config.read('config.ini') |
| 19 | |
| 20 | async def main(): |
| 21 | pretty_print("Initializing...", color="status") |
| 22 | stealth_mode = config.getboolean('BROWSER', 'stealth_mode') |
| 23 | personality_folder = "jarvis" if config.getboolean('MAIN', 'jarvis_personality') else "base" |
| 24 | languages = config["MAIN"]["languages"].split(' ') |
| 25 | |
| 26 | provider = Provider(provider_name=config["MAIN"]["provider_name"], |
| 27 | model=config["MAIN"]["provider_model"], |
| 28 | server_address=config["MAIN"]["provider_server_address"], |
| 29 | is_local=config.getboolean('MAIN', 'is_local')) |
| 30 | |
| 31 | browser = Browser( |
| 32 | create_driver(headless=config.getboolean('BROWSER', 'headless_browser'), stealth_mode=stealth_mode, lang=languages[0]), |
| 33 | anticaptcha_manual_install=stealth_mode |
| 34 | ) |
| 35 | |
| 36 | agents = [ |
| 37 | CasualAgent(name=config["MAIN"]["agent_name"], |
| 38 | prompt_path=f"prompts/{personality_folder}/casual_agent.txt", |
| 39 | provider=provider, verbose=False), |
| 40 | CoderAgent(name="coder", |
| 41 | prompt_path=f"prompts/{personality_folder}/coder_agent.txt", |
| 42 | provider=provider, verbose=False), |
| 43 | FileAgent(name="File Agent", |
| 44 | prompt_path=f"prompts/{personality_folder}/file_agent.txt", |
| 45 | provider=provider, verbose=False), |
| 46 | BrowserAgent(name="Browser", |
| 47 | prompt_path=f"prompts/{personality_folder}/browser_agent.txt", |
| 48 | provider=provider, verbose=False, browser=browser), |
| 49 | PlannerAgent(name="Planner", |
| 50 | prompt_path=f"prompts/{personality_folder}/planner_agent.txt", |
| 51 | provider=provider, verbose=False, browser=browser), |
| 52 | #McpAgent(name="MCP Agent", |
| 53 | # prompt_path=f"prompts/{personality_folder}/mcp_agent.txt", |
| 54 | # provider=provider, verbose=False), # NOTE under development |
| 55 | ] |
| 56 | |
| 57 | interaction = Interaction(agents, |
| 58 | tts_enabled=config.getboolean('MAIN', 'speak'), |
| 59 | stt_enabled=config.getboolean('MAIN', 'listen'), |
| 60 | recover_last_session=config.getboolean('MAIN', 'recover_last_session'), |
| 61 | langs=languages |
| 62 | ) |
| 63 | try: |
| 64 | while interaction.is_active: |
| 65 | interaction.get_user() |
| 66 | if await interaction.think(): |
| 67 | interaction.show_answer() |
| 68 | interaction.speak_answer() |
| 69 | except Exception as e: |
| 70 | if config.getboolean('MAIN', 'save_session'): |
| 71 | interaction.save_session() |
| 72 | raise e |
| 73 | finally: |
| 74 | if config.getboolean('MAIN', 'save_session'): |
| 75 | interaction.save_session() |
| 76 | |
| 77 | if __name__ == "__main__": |
no test coverage detected