from llm_server.cluster.cluster_config import cluster_config from llm_server.custom_redis import redis def format_sillytavern_err(msg: str, backend_url: str = None, error_type: str = 'info'): if backend_url: cluster_backend_hash = cluster_config.get_backend(backend_url)['hash'] else: cluster_backend_hash = 'none' http_host = redis.get('http_host', dtype=str) return f"""``` === MESSAGE FROM LLM MIDDLEWARE AT {http_host} === -> {error_type.upper()} <- {msg} ``` ``` BACKEND: {cluster_backend_hash} ```"""