Skip to content

Commit 4a27b3b

Browse files
Fix to_url
1 parent 59648f3 commit 4a27b3b

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/seclab_taskflow_agent/capi.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ def to_url(self):
1919
Convert the endpoint to its full URL.
2020
"""
2121
match self:
22-
case self.AI_API_GITHUBCOPILOT:
22+
case AI_API_ENDPOINT_ENUM.AI_API_GITHUBCOPILOT:
2323
return f"https://{self}"
24-
case self.AI_API_MODELS_GITHUB:
24+
case AI_API_ENDPOINT_ENUM.AI_API_MODELS_GITHUB:
2525
return f"https://{self}/inference"
26-
case _:
27-
raise ValueError(f"Unsupported Model Endpoint: {self}")
2826

2927
COPILOT_INTEGRATION_ID = 'vscode-chat'
3028

@@ -62,7 +60,8 @@ def list_capi_models(token: str) -> dict[str, dict]:
6260
case AI_API_ENDPOINT_ENUM.AI_API_MODELS_GITHUB:
6361
models_catalog = 'catalog/models'
6462
case _:
65-
raise ValueError(f"Unsupported Model Endpoint: {api_endpoint}")
63+
raise ValueError(f"Unsupported Model Endpoint: {api_endpoint}\n"
64+
f"Supported endpoints: {[e.to_url() for e in AI_API_ENDPOINT_ENUM]}")
6665
r = httpx.get(httpx.URL(api_endpoint).join(models_catalog),
6766
headers={
6867
'Accept': 'application/json',
@@ -76,9 +75,6 @@ def list_capi_models(token: str) -> dict[str, dict]:
7675
models_list = r.json().get('data', [])
7776
case AI_API_ENDPOINT_ENUM.AI_API_MODELS_GITHUB:
7877
models_list = r.json()
79-
case _:
80-
raise ValueError(f"Unsupported Model Endpoint: {api_endpoint}\n"
81-
f"Supported endpoints: {[e.to_url() for e in AI_API_ENDPOINT_ENUM]}")
8278
for model in models_list:
8379
models[model.get('id')] = dict(model)
8480
except httpx.RequestError as e:

0 commit comments

Comments
 (0)