fix: raise explicit error when gh token is missing in CopilotClient
Replace the 'copilot' fallback string with a RuntimeError so users get a clear message instead of a cryptic auth failure from the API. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
6d53f33df0
commit
d6ef3c5d4d
|
|
@ -132,12 +132,16 @@ class CopilotClient(BaseLLMClient):
|
|||
def get_llm(self) -> Any:
|
||||
"""Return configured ChatOpenAI instance pointed at the Copilot API."""
|
||||
token = _get_github_token()
|
||||
if not token:
|
||||
raise RuntimeError(
|
||||
"No GitHub token found. Run `gh auth login` to authenticate."
|
||||
)
|
||||
copilot_url = _get_copilot_api_url()
|
||||
|
||||
llm_kwargs = {
|
||||
"model": self.model,
|
||||
"base_url": copilot_url,
|
||||
"api_key": token or "copilot",
|
||||
"api_key": token,
|
||||
"default_headers": dict(_COPILOT_HEADERS),
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue