blogai

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const POST_RECORD_TYPE = "blogai_post"
View Source
const POST_STATUS_APPROVED = "approved"
View Source
const POST_STATUS_DRAFT = "draft"
View Source
const POST_STATUS_PENDING = "pending"
View Source
const POST_STATUS_PUBLISHED = "published"
View Source
const POST_STATUS_REJECTED = "rejected"

Variables

This section is empty.

Functions

This section is empty.

Types

type BlogWriterAgent

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

BlogWriterAgent is responsible for generating blog post content.

func NewBlogWriterAgent

func NewBlogWriterAgent(logger *slog.Logger) *BlogWriterAgent

NewBlogWriterAgent creates a new instance of the BlogWriterAgent.

func (*BlogWriterAgent) GenerateImage

func (b *BlogWriterAgent) GenerateImage(ai llm.LlmInterface, title string, summary string) (string, error)

GenerateImage generates an image for the blog post using the title and summary

func (*BlogWriterAgent) GenerateMetas

func (b *BlogWriterAgent) GenerateMetas(ai llm.LlmInterface, post RecordPost) (metaTitle, metaDesc, metaKeywords string, err error)

GenerateMetas generates meta title, meta description, and keywords for the given blog post.

func (*BlogWriterAgent) GenerateSummary

func (b *BlogWriterAgent) GenerateSummary(ai llm.LlmInterface, post RecordPost) (string, error)

GenerateSummary generates a summary for the given blog post.

func (*BlogWriterAgent) RegenerateParagraph

func (b *BlogWriterAgent) RegenerateParagraph(ai llm.LlmInterface, post RecordPost, sectionType string, sectionIndex, paragraphIndex int) (string, error)

RegenerateParagraph regenerates a single paragraph in the post based on full context.

func (*BlogWriterAgent) RegenerateSection

func (b *BlogWriterAgent) RegenerateSection(ai llm.LlmInterface, post RecordPost, section string) (RecordPost, error)

RegenerateSection regenerates a specific section of the blog post

Business logic: 1. Validate input 2. Prepare prompt 3. Generate new section content 4. Update post 5. Return updated post

func (*BlogWriterAgent) WriteBlogPost

func (b *BlogWriterAgent) WriteBlogPost(ai llm.LlmInterface, title string) (RecordPost, error)

WriteBlogPost takes a title and generates a detailed blog post.

type PostContentConclusion

type PostContentConclusion struct {
	Title      string   `json:"title"`
	Paragraphs []string `json:"paragraphs"`
}

type PostContentIntroduction

type PostContentIntroduction struct {
	Title      string   `json:"title"`
	Paragraphs []string `json:"paragraphs"`
}

type PostContentSection

type PostContentSection struct {
	Title      string   `json:"title"`
	Paragraphs []string `json:"paragraphs"`
}

type RecordPost

type RecordPost struct {
	ID              string                  `json:"id,omitempty" validate:"omitempty"` // Unique identifier for the post
	Title           string                  `json:"title" validate:"required"`         // Title of the blog post
	Status          string                  `json:"status,omitempty"`                  // Status of the post (e.g., draft, published)
	Subtitle        string                  `json:"subtitle,omitempty"`                // Subtitle of the blog post
	Summary         string                  `json:"summary,omitempty"`                 // Brief summary of the post
	Introduction    PostContentIntroduction `json:"introduction"`                      // Introduction section of the post
	Sections        []PostContentSection    `json:"sections"`                          // Main content sections of the post
	Conclusion      PostContentConclusion   `json:"conclusion"`                        // Conclusion section of the post
	Keywords        []string                `json:"keywords,omitempty"`                // Keywords related to the post
	CreatedAt       string                  `json:"created_at,omitempty"`              // Timestamp when the post was created
	UpdatedAt       string                  `json:"updated_at,omitempty"`              // Timestamp when the post was last updated
	MetaDescription string                  `json:"meta_description,omitempty"`        // Meta description for SEO
	MetaKeywords    []string                `json:"meta_keywords,omitempty"`           // Meta keywords for SEO
	MetaTitle       string                  `json:"meta_title,omitempty"`              // Meta title for SEO
	Image           string                  `json:"image,omitempty"`                   // Generated image URL/path
}

func NewRecordPostFromCustomRecord

func NewRecordPostFromCustomRecord(record customstore.RecordInterface) (RecordPost, error)

func (RecordPost) ToJSON

func (r RecordPost) ToJSON() string

ToJSON converts the RecordPost to a JSON string

type TitleGeneratorAgent

type TitleGeneratorAgent struct{}

func NewTitleGeneratorAgent

func NewTitleGeneratorAgent() *TitleGeneratorAgent

func (*TitleGeneratorAgent) GenerateTitles

func (t *TitleGeneratorAgent) GenerateTitles(ai llm.LlmInterface, topic string, existingTitles []string) ([]string, error)

GenerateTitles generates 10-15 optimized titles for the given topic.

Jump to

Keyboard shortcuts

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