Files
2026-07-13 12:35:43 +08:00

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
}