Preserve cache control in rendered prompts

This commit is contained in:
2026-07-02 23:03:50 +00:00
parent 0badb4364d
commit c95d6fcfec
8 changed files with 286 additions and 4 deletions

View File

@@ -428,6 +428,14 @@ func hashRenderedPrompt(p domain.RenderedPrompt) string {
b.WriteString(msg.Role)
b.WriteByte('\n')
b.WriteString(msg.Content)
if msg.CacheControl != nil {
b.WriteString("\ncache_control.type=")
b.WriteString(string(msg.CacheControl.Type))
if msg.CacheControl.TTL != "" {
b.WriteString("\ncache_control.ttl=")
b.WriteString(msg.CacheControl.TTL)
}
}
b.WriteString("\n---\n")
}
h := sha256.Sum256([]byte(b.String()))