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