mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-11-17 07:08:01 +08:00
- Add `client.claude.show-codex-commentary` config and propagate the request-scoped display policy through HTTP and WebSocket Codex executors. - Mirror public Codex `commentary` messages into visible Claude text blocks alongside the `cpa:commentary:v1` thinking marker in streaming and non-streaming responses without altering genuine reasoning or token accounting. - Deduplicate only the exact adjacent mirrored commentary text block during Claude-to-Codex request replay when enabled. Closes: #7129
19 lines
639 B
Go
19 lines
639 B
Go
package helps
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/router-for-me/CLIProxyAPI/v8/internal/config"
|
|
translatorcommon "github.com/router-for-me/CLIProxyAPI/v8/internal/translator/common"
|
|
)
|
|
|
|
// WithCodexCommentaryPolicy keeps an in-flight stream's policy stable across
|
|
// config reloads. It changes protocol display/replay only, not the payload rules.
|
|
func WithCodexCommentaryPolicy(ctx context.Context, cfg *config.Config) context.Context {
|
|
enabled := translatorcommon.VisibleCodexCommentary(ctx)
|
|
if cfg != nil && cfg.Client.Claude.ShowCodexCommentary {
|
|
enabled = true
|
|
}
|
|
return translatorcommon.WithVisibleCodexCommentary(ctx, enabled)
|
|
}
|