Google Grounded Search and Styling Fixes

This commit is contained in:
ajaysi
2025-04-02 22:44:16 +05:30
parent c40ce6ce4c
commit b4660d9d98
2 changed files with 51 additions and 82 deletions

View File

@@ -59,30 +59,9 @@ from lib.utils.ui_setup import setup_ui
from lib.utils.api_key_manager.api_key_manager import APIKeyManager, render
from lib.utils.api_key_manager.validation import check_all_api_keys
from dotenv import load_dotenv
from lib.utils.content_generators import blog_from_keyword, story_input_section, essay_writer, ai_news_writer, ai_finance_ta_writer, write_ai_prod_desc, do_web_research, competitor_analysis
from lib.utils.ui_setup import setup_ui, setup_alwrity_ui
def process_folder_for_rag(folder_path):
"""Placeholder for the process_folder_for_rag function."""
logger.info(f"Processing folder for RAG: {folder_path}")
st.write(f"This is a placeholder for processing the folder: {folder_path}")
def save_config(config):
"""
Saves the provided configuration dictionary to a JSON file specified by the environment variable.
"""
try:
logger.debug(f"Saving configuration to {os.getenv('ALWRITY_CONFIG')}")
with open(os.getenv("ALWRITY_CONFIG"), "w") as config_file:
json.dump(config, config_file, indent=4)
logger.info("Configuration saved successfully")
except Exception as e:
logger.error(f"Error saving configuration: {str(e)}", exc_info=True)
st.error(f"An error occurred while saving the configuration: {e}")
def main():
"""Main application entry point."""
# Initialize API key manager
@@ -221,52 +200,5 @@ def setup_environment_paths():
raise
# Functions for the main options
def ai_writers():
options = [
"AI Blog Writer",
"Story Writer",
"Essay writer",
"Write News reports",
"Write Financial TA report",
"AI Product Description Writer",
"AI Copywriter",
"Quit"
]
choice = st.selectbox("**👇Select a content creation type:**", options, index=0, format_func=lambda x: f"📝 {x}")
if choice == "AI Blog Writer":
blog_from_keyword()
elif choice == "Story Writer":
story_input_section()
elif choice == "Essay writer":
essay_writer()
elif choice == "Write News reports":
ai_news_writer()
elif choice == "Write Financial TA report":
ai_finance_ta_writer()
elif choice == "AI Product Description Writer":
write_ai_prod_desc()
elif choice == "Quit":
st.subheader("Exiting, Getting Lost. But.... I have nowhere to go 🥹🥹")
def alwrity_brain():
st.title("🧠 Alwrity Brain, Better than yours!")
st.write("Choose a folder to write content on. Alwrity will do RAG on these documents. The documents can of any type, pdf, pptx, docs, txt, cs etc. Video files and Audio files are also permitted.")
folder_path = st.text_input("**Enter folder path:**")
if st.button("**Process Folder**"):
if folder_path:
try:
process_folder_for_rag(folder_path)
st.success("Folder processed successfully!")
except Exception as e:
st.error(f"Error processing folder: {e}")
else:
st.warning("Please enter a valid folder path.")
if __name__ == "__main__":
main()

View File

@@ -39,30 +39,67 @@ def ai_writers():
def content_planning_tools():
st.markdown("""**Alwrity content Ideation & Planning** : Provide few keywords to do comprehensive web research.
Provide few keywords to get Google, Neural, pytrends analysis. Know keywords, blog titles to target.
Generate months long content calendar around given keywords.""")
# Add custom CSS for compact layout
st.markdown("""
<style>
/* Reduce top padding of main container */
.main .block-container {
padding-top: 0rem !important;
padding-bottom: 1rem !important;
}
/* Reduce spacing between elements */
.stTabs {
margin-top: 0.5rem !important;
}
/* Make markdown text more compact */
.element-container {
margin-bottom: 0.5rem !important;
}
/* Adjust subheader margins */
.stMarkdown h3 {
margin-top: 0 !important;
margin-bottom: 0.5rem !important;
}
</style>
""", unsafe_allow_html=True)
options = [
"Keywords Researcher",
"Competitor Analysis",
"Content Calender Ideator"
]
choice = st.radio("Select a content planning tool:", options, index=0, format_func=lambda x: f"🔍 {x}")
# Make description more compact using a smaller font
st.markdown("""
<div style='font-size: 0.9em; margin-bottom: 0.5rem;'>
<strong>Alwrity content Ideation & Planning</strong>: Provide few keywords to do comprehensive web research.
Provide few keywords to get Google, Neural, pytrends analysis. Know keywords, blog titles to target.
Generate months long content calendar around given keywords.
</div>
""", unsafe_allow_html=True)
if choice == "Keywords Researcher":
# Create tabs with reduced spacing
tab_keywords, tab_competitor, tab_calendar = st.tabs([
"🔍 Keywords Researcher",
"📊 Competitor Analysis",
"📅 Content Calendar Ideator"
])
# Keywords Researcher tab
with tab_keywords:
do_web_research()
elif choice == "Competitor Analysis":
# Competitor Analysis tab
with tab_competitor:
competitor_analysis()
elif choice == "Content Calender Ideator":
# Content Calendar Ideator tab
with tab_calendar:
plan_keywords = st.text_input(
"**Enter Your main Keywords to get 2 months content calendar:**",
placeholder="Enter 2-3 main keywords to generate AI content calendar with keyword researched blog titles",
help="The keywords are the ones where you would want to generate 50-60 blogs/articles on."
)
if st.button("**Ideate Content Calender**"):
if st.button("**Ideate Content Calendar**"):
if plan_keywords:
#ai_agents_content_planner(plan_keywords)
st.header("COming Soon.")
st.header("Coming Soon.")
else:
st.error("Come on, really, Enter some keywords to plan on..")