Updates and fixes.

This commit is contained in:
2025-12-19 11:26:26 +01:00
parent 6c0dc5f3d8
commit 4ce795228d
28 changed files with 459 additions and 232 deletions

View File

@@ -45,7 +45,7 @@ export default function AiInsightWidget({ config }: AiInsightWidgetProps) {
const [showAnalysis, setShowAnalysis] = useState(false)
const deviceId = deviceIds[0]
const metric = metricIds[0]
const metrics = metricIds // Use ALL selected metrics
const {
data: analysis,
@@ -53,11 +53,11 @@ export default function AiInsightWidget({ config }: AiInsightWidgetProps) {
refetch,
error,
} = useQuery({
queryKey: ['ai-insight', deviceId, metric, promptType, timeframe],
queryKey: ['ai-insight', deviceId, metrics, promptType, timeframe],
queryFn: async () => {
const response = await telemetryApi.analyze({
device_id: deviceId,
metric,
metrics: metrics, // Send all metrics
hours: timeframe.hours || 240,
limit: 200,
prompt_type: promptType,

View File

@@ -17,7 +17,7 @@ export default function AirQualityWidget({ config }: AirQualityWidgetProps) {
const response = await weatherApi.getAirQuality(city)
return response.data
},
refetchInterval: 300000, // Refresh every 5 minutes
refetchInterval: 5000, // Refresh every 5 seconds
staleTime: 240000, // Consider fresh for 4 minutes
})

View File

@@ -69,7 +69,7 @@ export default function ComfortIndexWidget({ config }: ComfortIndexWidgetProps)
const response = await devicesApi.getComfortIndex(deviceId)
return response.data
},
refetchInterval: 60000, // Refresh every minute
refetchInterval: 5000, // Refresh every 5 seconds
enabled: !!deviceId,
})

View File

@@ -24,7 +24,7 @@ export default function HealthStatsWidget({ config }: HealthStatsWidgetProps) {
const response = await wellnessApi.getHealthInsights(deviceId, widgetCity || undefined)
return response.data
},
refetchInterval: 60000, // Refresh every minute
refetchInterval: 5000, // Refresh every 5 seconds
enabled: !!deviceId,
})

View File

@@ -36,7 +36,7 @@ export default function RunSuitabilityWidget({ config }: RunSuitabilityWidgetPro
const response = await wellnessApi.getRunSuitability(deviceId, widgetCity)
return response.data
},
refetchInterval: 300000, // Refresh every 5 minutes
refetchInterval: 5000, // Refresh every 5 seconds
enabled: !!deviceId && !!widgetCity,
})

View File

@@ -127,7 +127,7 @@ export default function WeatherWidget({ config }: WeatherWidgetProps) {
const response = await weatherApi.getCurrent({ city })
return response.data
},
refetchInterval: 300000, // Refresh every 5 minutes
refetchInterval: 5000, // Refresh every 5 seconds
staleTime: 240000, // Consider fresh for 4 minutes
})