import streamlit as st from lib.utils.alwrity_utils import (essay_writer, ai_news_writer, ai_finance_ta_writer) from lib.ai_writers.ai_story_writer.story_writer import story_input_section from lib.ai_writers.ai_product_description_writer import write_ai_prod_desc from lib.ai_writers.ai_copywriter.copywriter_dashboard import copywriter_dashboard from lib.ai_writers.linkedin_writer import LinkedInAIWriter from lib.ai_writers.blog_rewriter_updater.ai_blog_rewriter import write_blog_rewriter from lib.ai_writers.ai_blog_faqs_writer.faqs_ui import main as faqs_generator from lib.ai_writers.ai_blog_writer.ai_blog_generator import ai_blog_writer_page from lib.ai_writers.ai_outline_writer.outline_ui import main as outline_generator from loguru import logger def list_ai_writers(): """Return a list of available AI writers with their metadata (no UI rendering).""" return [ { "name": "AI Blog Writer", "icon": "📝", "description": "Generate comprehensive blog posts from keywords, URLs, or uploaded content", "category": "Content Creation", "function": ai_blog_writer_page, "path": "ai_blog_writer" }, { "name": "AI Blog Rewriter", "icon": "🔄", "description": "Rewrite and update existing blog content with improved quality and SEO optimization", "category": "Content Creation", "function": write_blog_rewriter, "path": "blog_rewriter" }, { "name": "Story Writer", "icon": "📚", "description": "Create engaging stories and narratives with AI assistance", "category": "Creative Writing", "function": story_input_section, "path": "story_writer" }, { "name": "Essay writer", "icon": "✍️", "description": "Generate well-structured essays on any topic", "category": "Academic", "function": essay_writer, "path": "essay_writer" }, { "name": "Write News reports", "icon": "📰", "description": "Create professional news articles and reports", "category": "Journalism", "function": ai_news_writer, "path": "news_writer" }, { "name": "Write Financial TA report", "icon": "📊", "description": "Generate technical analysis reports for financial markets", "category": "Finance", "function": ai_finance_ta_writer, "path": "financial_writer" }, { "name": "AI Product Description Writer", "icon": "🛍️", "description": "Create compelling product descriptions that drive sales", "category": "E-commerce", "function": write_ai_prod_desc, "path": "product_writer" }, { "name": "AI Copywriter", "icon": "✒️", "description": "Generate persuasive copy for marketing and advertising", "category": "Marketing", "function": copywriter_dashboard, "path": "copywriter" }, { "name": "LinkedIn AI Writer", "icon": "💼", "description": "Create professional LinkedIn content that engages your network", "category": "Professional", "function": lambda: LinkedInAIWriter().run(), "path": "linkedin_writer" }, { "name": "FAQ Generator", "icon": "❓", "description": "Generate comprehensive, well-researched FAQs from any content source with customizable options", "category": "Content Creation", "function": faqs_generator, "path": "faqs_generator" }, { "name": "Blog Outline Generator", "icon": "📋", "description": "Create detailed blog outlines with AI-powered content generation and image integration", "category": "Content Creation", "function": outline_generator, "path": "outline_generator" } ] def get_ai_writers(): """Render the AI Writers dashboard UI with a professional, clickable card layout.""" logger.info("Initializing AI Writers Dashboard") writers = list_ai_writers() logger.info(f"Found {len(writers)} AI writers") # Add custom CSS for a professional dashboard with VIBRANT clickable cards st.markdown(""" """, unsafe_allow_html=True) # Dashboard header st.markdown("""

🚀 AI Content Creation Suite

Welcome! Select the perfect AI writer tool from the options below to start creating amazing content.

""", unsafe_allow_html=True) # Create columns for the grid layout cols = st.columns(3) # Render buttons styled as cards for each writer for idx, writer in enumerate(writers): with cols[idx % 3]: # Prepare the button label using simple Markdown with newlines button_label = f"{writer['icon']}\n**{writer['name']}**\n{writer['description']}" if st.button( button_label, key=f"writer_{writer['path']}", help=f"Click to use the {writer['name']}", # More specific help text use_container_width=True, ): logger.info(f"Selected writer: {writer['name']} with path: {writer['path']}") st.session_state.selected_writer = writer st.query_params["writer"] = writer['path'] logger.info(f"Updated query params with writer: {writer['path']}") st.rerun() logger.info("Finished rendering AI Writers Dashboard") # Return writers list, though it's not strictly needed if only rendering UI return writers # Remove the old ai_writers function since it's now integrated into get_ai_writers