feat(widgets): add LLM context to prevent context overflow

This commit is contained in:
ItzCrazyKns
2025-11-24 15:35:00 +05:30
parent 956a768a86
commit 0a62c60da2
5 changed files with 99 additions and 84 deletions

View File

@@ -94,6 +94,7 @@ You can set skipSearch to true if the weather widget can fully answer the user's
return {
type: 'weather',
llmContext: `Weather in ${params.location} is ${weatherData.current}`,
data: {
location: params.location,
latitude: location.lat,
@@ -138,6 +139,7 @@ You can set skipSearch to true if the weather widget can fully answer the user's
return {
type: 'weather',
llmContext: `Weather in ${locationData.display_name} is ${weatherData.current}`,
data: {
location: locationData.display_name,
latitude: params.lat,
@@ -159,11 +161,13 @@ You can set skipSearch to true if the weather widget can fully answer the user's
return {
type: 'weather',
llmContext: 'No valid location or coordinates provided.',
data: null,
};
} catch (err) {
return {
type: 'weather',
llmContext: 'Failed to fetch weather data.',
data: {
error: `Error fetching weather data: ${err}`,
},