mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-11-16 22:57:53 +08:00
- Handle apply_patch custom tool call streaming deltas and snapshots for Responses API translation - Track and resolve step indexes, function call identities, and error states across stream events - Propagate apply_patch tool input errors and upstream failure states in stream and non-stream responses
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package auth
|
|
|
|
import "testing"
|
|
|
|
type patchSupportExecutor struct {
|
|
*replaceAwareExecutor
|
|
supported bool
|
|
}
|
|
|
|
func (e *patchSupportExecutor) SupportsApplyPatch() bool { return e.supported }
|
|
|
|
func TestApplyPatchManagerAllCandidates(t *testing.T) {
|
|
m := NewManager(nil, nil, nil)
|
|
m.RegisterExecutor(&patchSupportExecutor{&replaceAwareExecutor{id: "custom-name"}, true})
|
|
m.RegisterExecutor(&patchSupportExecutor{&replaceAwareExecutor{id: "denied"}, false})
|
|
m.RegisterExecutor(&replaceAwareExecutor{id: "codex"})
|
|
for _, tc := range []struct {
|
|
providers []string
|
|
want bool
|
|
}{
|
|
{nil, false}, {[]string{"unknown"}, false}, {[]string{"codex"}, false},
|
|
{[]string{"custom-name"}, true}, {[]string{"custom-name", "custom-name"}, true},
|
|
{[]string{"custom-name", "denied"}, false}, {[]string{"custom-name", "unknown"}, false},
|
|
{[]string{"custom-name", "codex"}, false},
|
|
} {
|
|
if got := m.SupportsApplyPatchForProviders(tc.providers); got != tc.want {
|
|
t.Errorf("providers %v: got %v, want %v", tc.providers, got, tc.want)
|
|
}
|
|
}
|
|
var absent *Manager
|
|
if absent.SupportsApplyPatchForProviders([]string{"custom-name"}) {
|
|
t.Fatal("nil manager has capability")
|
|
}
|
|
}
|