|
5 | 5 |
|
6 | 6 | from app.core.config import settings |
7 | 7 | from app.schemas.health import ServiceHealth |
8 | | -from app.schemas.itinary import Itinerary, Leg |
| 8 | +from app.schemas.itinary import Itinerary |
9 | 9 |
|
10 | 10 | logger = logging.getLogger(__name__) |
11 | 11 |
|
@@ -68,11 +68,11 @@ async def health_check(self) -> ServiceHealth: |
68 | 68 | async def get_itinerary_insight(self, itinerary: Itinerary) -> None: |
69 | 69 | """ |
70 | 70 | Get AI-generated insights for a complete itinerary and enrich it with AI data. |
71 | | - |
| 71 | +
|
72 | 72 | This method sends the entire itinerary to the AI service and receives back: |
73 | 73 | - ai_description: Overall description of the itinerary |
74 | 74 | - ai_insights: List of insights for each leg |
75 | | - |
| 75 | +
|
76 | 76 | The method directly modifies the itinerary object in place, setting: |
77 | 77 | - itinerary.ai_description |
78 | 78 | - leg.ai_insight for each leg |
@@ -120,18 +120,18 @@ async def get_itinerary_insight(self, itinerary: Itinerary) -> None: |
120 | 120 |
|
121 | 121 | if response.status_code == 200: |
122 | 122 | data = response.json() |
123 | | - |
| 123 | + |
124 | 124 | # Set the itinerary-level AI description |
125 | 125 | itinerary.ai_description = data.get("ai_description") |
126 | | - |
| 126 | + |
127 | 127 | # Set AI insights for each leg |
128 | 128 | ai_insights = data.get("ai_insights", []) |
129 | 129 | for idx, leg in enumerate(itinerary.legs): |
130 | 130 | if idx < len(ai_insights): |
131 | 131 | leg.ai_insight = ai_insights[idx] |
132 | 132 | else: |
133 | 133 | leg.ai_insight = None |
134 | | - |
| 134 | + |
135 | 135 | return |
136 | 136 |
|
137 | 137 | logger.warning( |
|
0 commit comments