devZenaight commited on
Commit
200fdbb
·
1 Parent(s): 60c3dfc

Revert "Merge branch 'live-test-branch'"

Browse files

This reverts commit de52477bfc9f3121d85779f4f1de36a78b3cdd85, reversing
changes made to 72de3893fd6c9c5eacb293c669abce67722d7773.

Files changed (5) hide show
  1. .gitignore +8 -0
  2. app/constants.py +73 -0
  3. app/models.py +54 -0
  4. app/utils.py +28 -0
  5. maintest.txt +0 -0
.gitignore CHANGED
@@ -343,3 +343,11 @@ htmlcov/
343
  # Hugging Face specific
344
  .cache/
345
  transformers_cache/
 
 
 
 
 
 
 
 
 
343
  # Hugging Face specific
344
  .cache/
345
  transformers_cache/
346
+
347
+ # Test and preview files (exclude from deployment)
348
+ live_pdf_example.html
349
+ bp _template.txt
350
+ maintest.txt
351
+ LIVE_PDF_README.md
352
+ JIRA_WORK_SUMMARY.md
353
+
app/constants.py CHANGED
@@ -1,3 +1,4 @@
 
1
  # Constants and Configuration
2
  # Contains constants and configuration values to avoid circular imports
3
 
@@ -38,4 +39,76 @@ SECTION_COLUMNS = [
38
  "operationsPlan",
39
  "managementTeam",
40
  "financialPlanFunding",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  ]
 
1
+ <<<<<<< Updated upstream
2
  # Constants and Configuration
3
  # Contains constants and configuration values to avoid circular imports
4
 
 
39
  "operationsPlan",
40
  "managementTeam",
41
  "financialPlanFunding",
42
+ =======
43
+ # Constants Module
44
+ # Contains application constants and configuration
45
+
46
+ # Section order for business plans
47
+ SECTION_ORDER = [
48
+ "Executive Summary",
49
+ "Company Profile",
50
+ "Market Analysis",
51
+ "Products & Services",
52
+ "Marketing Strategy",
53
+ "Operations Plan",
54
+ "Management Team",
55
+ "Financial Plan & Funding",
56
+ "Risk Analysis",
57
+ "Appendix"
58
+ ]
59
+
60
+ # Section mapping for different business types
61
+ SECTION_MAP = {
62
+ "Executive Summary": {
63
+ "key": "executive_summary",
64
+ "description": "Overview of the business plan"
65
+ },
66
+ "Company Profile": {
67
+ "key": "company_profile",
68
+ "description": "Company information and background"
69
+ },
70
+ "Market Analysis": {
71
+ "key": "market_analysis",
72
+ "description": "Market research and analysis"
73
+ },
74
+ "Products & Services": {
75
+ "key": "products_services",
76
+ "description": "Product and service offerings"
77
+ },
78
+ "Marketing Strategy": {
79
+ "key": "marketing_strategy",
80
+ "description": "Marketing and sales strategy"
81
+ },
82
+ "Operations Plan": {
83
+ "key": "operations_plan",
84
+ "description": "Operational procedures and processes"
85
+ },
86
+ "Management Team": {
87
+ "key": "management_team",
88
+ "description": "Management and organizational structure"
89
+ },
90
+ "Financial Plan & Funding": {
91
+ "key": "financial_plan",
92
+ "description": "Financial projections and funding requirements"
93
+ },
94
+ "Risk Analysis": {
95
+ "key": "risk_analysis",
96
+ "description": "Risk assessment and mitigation strategies"
97
+ },
98
+ "Appendix": {
99
+ "key": "appendix",
100
+ "description": "Supporting documents and references"
101
+ }
102
+ }
103
+
104
+ # Section columns for database storage
105
+ SECTION_COLUMNS = [
106
+ "id",
107
+ "title",
108
+ "content",
109
+ "key",
110
+ "order",
111
+ "created_at",
112
+ "updated_at"
113
+ >>>>>>> Stashed changes
114
  ]
app/models.py CHANGED
@@ -1,3 +1,4 @@
 
1
  # Models and Data Structures
2
  # Contains Pydantic models and data structures to avoid circular imports
3
 
@@ -8,10 +9,23 @@ class ExportSection(BaseModel):
8
  """Represents a section of content for export"""
9
  title: str
10
  content: str
 
 
 
 
 
 
 
 
 
 
 
 
11
  key: Optional[str] = None
12
  order: Optional[int] = None
13
 
14
  class ExportRequest(BaseModel):
 
15
  """Request model for document export"""
16
  sections: List[ExportSection]
17
  businessIdea: str
@@ -59,3 +73,43 @@ class CreatePlanRequest(BaseModel):
59
  businessIdea: str
60
  countryCode: Optional[str] = None
61
  defaultCountry: Optional[str] = None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <<<<<<< Updated upstream
