add resilient self-plan generation with provider fallback
This commit is contained in:
1 parent
73218402f6
commit
ef9f39e564
3 files changed
+193
-62
No files matched your search
@@ -18,6 +18,16 @@ export interface Recommendation {
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
interface RecommendationMeta {
|
||||
usedFallbackPlan?: boolean;
|
||||
}
|
||||
|
||||
interface RecommendationApiEnvelope {
|
||||
success?: boolean;
|
||||
data?: Recommendation;
|
||||
meta?: RecommendationMeta;
|
||||
}
|
||||
|
||||
export interface GenerateRecommendationRequest {
|
||||
userId: string;
|
||||
useExternalModel?: boolean;
|
||||
@@ -117,7 +127,7 @@ export async function generateSelfRecommendation(
|
||||
token: string | null,
|
||||
): Promise<Recommendation> {
|
||||
try {
|
||||
const response = await apiClient.post(
|
||||
const response = await apiClient.post<RecommendationApiEnvelope>(
|
||||
`${API_ENDPOINTS.RECOMMENDATIONS}/generate-self`,
|
||||
{},
|
||||
withAuth(token),
|
||||
|
||||
@@ -203,7 +203,7 @@ export default function GoalsScreen() {
|
||||
await Promise.all([refetchRecommendations(), refetchGoals()]);
|
||||
Alert.alert(
|
||||
"Plan Ready",
|
||||
"Your new AI activity plan has been generated and active goals were added.",
|
||||
"Your new activity plan is ready and active goals were added.",
|
||||
);
|
||||
} catch (error) {
|
||||
const message =
|
||||
|
||||
Reference in new issue
Block a user