28 lines
1.0 KiB
Go
28 lines
1.0 KiB
Go
package proposal_generation
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"gitea.maximumdirect.net/eric/audita/v3/internal/core/schema"
|
|
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/promptcontext"
|
|
)
|
|
|
|
// 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) {
|
|
glossaryJSON, err := json.MarshalIndent(glossary, "", " ")
|
|
if err != nil {
|
|
return nil, fmt.Errorf("marshal glossary prompt context: %w", err)
|
|
}
|
|
sectionJSON, err := promptcontext.MarshalTranscriptSectionJSON(transcript, sectionIndex)
|
|
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),
|
|
}, nil
|
|
}
|