Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -72,32 +72,20 @@ def fetch_company_info(company_url): 
     | 
|
| 72 | 
         
             
            def structure_email(user_data, linkedin_info, company_info):
         
     | 
| 73 | 
         
             
                # Sanitize and extract the required information
         
     | 
| 74 | 
         
             
                linkedin_role = sanitize_data(linkedin_info.get('current_role', user_data['role']))
         
     | 
| 75 | 
         
            -
                linkedin_skills = sanitize_data(linkedin_info.get('skills', 'relevant skills'))
         
     | 
| 76 | 
         
             
                linkedin_industry = sanitize_data(linkedin_info.get('industry', 'the industry'))
         
     | 
| 77 | 
         
             
                company_name = sanitize_data(user_data['company_url'] or company_info.get('company_name', 'the company'))
         
     | 
| 78 | 
         
             
                company_mission = sanitize_data(company_info.get('mission', f"{company_name}'s mission"))
         
     | 
| 79 | 
         
             
                company_goal = sanitize_data(company_info.get('goal', 'achieving excellence'))
         
     | 
| 80 | 
         | 
| 81 | 
         
            -
                #  
     | 
| 82 | 
         
             
                email_body = f"Dear Hiring Manager,\n\n"
         
     | 
| 83 | 
         
            -
             
     | 
| 84 | 
         
            -
                # Introduction and relevance
         
     | 
| 85 | 
         
             
                email_body += f"I am writing to express my interest in the {sanitize_data(user_data['role'])} position at {company_name}. "
         
     | 
| 86 | 
         
            -
                 
     | 
| 87 | 
         
            -
             
     | 
| 88 | 
         
            -
                
         
     | 
| 89 | 
         
            -
                 
     | 
| 90 | 
         
            -
                 
     | 
| 91 | 
         
            -
                    email_body += f"As a {linkedin_role}, I have honed my skills in {linkedin_skills}. These experiences make me confident that I can contribute effectively to your team. "
         
     | 
| 92 | 
         
            -
                else:
         
     | 
| 93 | 
         
            -
                    email_body += f"My experience in {linkedin_skills} equips me with the skills necessary to excel in this role. "
         
     | 
| 94 | 
         
            -
                
         
     | 
| 95 | 
         
            -
                # Contribution and impact section
         
     | 
| 96 | 
         
            -
                if company_goal:
         
     | 
| 97 | 
         
            -
                    email_body += f"I am excited about the opportunity to bring my expertise to {company_name} and support your team in achieving {company_goal}. "
         
     | 
| 98 | 
         
            -
             
     | 
| 99 | 
         
            -
                # Call to action
         
     | 
| 100 | 
         
            -
                email_body += f"I would welcome the chance to discuss how my background and skills align with the needs of your organization. "
         
     | 
| 101 | 
         
             
                email_body += "Thank you for your time and consideration. I look forward to the possibility of contributing to your team.\n\n"
         
     | 
| 102 | 
         
             
                email_body += f"Best regards,\n{sanitize_data(user_data['name'])}"
         
     | 
| 103 | 
         | 
| 
         @@ -158,8 +146,7 @@ class Agent: 
     | 
|
| 158 | 
         
             
                        user_data = self.user_data['user_data']
         
     | 
| 159 | 
         
             
                        linkedin_info = self.user_data['linkedin_info']
         
     | 
| 160 | 
         
             
                        company_info = self.user_data['company_info']
         
     | 
| 161 | 
         
            -
                         
     | 
| 162 | 
         
            -
                        email_content = generate_email_content(OPENAI_API_KEY, prompt)
         
     | 
| 163 | 
         
             
                        return email_content
         
     | 
| 164 | 
         | 
| 165 | 
         
             
            # Simulated Swarm class to manage agents
         
     | 
| 
         | 
|
| 72 | 
         
             
            def structure_email(user_data, linkedin_info, company_info):
         
     | 
| 73 | 
         
             
                # Sanitize and extract the required information
         
     | 
| 74 | 
         
             
                linkedin_role = sanitize_data(linkedin_info.get('current_role', user_data['role']))
         
     | 
| 75 | 
         
            +
                linkedin_skills = sanitize_data(linkedin_info.get('skills', 'various relevant skills'))
         
     | 
| 76 | 
         
             
                linkedin_industry = sanitize_data(linkedin_info.get('industry', 'the industry'))
         
     | 
| 77 | 
         
             
                company_name = sanitize_data(user_data['company_url'] or company_info.get('company_name', 'the company'))
         
     | 
| 78 | 
         
             
                company_mission = sanitize_data(company_info.get('mission', f"{company_name}'s mission"))
         
     | 
| 79 | 
         
             
                company_goal = sanitize_data(company_info.get('goal', 'achieving excellence'))
         
     | 
| 80 | 
         | 
| 81 | 
         
            +
                # Build the email directly with the available and sanitized information
         
     | 
| 82 | 
         
             
                email_body = f"Dear Hiring Manager,\n\n"
         
     | 
| 
         | 
|
| 
         | 
|
| 83 | 
         
             
                email_body += f"I am writing to express my interest in the {sanitize_data(user_data['role'])} position at {company_name}. "
         
     | 
| 84 | 
         
            +
                email_body += f"I am particularly drawn to {company_name}'s mission to {company_mission}, which aligns with my passion and expertise in {linkedin_industry}. "
         
     | 
| 85 | 
         
            +
                email_body += f"As a {linkedin_role}, I have developed skills in {linkedin_skills}, which I believe are highly relevant to the requirements of this role.\n\n"
         
     | 
| 86 | 
         
            +
                email_body += f"I am confident that my background and expertise in {linkedin_skills} can contribute to achieving {company_goal}. "
         
     | 
| 87 | 
         
            +
                email_body += f"My experience in similar roles has prepared me to make an immediate and meaningful impact on your team, and I am excited about the opportunity to bring my expertise to {company_name}.\n\n"
         
     | 
| 88 | 
         
            +
                email_body += f"I would appreciate the opportunity to discuss how my background and skills align with the needs of your organization. "
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 89 | 
         
             
                email_body += "Thank you for your time and consideration. I look forward to the possibility of contributing to your team.\n\n"
         
     | 
| 90 | 
         
             
                email_body += f"Best regards,\n{sanitize_data(user_data['name'])}"
         
     | 
| 91 | 
         | 
| 
         | 
|
| 146 | 
         
             
                        user_data = self.user_data['user_data']
         
     | 
| 147 | 
         
             
                        linkedin_info = self.user_data['linkedin_info']
         
     | 
| 148 | 
         
             
                        company_info = self.user_data['company_info']
         
     | 
| 149 | 
         
            +
                        email_content = structure_email(user_data, linkedin_info, company_info)
         
     | 
| 
         | 
|
| 150 | 
         
             
                        return email_content
         
     | 
| 151 | 
         | 
| 152 | 
         
             
            # Simulated Swarm class to manage agents
         
     |