import os import logging from typing import Optional NAME = 'Chelsea_documentation.txt' TEMPLATE = """ Documentation. A complete list of commands that are designed to facilitate the use of the voice assistant (Chelsea). The complete list consists of no more than 100 commands written in a txt file. The list of commands will be updated as the assistant is developed. The first version of the programme (Arctic Monkeys) contains a total of 5 commands. They are divided into categories: finance, main, agents, RAG. The list of commands and their use. Command documentation: the user downloads a text file that describes the commands in detail. The information on how to use the very first and main command will be announced during the first use. The following list of voice commands in English is available for calling the command: "Download commands", "download commands", "load commands", "boot commands", "install commands", "commands", "load", "boot", "download", "install". In Ukrainian: "Завантаж команди", "Скачай команди", "Загрузи команди", "Завантаж", "Скачай", "Загрузи", "команди". """ def generate_doc(path: Optional[str] = None) -> Optional[str]: if path is not None: file = os.path.join(path, NAME) else: current_dir = os.path.dirname(os.path.realpath(__file__)) file = os.path.join(current_dir, NAME) logging.info(file) try: with open(file, 'w') as f: f.write(TEMPLATE) return file except IOError as e: logging.error(e)