2026-09-24 02:03:08 +00:00
|
|
|
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
|
|
|
)
|
|
|
|
|
|
2026-09-24 02:03:08 +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)
|
|
|
|
|
}
|
2026-05-23 17:56:07 +00:00
|
|
|
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)
|
|
|
|
|
}
|
2026-09-24 02:03:08 +00:00
|
|
|
return map[string]string{
|
2026-05-13 18:49:06 +00:00
|
|
|
"TranscriptDescriptionBlock": promptcontext.TranscriptDescriptionBlock(transcriptDescription),
|
|
|
|
|
"GlossaryJSON": string(glossaryJSON),
|
|
|
|
|
"SectionJSON": string(sectionJSON),
|
2026-05-12 11:20:02 +00:00
|
|
|
}, nil
|
|
|
|
|
}
|