diff --git a/src/api/routes/sops.py b/src/api/routes/sops.py index 78bd6df..811bd35 100644 --- a/src/api/routes/sops.py +++ b/src/api/routes/sops.py @@ -312,11 +312,9 @@ def generate_executive_goals_from_doc(): if 'document' not in request.files: return jsonify({"error": "No file part", "message": "Please upload a file with the key 'document'."}), 400 - if 'departments' not in request.form: - return jsonify({"error": "department missing", "message": "Please provide departments'."}), 400 - + try: - departments = request.form.get('departments') + departments = request.form.get('departments','[]') # Manually load roles from the string to JSON departments = json.loads(departments) @@ -457,10 +455,9 @@ def generate_vision_goals_quest(): sop_generator = SopGeneratorExecutive() vision_mission = sop_generator.generate_vision_mission_from_questionnaire(questionnaire_data) - vission = vision_mission.get('vision') - mission = vision_mission.get('mission') + data = vision_mission.get('response') - return jsonify({"mission": mission, "vission": vission, "message": "vision and mission generated successfully"}), 200 + return jsonify({"data": data, "message": "vision and mission generated successfully"}), 200 except Exception as e: return make_response(jsonify({"error": "Processing error", "message": f"An error occurred while processing the request: {str(e)}"}), 500) diff --git a/src/models/sop_response_schemas.py b/src/models/sop_response_schemas.py index 739a34f..1e033a6 100644 --- a/src/models/sop_response_schemas.py +++ b/src/models/sop_response_schemas.py @@ -35,9 +35,13 @@ class DeptMisiion(BaseModel): departments: str goals: List[str] +class VisionMissionResponse3(BaseModel): + mission: List[str] + vision: List[str] + class VisionMissionResponse2(BaseModel): response: List[str] - + class VisionMissionResponse(BaseModel): vision: List[str] diff --git a/src/prompts/sops.py b/src/prompts/sops.py index 976e15b..7820dfd 100644 --- a/src/prompts/sops.py +++ b/src/prompts/sops.py @@ -155,6 +155,7 @@ def get_vision_mission_extraction_from_doc2(): NOTE: MAKE SURE YOU EXTRACT EVERY INFORMATION FOUND FOR VISION AND GOALS FROM THE DOCUMENT.DO NOT OMIT ANY **You must return the response in the exact HTML `

` format shown below, including the numbering, lettered sub-points, `
` tags for line breaks, and the double `

` between departments. Adhere to this format precisely.** +NOTE: IF NO departments are provided, consider all departments found in the documents, do not omit any **Example Output Format:**

Vision: To be the best in the world

Company Goals:

1. Sales
a. Brand Awareness: To be the best in the world
b. Revenue Growth: Increase annual sales by 20% through strategic partnerships and lead generation.

2. Marketing
a. Digital Presence: Enhance online visibility through SEO and social media campaigns.
b. Customer Engagement: Boost engagement via personalized content and email marketing.

3. Product Development
a. Innovation: Launch 3 new features based on user feedback by Q4.
b. Quality Assurance: Maintain product bug rate under 2% through improved testing pipelines.

4. Human Resources
a. Talent Acquisition: Recruit top talent and reduce time-to-hire to under 30 days.
b. Employee Retention: Increase employee retention by 15% through career development program.

""" @@ -195,6 +196,8 @@ def get_vision_mission_extraction_from_questionnaire_executive(): NOTE: If the goal and mission of a can not be gotten from the questionaire response, make it empty. NOTE: Ensure you extract every piece of information found for the vision and goals from the questionnaire. DO NOT OMIT ANYTHING. + **Example Output Format:** +

Vision: To be the best in the world

Company Goals:

1. Sales
a. Brand Awareness: To be the best in the world
b. Revenue Growth: Increase annual sales by 20% through strategic partnerships and lead generation.

2. Marketing
a. Digital Presence: Enhance online visibility through SEO and social media campaigns.
b. Customer Engagement: Boost engagement via personalized content and email marketing.

3. Product Development
a. Innovation: Launch 3 new features based on user feedback by Q4.
b. Quality Assurance: Maintain product bug rate under 2% through improved testing pipelines.

4. Human Resources
a. Talent Acquisition: Recruit top talent and reduce time-to-hire to under 30 days.
b. Employee Retention: Increase employee retention by 15% through career development program.

""" diff --git a/src/services/sop_document_parser.py b/src/services/sop_document_parser.py index f13a75c..661e78e 100644 --- a/src/services/sop_document_parser.py +++ b/src/services/sop_document_parser.py @@ -117,7 +117,7 @@ class DocumentParser: }, { "role": "user", - "content": f"Department to consider for the company goals generation{departments}" + "content": f"Department to consider for the company goals generation: {departments}" }, { "role": "user", diff --git a/uploads/document.pdf b/uploads/document.pdf new file mode 100644 index 0000000..feccf3d Binary files /dev/null and b/uploads/document.pdf differ