File size: 2,060 Bytes
a697e1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/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()