This repository has been archived on 2024-10-27. You can view files and clone it, but cannot push or open issues or pull requests.
2023-10-27 19:19:22 -06:00
|
|
|
from llm_server.cluster.cluster_config import cluster_config
|
|
|
|
from llm_server.custom_redis import redis
|
2023-08-22 20:28:41 -06:00
|
|
|
|
|
|
|
|
2023-10-27 19:19:22 -06:00
|
|
|
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)
|
2023-08-22 20:28:41 -06:00
|
|
|
return f"""```
|
2023-09-23 23:14:22 -06:00
|
|
|
=== MESSAGE FROM LLM MIDDLEWARE AT {http_host} ===
|
2023-10-27 19:19:22 -06:00
|
|
|
-> {error_type.upper()} <-
|
2023-08-22 20:28:41 -06:00
|
|
|
{msg}
|
2023-10-27 19:19:22 -06:00
|
|
|
```
|
|
|
|
```
|
|
|
|
BACKEND: {cluster_backend_hash}
|
2023-08-22 20:28:41 -06:00
|
|
|
```"""
|