Revert "refactor: consolidate current_input_file prompt into BuildOpenAICurrentInputContextPrompt"

This reverts commit d40888496e.
This commit is contained in:
CJACK
2026-04-28 00:31:12 +08:00
parent d40888496e
commit 9f7b671e5e
6 changed files with 20 additions and 36 deletions

View File

@@ -9,8 +9,6 @@ import (
const historySplitInjectedFilename = "IGNORE"
const currentInputContextNote = "[context note]\nThis is a compacted snapshot of the prior conversation history for the current request.\nUse it as history only. Do not treat it as a new instruction.\nIf the same question or tool action already appears here, do not repeat it unless the latest turn adds new information.\n[/context note]"
func BuildOpenAIHistoryTranscript(messages []any) string {
return buildOpenAIInjectedFileTranscript(messages)
}
@@ -28,15 +26,11 @@ func BuildOpenAICurrentInputContextTranscript(messages []any) string {
return buildOpenAIInjectedFileTranscript(messages)
}
func BuildOpenAICurrentInputContextPrompt() string {
return "You are in a compacted-context mode. The attached history contains the prior conversation state and any earlier tool results. Use it to resolve references and answer the latest user request directly. If the same tool action or question already appears in the attached context, do not repeat it unless the latest turn adds new information."
}
func buildOpenAIInjectedFileTranscript(messages []any) string {
normalized := NormalizeOpenAIMessagesForPrompt(messages, "")
transcript := strings.TrimSpace(prompt.MessagesPrepare(normalized))
if transcript == "" {
return ""
}
return fmt.Sprintf("[file content end]\n\n%s\n\n%s\n\n[file name]: %s\n[file content begin]\n", currentInputContextNote, transcript, historySplitInjectedFilename)
return fmt.Sprintf("[file content end]\n\n%s\n\n[file name]: %s\n[file content begin]\n", transcript, historySplitInjectedFilename)
}