Documentation
¶
Index ¶
- Constants
- type BlogWriterAgent
- func (b *BlogWriterAgent) GenerateImage(ai llm.LlmInterface, title string, summary string) (string, error)
- func (b *BlogWriterAgent) GenerateMetas(ai llm.LlmInterface, post RecordPost) (metaTitle, metaDesc, metaKeywords string, err error)
- func (b *BlogWriterAgent) GenerateSummary(ai llm.LlmInterface, post RecordPost) (string, error)
- func (b *BlogWriterAgent) RegenerateParagraph(ai llm.LlmInterface, post RecordPost, sectionType string, ...) (string, error)
- func (b *BlogWriterAgent) RegenerateSection(ai llm.LlmInterface, post RecordPost, section string) (RecordPost, error)
- func (b *BlogWriterAgent) WriteBlogPost(ai llm.LlmInterface, title string) (RecordPost, error)
- type PostContentConclusion
- type PostContentIntroduction
- type PostContentSection
- type RecordPost
- type TitleGeneratorAgent
Constants ¶
const POST_RECORD_TYPE = "blogai_post"
const POST_STATUS_APPROVED = "approved"
const POST_STATUS_DRAFT = "draft"
const POST_STATUS_PENDING = "pending"
const POST_STATUS_PUBLISHED = "published"
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 PostContentIntroduction ¶
type PostContentSection ¶
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.