Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 53c3316

Browse files
committed
Remove the is_copilot flag in favor of using the autodetected client
In the copilot provider, we can hardcode the client type to copilot when instantiating the pipelines. Related: #830
1 parent 1ac7e45 commit 53c3316

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/codegate/pipeline/base.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ async def process_request(
350350
api_key: Optional[str] = None,
351351
api_base: Optional[str] = None,
352352
extra_headers: Optional[Dict[str, str]] = None,
353-
is_copilot: bool = False,
354353
) -> PipelineResult:
355354
"""Process a request through all pipeline steps"""
356355
self.context.metadata["extra_headers"] = extra_headers
@@ -362,7 +361,9 @@ async def process_request(
362361
self.context.sensitive.api_base = api_base
363362

364363
# For Copilot provider=openai. Use a flag to not clash with other places that may use that.
365-
provider_db = "copilot" if is_copilot else provider
364+
provider_db = provider
365+
if self.context.client == ClientType.COPILOT:
366+
provider_db = "copilot"
366367

367368
for step in self.pipeline_steps:
368369
result = await step.process(current_request, self.context)
@@ -419,9 +420,13 @@ async def process_request(
419420
api_key: Optional[str] = None,
420421
api_base: Optional[str] = None,
421422
extra_headers: Optional[Dict[str, str]] = None,
422-
is_copilot: bool = False,
423423
) -> PipelineResult:
424424
"""Create a new pipeline instance and process the request"""
425425
return await self.instance.process_request(
426-
request, provider, model, api_key, api_base, extra_headers, is_copilot
426+
request,
427+
provider,
428+
model,
429+
api_key,
430+
api_base,
431+
extra_headers,
427432
)

src/codegate/providers/copilot/pipeline.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ async def process_body(
114114
api_key=headers_dict.get("authorization", "").replace("Bearer ", ""),
115115
api_base="https://" + headers_dict.get("host", ""),
116116
extra_headers=CopilotPipeline._get_copilot_headers(headers_dict),
117-
is_copilot=True,
118117
)
119118
except Exception as e:
120119
logger.error(f"Pipeline processing error: {e}")

0 commit comments

Comments
 (0)