feat: add vector / dagu server
parent
0584f8e88e
commit
2fb462d514
|
|
@ -3,19 +3,29 @@ from components import monaco
|
|||
from utils.service_info import ServiceInfo
|
||||
|
||||
SERVICES = [
|
||||
ServiceInfo(label="server", url="http://localhost:5000"),
|
||||
ServiceInfo(label="triton", url="http://triton:8002/metrics"),
|
||||
ServiceInfo(label="triton", health_url="http://triton:8002/metrics"),
|
||||
ServiceInfo(label="vector", health_url="http://localhost:8686/health"),
|
||||
ServiceInfo(
|
||||
label="dagu", health_url="http://localhost:8080", url="http://localhost:8080"
|
||||
),
|
||||
ServiceInfo(
|
||||
label="server", health_url="http://localhost:5000", url="http://localhost:5000"
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
def make_badge_markdown(x: ServiceInfo):
|
||||
return f""
|
||||
badge = f""
|
||||
if x.url:
|
||||
return f"[{badge}]({x.url})"
|
||||
else:
|
||||
return badge
|
||||
|
||||
|
||||
st.set_page_config(page_title="Tabby Admin - Home")
|
||||
|
||||
st.markdown("## Tabby")
|
||||
st.markdown(" ".join(map(make_badge_markdown, SERVICES)))
|
||||
st.markdown(" $~$ ".join(map(make_badge_markdown, SERVICES)))
|
||||
st.markdown("---")
|
||||
|
||||
SNIPPETS = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
import requests
|
||||
from requests.exceptions import ConnectionError
|
||||
|
|
@ -7,12 +8,13 @@ from requests.exceptions import ConnectionError
|
|||
@dataclass
|
||||
class ServiceInfo:
|
||||
label: str
|
||||
url: str
|
||||
health_url: str
|
||||
url: Optional[str] = None
|
||||
|
||||
@property
|
||||
def is_health(self) -> bool:
|
||||
try:
|
||||
return requests.get(self.url).status_code == 200
|
||||
return requests.get(self.health_url).status_code == 200
|
||||
except ConnectionError:
|
||||
return False
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue