mirror of
https://gh-proxy.org/https://github.com/klinsmaya/CLIProxyAPI.git
synced 2026-11-09 18:06:50 +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.
34 lines
1.7 KiB
Go
34 lines
1.7 KiB
Go
package translator
|
|
|
|
import "context"
|
|
|
|
// TranslateRequestByFormatName converts a request payload between schemas by their string identifiers.
|
|
func TranslateRequestByFormatName(from, to Format, model string, rawJSON []byte, stream bool) []byte {
|
|
return TranslateRequest(from, to, model, rawJSON, stream)
|
|
}
|
|
|
|
// HasRequestTransformerByFormatName reports whether a request translator exists between two schemas.
|
|
func HasRequestTransformerByFormatName(from, to Format) bool {
|
|
return HasRequestTransformer(from, to)
|
|
}
|
|
|
|
// HasResponseTransformerByFormatName reports whether a response translator exists between two schemas.
|
|
func HasResponseTransformerByFormatName(from, to Format) bool {
|
|
return HasResponseTransformer(from, to)
|
|
}
|
|
|
|
// TranslateStreamByFormatName converts streaming responses between schemas by their string identifiers.
|
|
func TranslateStreamByFormatName(ctx context.Context, from, to Format, model string, originalRequestRawJSON, requestRawJSON, rawJSON []byte, param *any) [][]byte {
|
|
return TranslateStream(ctx, from, to, model, originalRequestRawJSON, requestRawJSON, rawJSON, param)
|
|
}
|
|
|
|
// TranslateNonStreamByFormatName converts non-streaming responses between schemas by their string identifiers.
|
|
func TranslateNonStreamByFormatName(ctx context.Context, from, to Format, model string, originalRequestRawJSON, requestRawJSON, rawJSON []byte, param *any) []byte {
|
|
return TranslateNonStream(ctx, from, to, model, originalRequestRawJSON, requestRawJSON, rawJSON, param)
|
|
}
|
|
|
|
// TranslateTokenCountByFormatName converts token counts between schemas by their string identifiers.
|
|
func TranslateTokenCountByFormatName(ctx context.Context, from, to Format, count int64, rawJSON []byte) []byte {
|
|
return TranslateTokenCount(ctx, from, to, count, rawJSON)
|
|
}
|