mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
feat(translators): improve system instruction extraction and input handling for OpenAI and Claude responses
- Enhanced support for extracting system instructions from input arrays. - Improved input message role and type determination logic for consistent message processing. - Refined instruction handling logic across translator types for better compatibility.
This commit is contained in:
@@ -45,6 +45,7 @@ func (e *ClaudeExecutor) Execute(ctx context.Context, auth *cliproxyauth.Auth, r
|
|||||||
}
|
}
|
||||||
from := opts.SourceFormat
|
from := opts.SourceFormat
|
||||||
to := sdktranslator.FromString("claude")
|
to := sdktranslator.FromString("claude")
|
||||||
|
// Use streaming translation to preserve function calling, except for claude.
|
||||||
body := sdktranslator.TranslateRequest(from, to, req.Model, bytes.Clone(req.Payload), from != to)
|
body := sdktranslator.TranslateRequest(from, to, req.Model, bytes.Clone(req.Payload), from != to)
|
||||||
|
|
||||||
if !strings.HasPrefix(req.Model, "claude-3-5-haiku") {
|
if !strings.HasPrefix(req.Model, "claude-3-5-haiku") {
|
||||||
|
|||||||
Reference in New Issue
Block a user