mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-06-22 03:42:51 +08:00
- Implemented command-line flag registration and execution for plugins with priority-based conflict resolution. - Enabled plugin-owned command-line flag execution and persistence of plugin-auth data. - Added new `Host` methods to support command-line capabilities, including flag normalization, validation, and execution state management. - Introduced unit tests to ensure coverage for command-line plugin functionality, including auth data persistence. - Updated configs to normalize plugins during initialization.
13 lines
814 B
Go
13 lines
814 B
Go
package translator
|
|
|
|
import "context"
|
|
|
|
// PluginHooks defines optional translator extension hooks provided by plugins.
|
|
type PluginHooks interface {
|
|
NormalizeRequest(ctx context.Context, from, to Format, model string, body []byte, stream bool) []byte
|
|
TranslateRequest(ctx context.Context, from, to Format, model string, body []byte, stream bool) ([]byte, bool)
|
|
NormalizeResponseBefore(ctx context.Context, from, to Format, model string, originalRequestRawJSON, requestRawJSON, body []byte, stream bool) []byte
|
|
TranslateResponse(ctx context.Context, from, to Format, model string, originalRequestRawJSON, requestRawJSON, body []byte, stream bool) ([]byte, bool)
|
|
NormalizeResponseAfter(ctx context.Context, from, to Format, model string, originalRequestRawJSON, requestRawJSON, body []byte, stream bool) []byte
|
|
}
|