(systemPrompt, userMsg, assistantMsg string)
| 750 | } |
| 751 | |
| 752 | func computeSessionHash(systemPrompt, userMsg, assistantMsg string) string { |
| 753 | h := fnv.New64a() |
| 754 | if systemPrompt != "" { |
| 755 | h.Write([]byte("sys:" + systemPrompt + "\n")) |
| 756 | } |
| 757 | if userMsg != "" { |
| 758 | h.Write([]byte("usr:" + userMsg + "\n")) |
| 759 | } |
| 760 | if assistantMsg != "" { |
| 761 | h.Write([]byte("ast:" + assistantMsg + "\n")) |
| 762 | } |
| 763 | return fmt.Sprintf("msg:%016x", h.Sum64()) |
| 764 | } |
| 765 | |
| 766 | func truncateString(s string, maxLen int) string { |
| 767 | if len(s) > maxLen { |
no test coverage detected