mirror of
https://github.com/router-for-me/CLIProxyAPIPlus.git
synced 2026-04-26 22:35:51 +00:00
Merge pull request #110 from PancakeZik/fix/system-prompt-reinjection
fix: prevent system prompt re-injection on subsequent turns
This commit is contained in:
@@ -240,9 +240,13 @@ func BuildKiroPayload(claudeBody []byte, modelID, profileArn, origin string, isA
|
|||||||
// Process messages and build history
|
// Process messages and build history
|
||||||
history, currentUserMsg, currentToolResults := processMessages(messages, modelID, origin)
|
history, currentUserMsg, currentToolResults := processMessages(messages, modelID, origin)
|
||||||
|
|
||||||
// Build content with system prompt
|
// Build content with system prompt (only on first turn to avoid re-injection)
|
||||||
if currentUserMsg != nil {
|
if currentUserMsg != nil {
|
||||||
currentUserMsg.Content = buildFinalContent(currentUserMsg.Content, systemPrompt, currentToolResults)
|
effectiveSystemPrompt := systemPrompt
|
||||||
|
if len(history) > 0 {
|
||||||
|
effectiveSystemPrompt = "" // Don't re-inject on subsequent turns
|
||||||
|
}
|
||||||
|
currentUserMsg.Content = buildFinalContent(currentUserMsg.Content, effectiveSystemPrompt, currentToolResults)
|
||||||
|
|
||||||
// Deduplicate currentToolResults
|
// Deduplicate currentToolResults
|
||||||
currentToolResults = deduplicateToolResults(currentToolResults)
|
currentToolResults = deduplicateToolResults(currentToolResults)
|
||||||
|
|||||||
Reference in New Issue
Block a user