From c8029b7166a7027644b3ee2b852a03eb150e0f03 Mon Sep 17 00:00:00 2001 From: hkfires <10558748+hkfires@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:50:35 +0800 Subject: [PATCH] feat(iflow): Add User-Agent header to API requests --- internal/runtime/executor/iflow_executor.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/runtime/executor/iflow_executor.go b/internal/runtime/executor/iflow_executor.go index 36aa3515..7768fd84 100644 --- a/internal/runtime/executor/iflow_executor.go +++ b/internal/runtime/executor/iflow_executor.go @@ -20,7 +20,10 @@ import ( "github.com/tidwall/sjson" ) -const iflowDefaultEndpoint = "/chat/completions" +const ( + iflowDefaultEndpoint = "/chat/completions" + iflowUserAgent = "iFlow-Cli" +) // IFlowExecutor executes OpenAI-compatible chat completions against the iFlow API using API keys derived from OAuth. type IFlowExecutor struct { @@ -215,6 +218,7 @@ func (e *IFlowExecutor) Refresh(ctx context.Context, auth *cliproxyauth.Auth) (* func applyIFlowHeaders(r *http.Request, apiKey string, stream bool) { r.Header.Set("Content-Type", "application/json") r.Header.Set("Authorization", "Bearer "+apiKey) + r.Header.Set("User-Agent", iflowUserAgent) if stream { r.Header.Set("Accept", "text/event-stream") } else {