2
  # Models and Data Structures
3
  # Contains Pydantic models and data structures to avoid circular imports
4
 
 
9
  """Represents a section of content for export"""
10
  title: str
11
  content: str
12
+ =======
13
+ # Models Module
14
+ # Contains all data models for the business plan application
15
+
16
+ from typing import List, Optional, Dict, Any
17
+ from pydantic import BaseModel
18
+
19
+ class ExportSection(BaseModel):
20
+ """Represents a section of a business plan"""
21
+ title: str
22
+ content: Optional[str] = None
23
+ >>>>>>> Stashed changes
24
  key: Optional[str] = None
25
  order: Optional[int] = None
26
 
27
  class ExportRequest(BaseModel):
28
+ <<<<<<< Updated upstream
29
  """Request model for document export"""
30
  sections: List[ExportSection]
31
  businessIdea: str
 
73
  businessIdea: str
74
  countryCode: Optional[str] = None
75
  defaultCountry: Optional[str] = None
76
+ =======
77
+ """Request model for exporting business plan documents"""
78
+ businessIdea: Optional[str] = None
79
+ sections: List[ExportSection] = []
80
+ format: str = "PDF" # PDF, DOCX, etc.
81
+
82
+ class ExportResponse(BaseModel):
83
+ """Response model for export operations"""
84
+ success: bool
85
+ message: str
86
+ filename: Optional[str] = None
87
+ file_size: Optional[int] = None
88
+
89
+ class SectionJob(BaseModel):
90
+ """Represents a job for generating a section"""
91
+ section_id: str
92
+ title: str
93
+ status: str = "pending" # pending, processing, completed, failed
94
+ content: Optional[str] = None
95
+ error: Optional[str] = None
96
+
97
+ class BatchGenerateRequest(BaseModel):
98
+ """Request model for batch generation of sections"""
99
+ business_idea: str
100
+ sections: List[str] = []
101
+ user_id: Optional[str] = None
102
+
103
+ class GenerateRequest(BaseModel):
104
+ """Request model for generating individual sections"""
105
+ business_idea: str
106
+ section_type: str
107
+ user_id: Optional[str] = None
108
+
109
+ class CreatePlanRequest(BaseModel):
110
+ """Request model for creating a complete business plan"""
111
+ business_idea: str
112
+ sections: List[str] = []
113
+ user_id: Optional[str] = None
114
+ format: str = "PDF"
115
+ >>>>>>> Stashed changes
app/utils.py CHANGED
@@ -1,3 +1,4 @@
 
1
  # Utility functions shared across modules
2
  # This file helps break circular imports between main.py and pdf_generator.py
3
 
@@ -32,11 +33,38 @@ def sort_sections_by_order(sections: List[ExportSection]) -> List[ExportSection]
32
  for order_title, order_index in order_map.items():
33
  if key_clean.lower() in order_title.lower() or order_title.lower() in key_clean.lower():
34
  return order_index
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  # If no match found, put at the end
37
  return len(SECTION_ORDER)
38
 
 
39
  # Sort sections by their order
40
  sorted_sections = sorted(sections, key=get_section_order)
41
 
42
  return sorted_sections
 
 
 
 
1
+ <<<<<<< Updated upstream
2
  # Utility functions shared across modules
3
  # This file helps break circular imports between main.py and pdf_generator.py
4
 
 
33
  for order_title, order_index in order_map.items():
34
  if key_clean.lower() in order_title.lower() or order_title.lower() in key_clean.lower():
35
  return order_index
36
+ =======
37
+ # Utils Module
38
+ # Contains utility functions for the business plan application
39
+
40
+ from typing import List
41
+ from models import ExportSection
42
+
43
+ def sort_sections_by_order(sections: List[ExportSection]) -> List[ExportSection]:
44
+ """Sort sections by their predefined order"""
45
+ from constants import SECTION_ORDER
46
+
47
+ # Create a mapping of section titles to their order
48
+ order_map = {title: i for i, title in enumerate(SECTION_ORDER)}
49
+
50
+ def get_section_order(section: ExportSection) -> int:
51
+ # First try to match by title
52
+ if section.title in order_map:
53
+ return order_map[section.title]
54
+
55
+ # Then try to match by key
56
+ if section.key and section.key.replace('prompt_', '') in order_map:
57
+ return order_map[section.key.replace('prompt_', '')]
58
+ >>>>>>> Stashed changes
59
 
60
  # If no match found, put at the end
61
  return len(SECTION_ORDER)
62
 
63
+ <<<<<<< Updated upstream
64
  # Sort sections by their order
65
  sorted_sections = sorted(sections, key=get_section_order)
66
 
67
  return sorted_sections
68
+ =======
69
+ return sorted(sections, key=get_section_order)
70
+ >>>>>>> Stashed changes
maintest.txt DELETED
The diff for this file is too large to render. See raw diff