-
Notifications
You must be signed in to change notification settings - Fork 2
fix: layer 2 — unify internal and pkg/llmproxy config types #408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| root = "." | ||
| testdata_dir = "testdata" | ||
| tmp_dir = ".air" | ||
|
|
||
| [build] | ||
| args_bin = [] | ||
| bin = "./cliproxyapi++" | ||
| cmd = "go build -o ./cliproxyapi++ ./cmd/server" | ||
| delay = 1000 | ||
| exclude_dir = ["assets", "tmp", "vendor", "testdata", "node_modules", ".git", "docs/node_modules", ".air"] | ||
| exclude_file = [] | ||
| exclude_regex = ["_test.go", "_test_ts.go"] | ||
| exclude_unchanged = false | ||
| follow_symlink = false | ||
| full_bin = "" | ||
| include_dir = ["pkg/llmproxy", "cmd/server", "internal", "sdk"] | ||
| include_ext = ["go"] | ||
| include_file = [] | ||
| kill_delay = "0s" | ||
| log = "build-errors.log" | ||
| poll = false | ||
| poll_interval = 0 | ||
| rerun = false | ||
| rerun_delay = 500 | ||
| send_interrupt = false | ||
| stop_on_error = false | ||
|
|
||
| [color] | ||
| app = "" | ||
| build = "yellow" | ||
| main = "magenta" | ||
| runner = "green" | ||
| watcher = "cyan" | ||
|
|
||
| [log] | ||
| main_only = false | ||
| time = false | ||
|
|
||
| [misc] | ||
| clean_on_exit = true | ||
|
|
||
| [screen] | ||
| clear_on_rebuild = false | ||
| keep_scroll = true | ||
|
|
||
| [watcher] | ||
| watch_exts = ["go", "yaml", "yml", "json", "toml"] | ||
| ignore_paths = [".git", "node_modules", "vendor", "tmp", ".air"] | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Package config provides configuration types for CLI Proxy API. | ||
| // This file contains SDK-specific config types that are used by internal/* packages. | ||
| package config | ||
|
|
||
| // SDKConfig represents the SDK-level configuration embedded in Config. | ||
| type SDKConfig struct { | ||
| // ProxyURL is the URL of an optional proxy server to use for outbound requests. | ||
| ProxyURL string `yaml:"proxy-url" json:"proxy-url"` | ||
|
|
||
| // ForceModelPrefix requires explicit model prefixes (e.g., "teamA/gemini-3-pro-preview") | ||
| // to target prefixed credentials. When false, unprefixed model requests may use prefixed | ||
| // credentials as well. | ||
| ForceModelPrefix bool `yaml:"force-model-prefix" json:"force-model-prefix"` | ||
|
|
||
| // RequestLog enables or disables detailed request logging functionality. | ||
| RequestLog bool `yaml:"request-log" json:"request-log"` | ||
|
|
||
| // APIKeys is a list of keys for authenticating clients to this proxy server. | ||
| APIKeys []string `yaml:"api-keys" json:"api-keys"` | ||
|
|
||
| // PassthroughHeaders controls whether upstream response headers are forwarded to downstream clients. | ||
| // Default is false (disabled). | ||
| PassthroughHeaders bool `yaml:"passthrough-headers" json:"passthrough-headers"` | ||
|
|
||
| // Streaming configures server-side streaming behavior (keep-alives and safe bootstrap retries). | ||
| Streaming StreamingConfig `yaml:"streaming" json:"streaming"` | ||
|
|
||
| // NonStreamKeepAliveInterval controls how often blank lines are emitted for non-streaming responses. | ||
| // <= 0 disables keep-alives. Value is in seconds. | ||
| NonStreamKeepAliveInterval int `yaml:"nonstream-keepalive-interval,omitempty" json:"nonstream-keepalive-interval,omitempty"` | ||
| } | ||
|
Comment on lines
+6
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While moving these struct definitions here from the To complete this refactoring correctly and avoid future maintenance issues, the definitions in Here is a suggested implementation for // in internal/config/sdk_config.go
package config
import (
pkgconfig "github.com/router-for-me/CLIProxyAPI/v6/pkg/llmproxy/config"
)
// SDKConfig is an alias to pkg/llmproxy/config.SDKConfig.
type SDKConfig = pkgconfig.SDKConfig
// StreamingConfig is an alias to pkg/llmproxy/config.StreamingConfig.
type StreamingConfig = pkgconfig.StreamingConfig |
||
|
|
||
| // StreamingConfig holds server streaming behavior configuration. | ||
| type StreamingConfig struct { | ||
| // KeepAliveSeconds controls how often the server emits SSE heartbeats (": keep-alive\n\n"). | ||
| // <= 0 disables keep-alives. Default is 0. | ||
| KeepAliveSeconds int `yaml:"keepalive-seconds,omitempty" json:"keepalive-seconds,omitempty"` | ||
|
|
||
| // BootstrapRetries controls how many times the server may retry a streaming request before any bytes are sent, | ||
| // to allow auth rotation / transient recovery. | ||
| // <= 0 disables bootstrap retries. Default is 0. | ||
| BootstrapRetries int `yaml:"bootstrap-retries,omitempty" json:"bootstrap-retries,omitempty"` | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The paths listed in
ignore_pathsare already included inexclude_diron line 10. According to theairtool's documentation,exclude_diris sufficient for excluding directories from being watched, which makes thisignore_pathsentry redundant. You can safely remove this line to simplify the configuration.