CrossRelay stage 2: Codex /v1/responses relay, config.toml manager, Codex page
This commit is contained in:
1 parent
404704171d
commit
5112f7ca06
30 files changed
+3539
-72
No files matched your search
@@ -21,6 +21,7 @@ var All = []Preset{
|
||||
Sonnet: "deepseek-chat",
|
||||
Haiku: "deepseek-chat",
|
||||
Opus: "deepseek-chat",
|
||||
Extra: codexModelExtras("deepseek-chat"),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -31,6 +32,7 @@ var All = []Preset{
|
||||
Sonnet: "kimi-k2-0905-preview",
|
||||
Haiku: "kimi-k2-0905-preview",
|
||||
Opus: "kimi-k2-0905-preview",
|
||||
Extra: codexModelExtras("kimi-k2-0905-preview"),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -41,10 +43,22 @@ var All = []Preset{
|
||||
Sonnet: "glm-4.6",
|
||||
Haiku: "glm-4.6",
|
||||
Opus: "glm-4.6",
|
||||
Extra: codexModelExtras("glm-4.6"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// codexModelExtras maps the model names Codex CLI asks for onto one
|
||||
// upstream model, so activating a preset for Codex works without manual
|
||||
// mapping.
|
||||
func codexModelExtras(upstream string) map[string]string {
|
||||
return map[string]string{
|
||||
"gpt-5-codex": upstream,
|
||||
"gpt-5": upstream,
|
||||
"codex-mini-latest": upstream,
|
||||
}
|
||||
}
|
||||
|
||||
// ByKey looks up a preset by its key.
|
||||
func ByKey(key string) (Preset, bool) {
|
||||
for _, p := range All {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package presets
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestPresetsCarryCodexModelExtras(t *testing.T) {
|
||||
for _, p := range All {
|
||||
for _, name := range []string{"gpt-5-codex", "gpt-5", "codex-mini-latest"} {
|
||||
got, ok := p.Models.Extra[name]
|
||||
if !ok {
|
||||
t.Errorf("preset %q has no extra mapping for %q", p.Key, name)
|
||||
continue
|
||||
}
|
||||
if got != p.Models.Default {
|
||||
t.Errorf("preset %q maps %q to %q, want %q", p.Key, name, got, p.Models.Default)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestByKey(t *testing.T) {
|
||||
if _, ok := ByKey("deepseek"); !ok {
|
||||
t.Error("deepseek preset missing")
|
||||
}
|
||||
if _, ok := ByKey("nope"); ok {
|
||||
t.Error("unknown preset resolved")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user