shinnmen / internal /runtime /executor /codex_websockets_executor.go
shinmentakezo07
refactor(executor): split providers and preserve legacy entrypoints
3e5ab39
Raw
History Blame Contribute Delete
3.68 kB
package executor
import (
"context"
"net/http"
"github.com/router-for-me/CLIProxyAPI/v6/internal/config"
cliproxyauth "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy/auth"
cliproxyexecutor "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy/executor"
)
// CodexWebsocketsExecutor is a compatibility wrapper delegating to CodexWebsocketsExecutorRefactored.
type CodexWebsocketsExecutor struct {
ref *CodexWebsocketsExecutorRefactored
}
func NewCodexWebsocketsExecutor(cfg *config.Config) *CodexWebsocketsExecutor {
return &CodexWebsocketsExecutor{ref: NewCodexWebsocketsExecutorRefactored(cfg)}
}
func (e *CodexWebsocketsExecutor) Identifier() string { return e.ref.Identifier() }
func (e *CodexWebsocketsExecutor) PrepareRequest(req *http.Request, auth *cliproxyauth.Auth) error {
return e.ref.PrepareRequest(req, auth)
}
func (e *CodexWebsocketsExecutor) HttpRequest(ctx context.Context, auth *cliproxyauth.Auth, req *http.Request) (*http.Response, error) {
return e.ref.HttpRequest(ctx, auth, req)
}
func (e *CodexWebsocketsExecutor) Execute(ctx context.Context, auth *cliproxyauth.Auth, req cliproxyexecutor.Request, opts cliproxyexecutor.Options) (cliproxyexecutor.Response, error) {
return e.ref.Execute(ctx, auth, req, opts)
}
func (e *CodexWebsocketsExecutor) ExecuteStream(ctx context.Context, auth *cliproxyauth.Auth, req cliproxyexecutor.Request, opts cliproxyexecutor.Options) (*cliproxyexecutor.StreamResult, error) {
return e.ref.ExecuteStream(ctx, auth, req, opts)
}
func (e *CodexWebsocketsExecutor) Refresh(ctx context.Context, auth *cliproxyauth.Auth) (*cliproxyauth.Auth, error) {
return e.ref.Refresh(ctx, auth)
}
func (e *CodexWebsocketsExecutor) CountTokens(ctx context.Context, auth *cliproxyauth.Auth, req cliproxyexecutor.Request, opts cliproxyexecutor.Options) (cliproxyexecutor.Response, error) {
return e.ref.CountTokens(ctx, auth, req, opts)
}
func (e *CodexWebsocketsExecutor) CloseExecutionSession(sessionID string) {
e.ref.CloseExecutionSession(sessionID)
}
// CodexAutoExecutor is a compatibility wrapper delegating to CodexAutoExecutorRefactored.
type CodexAutoExecutor struct {
ref *CodexAutoExecutorRefactored
}
func NewCodexAutoExecutor(cfg *config.Config) *CodexAutoExecutor {
return &CodexAutoExecutor{ref: NewCodexAutoExecutorRefactored(cfg)}
}
func (e *CodexAutoExecutor) Identifier() string { return e.ref.Identifier() }
func (e *CodexAutoExecutor) PrepareRequest(req *http.Request, auth *cliproxyauth.Auth) error {
return e.ref.PrepareRequest(req, auth)
}
func (e *CodexAutoExecutor) HttpRequest(ctx context.Context, auth *cliproxyauth.Auth, req *http.Request) (*http.Response, error) {
return e.ref.HttpRequest(ctx, auth, req)
}
func (e *CodexAutoExecutor) Execute(ctx context.Context, auth *cliproxyauth.Auth, req cliproxyexecutor.Request, opts cliproxyexecutor.Options) (cliproxyexecutor.Response, error) {
return e.ref.Execute(ctx, auth, req, opts)
}
func (e *CodexAutoExecutor) ExecuteStream(ctx context.Context, auth *cliproxyauth.Auth, req cliproxyexecutor.Request, opts cliproxyexecutor.Options) (*cliproxyexecutor.StreamResult, error) {
return e.ref.ExecuteStream(ctx, auth, req, opts)
}
func (e *CodexAutoExecutor) Refresh(ctx context.Context, auth *cliproxyauth.Auth) (*cliproxyauth.Auth, error) {
return e.ref.Refresh(ctx, auth)
}
func (e *CodexAutoExecutor) CountTokens(ctx context.Context, auth *cliproxyauth.Auth, req cliproxyexecutor.Request, opts cliproxyexecutor.Options) (cliproxyexecutor.Response, error) {
return e.ref.CountTokens(ctx, auth, req, opts)
}
func (e *CodexAutoExecutor) CloseExecutionSession(sessionID string) {
e.ref.CloseExecutionSession(sessionID)
}