Files

28 lines
1.0 KiB
Go
Raw Permalink Normal View History

package proposal_generation
2026-05-12 11:20:02 +00:00
import (
"encoding/json"
"fmt"
2026-10-11 01:40:38 +00:00
"gitea.maximumdirect.net/eric/audita/v3/internal/core/schema"
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/promptcontext"
2026-05-12 11:20:02 +00:00
)
// BuildProposalVariables preserves the domain inputs while PromptKit renders
// the selected embedded proposal definition.
func BuildProposalVariables(transcript *schema.Transcript, glossary *schema.Glossary, sectionIndex int, transcriptDescription string) (map[string]string, error) {
2026-05-12 11:20:02 +00:00
glossaryJSON, err := json.MarshalIndent(glossary, "", " ")
if err != nil {
return nil, fmt.Errorf("marshal glossary prompt context: %w", err)
}
sectionJSON, err := promptcontext.MarshalTranscriptSectionJSON(transcript, sectionIndex)
2026-05-12 11:20:02 +00:00
if err != nil {
return nil, fmt.Errorf("marshal transcript prompt context: %w", err)
}
return map[string]string{
"TranscriptDescriptionBlock": promptcontext.TranscriptDescriptionBlock(transcriptDescription),
"GlossaryJSON": string(glossaryJSON),
"SectionJSON": string(sectionJSON),
2026-05-12 11:20:02 +00:00
}, nil
}