infrastructure

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package infrastructure adapts the themegen domain port onto OpenAI-compatible chat-completion APIs. Prompt construction grounds the model on the active edition's readable sources; response validation stays in the domain's envelope parser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRepairPrompt

func BuildRepairPrompt(brief themegendomain.Brief, themeFiles map[string]string, problems []string) string

BuildRepairPrompt feeds compiler/validation findings back to the model. The brief's style preset rides along so a repair does not drift from the requested look; theme files arrive verbatim (minification happens at install time) so braces and structure stay readable.

func BuildSystemPrompt

func BuildSystemPrompt(sources themegendomain.ThemeSources, templateOverrides bool) string

BuildSystemPrompt assembles the theme generation system prompt from the distilled contract, the edition's readable stylesheet sources, and — when the brief asks for template overrides — the template contract and page sources.

func BuildUserPrompt

func BuildUserPrompt(description, style string) string

BuildUserPrompt assembles the user prompt from the brief and style preset.

Types

type OpenAIThemeService

type OpenAIThemeService struct {
	// contains filtered or unexported fields
}

OpenAIThemeService implements themegendomain.ThemeGenerationService over any OpenAI-compatible chat-completion API.

func NewOpenAIThemeService

func NewOpenAIThemeService(apiKey, baseURL, model string) *OpenAIThemeService

NewOpenAIThemeService builds the OpenAI-compatible theme generation service. baseURL is optional ("" = provider default); model names the chat model. Sources and the template-override flag arrive per generation call.

func (*OpenAIThemeService) GenerateTheme

GenerateTheme asks the model for the JSON envelope and validates it via the domain parser. Files stay verbatim so validation and the repair loop see the model's original output; minification happens at install time. The system prompt is built per call so template overrides and their sources are honored.

func (*OpenAIThemeService) RepairTheme

RepairTheme feeds validation problems back to the model (the caller bounds the attempts). The system prompt matches the generation one, so template overrides keep their contract across repairs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL