mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-08 10:25:28 +08:00
20 lines
489 B
Go
20 lines
489 B
Go
package promptcompat
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"ds2api/internal/prompt"
|
|
)
|
|
|
|
const historySplitInjectedFilename = "IGNORE"
|
|
|
|
func BuildOpenAIHistoryTranscript(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[file name]: %s\n[file content begin]\n", transcript, historySplitInjectedFilename)
|
|
}
|