context-ai / tools /customer_profile_app.py
chinmayjha's picture
feat: optimize RAG agent with token reduction and separate context/sources
a697e1b unverified
#!/usr/bin/env python3
"""
Customer Profile Analysis Dashboard App.
This app provides a Gradio UI for viewing and searching customer profile analyses
from the customer_profile_analyses MongoDB collection.
"""
import click
from second_brain_online.application.ui.customer_profile_ui import CustomerProfileUI
@click.command()
@click.option(
"--host",
type=str,
default="127.0.0.1",
help="Host to run the server on",
)
@click.option(
"--port",
type=int,
default=7860,
help="Port to run the server on",
)
@click.option(
"--share",
is_flag=True,
default=False,
help="Create a public link for the interface",
)
@click.option(
"--debug",
is_flag=True,
default=False,
help="Enable debug mode",
)
def main(host: str, port: int, share: bool, debug: bool) -> None:
"""Launch the Customer Profile Analysis Dashboard.
This dashboard allows you to:
- View all customer profile analyses in a searchable table
- Search by company name, customer ID, key changes, recommendations, or email content
- View detailed analysis for each customer
- See statistics about the analyses
Args:
host: Host to run the server on
port: Port to run the server on
share: Create a public link for the interface
debug: Enable debug mode
"""
print("πŸš€ Starting Customer Profile Analysis Dashboard...")
print(f"πŸ“ Server will be available at: http://{host}:{port}")
if share:
print("🌐 Creating public link...")
if debug:
print("πŸ› Debug mode enabled")
try:
# Initialize the UI
ui = CustomerProfileUI()
# Launch the interface
ui.launch(
server_name=host,
server_port=port,
share=share,
debug=debug,
show_error=True,
quiet=False
)
except Exception as e:
print(f"❌ Failed to start the dashboard: {e}")
raise
if __name__ == "__main__":
main()