Skip to content

Commit a93b97f

Browse files
committed
Add a special header when generating titles
Signed-off-by: David Gageot <david.gageot@docker.com>
1 parent 6eb3ce3 commit a93b97f

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

pkg/model/provider/anthropic/client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ func NewClient(ctx context.Context, cfg *latest.ModelConfig, env environment.Pro
121121
httpclient.WithModel(cfg.Model),
122122
httpclient.WithQuery(url.Query()),
123123
}
124+
if globalOptions.GeneratingTitle() {
125+
httpOptions = append(httpOptions, httpclient.WithHeader("X-Cagent-GeneratingTitle", "1"))
126+
}
124127

125128
client := anthropic.NewClient(
126129
option.WithAuthToken(authToken),

pkg/model/provider/gemini/client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ func NewClient(ctx context.Context, cfg *latest.ModelConfig, env environment.Pro
9393
httpclient.WithModel(cfg.Model),
9494
httpclient.WithQuery(url.Query()),
9595
}
96+
if globalOptions.GeneratingTitle() {
97+
httpOptions = append(httpOptions, httpclient.WithHeader("X-Cagent-GeneratingTitle", "1"))
98+
}
9699

97100
return genai.NewClient(ctx, &genai.ClientConfig{
98101
APIKey: authToken,

pkg/model/provider/openai/client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ func NewClient(ctx context.Context, cfg *latest.ModelConfig, env environment.Pro
112112
httpclient.WithModel(cfg.Model),
113113
httpclient.WithQuery(url.Query()),
114114
}
115+
if globalOptions.GeneratingTitle() {
116+
httpOptions = append(httpOptions, httpclient.WithHeader("X-Cagent-GeneratingTitle", "1"))
117+
}
115118

116119
client := openai.NewClient(
117120
option.WithAPIKey(authToken),

0 commit comments

Comments
 (0)