Conversation
Multi-turn conversational AI weather assistant accessible via View > WeatherChat (Ctrl+T). Uses current weather data as context, supports conversation history, and routes through OpenRouter. - New WeatherChatDialog with accessible UI (labeled controls, keyboard nav) - Builds weather context from current conditions, forecast, alerts, trends - Background threaded API calls with proper error handling - Clear chat, copy to clipboard, Escape to close - 16 unit tests for context building and configuration
Rename dialog, module, tests, and menu items from WeatherChat to Weather Assistant per user preference.
Disabling the input control caused screen readers to lose focus on it. Now we keep it enabled and use the _is_generating flag to block sends instead.
TrendInsight has metric/direction/change/unit/summary fields, not description. Also builds a fallback string from metric + direction when summary is None.
73586f1 to
2bca303
Compare
Orinks
commented
Feb 11, 2026
Owner
Author
Orinks
left a comment
There was a problem hiding this comment.
Review: Changes Requested 🔍
Good work overall — the Prism integration is clean and the graceful fallback pattern is solid. However, CI is failing with 2 test bugs that need fixing:
Must Fix (CI failures)
1. tests/test_weather_assistant_dialog.py::TestSystemPrompt::test_prompt_exists
The test asserts 'WeatherChat' in SYSTEM_PROMPT but the prompt text says "Weather Assistant", not "WeatherChat". Fix the assertion to match:
assert "Weather Assistant" in SYSTEM_PROMPT2. tests/test_weather_assistant_dialog.py::TestBuildWeatherContext::test_with_forecast
The test asserts '55°F' but MockForecastPeriod.temperature is 55.0 (a float), so output is 55.0°F. Either change the mock to temperature: int = 55, update the assertion to '55.0°F', or format with :.0f in the dialog code.
Everything Else Looks Good
- ScreenReaderAnnouncer wrapper is well-structured with proper exception handling
- Graceful fallback when prismatoid isn't installed works correctly
- Dialog integration is clean — announcements on welcome, responses, and errors
- Proper cleanup in
_on_closeviashutdown() - Good test coverage for the announcer module
- Updated SYSTEM_PROMPT to mention available weather tools (get_current_weather, get_forecast, get_alerts) and guide the AI to use them for location-specific queries - Added tests/test_weather_assistant_integration.py with 8 tests: - Full tool call flow (single, multiple, chained tool calls) - Direct response without tools - Error recovery flow - System prompt content verification (3 tests) - Used AST parsing to test SYSTEM_PROMPT without importing wx/prism
- Make prism import lazy to avoid Python 3.13 + pytest ValueError - Fix mock backend to set features.is_supported_at_runtime - Update pyproject dep test for prismatoid as main dependency - Remove broken announcer integration tests (wx import in CI)
Use context manager pattern so sys.modules mock stays active when ScreenReaderAnnouncer.__init__ calls _try_import_prism().
- get_hourly_forecast: 12-period hourly breakdown for time-specific questions - search_location: geocoding search for ambiguous place names/ZIP codes - Updated system prompt to document new tools
- add_location: save a location with name/lat/lon to user's list - list_locations: show all saved locations with current marker - Pass config_manager to WeatherToolExecutor for location persistence - Updated system prompt with new tools and usage guidance
Generic Open-Meteo API tool that lets the AI construct custom queries with any combination of current/hourly/daily variables. Covers soil temperature, UV index, cloud cover, dew point, snow depth, visibility, precipitation probability, and dozens more variables with global coverage. The AI picks the right parameters based on the user's question.
Split tools into CORE_TOOLS (current weather, forecast, alerts) sent on every request, and EXTENDED_TOOLS (hourly, search, add/list locations, query_open_meteo) only sent when keyword triggers detected in the user's message. Saves tokens on simple weather questions.
- get_area_forecast_discussion: local NWS forecaster discussion via API - get_wpc_discussion: WPC short range discussion via BeautifulSoup scraper - get_spc_outlook: SPC Day 1 convective outlook via scraper - Uses existing national_discussion_scraper.py (already in codebase) - Discussion tools loaded only when keywords match (severe, tornado, etc.) - Truncates long discussions to 3000 chars for AI context
Antfarm-generated tests assumed original 3 tools. Updated counts and removed assumption that all tools have a location parameter.
…iscussionService" This reverts commit 83918ad.
When tools are included in the request and the user is on a free router or default free model, automatically switch to Qwen3 Coder which has reliable function calling support. Users who pick a specific model keep their choice.
The app object has weather_client, not weather_service. This was causing _get_tool_executor to always return None, so tools were never sent to the model.
Instead of hardcoding one model, tries Qwen3 Coder -> Mistral Small 3.1 -> Llama 3.3 when rate limited. Only applies when using free router models with tool calls.
Some free models return empty choices when tools are sent. Now falls back to a no-tools conversational response instead of showing an error.
Use whatever model the user has in settings. Only enable fallback chain when on a free router. No more overriding to Qwen3 Coder.
The app's WeatherClient is async with Location objects, but the tool executor expects sync get_current_conditions(lat, lon) etc. NoaaApiClient has the right interface.
NWS only covers US locations. CombinedWeatherClient tries NWS first, falls back to Open-Meteo for international locations. Alerts and discussions remain NWS-only (US).
CombinedWeatherClient now tries NWS -> Open-Meteo for weather data, and NWS -> Visual Crossing for alerts (when VC API key is configured). This gives global alert coverage for non-US locations.
Free router can route to providers that don't support tools (e.g. StepFun returning 400 'tool_calls.function.arguments is required'). Now catches 400s, provider errors, and tool_calls errors too.
Free router routes to models that narrate tools instead of calling them. Always use Qwen3 Coder (with fallback chain) for tool requests when on a free router.
openrouter/auto is the paid router which handles tools fine. Only override openrouter/free and the default free Llama model.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Weather Assistant (Phase 1 + 2)
Adds a conversational AI weather assistant accessible via View > Weather Assistant (Ctrl+T).
Features
Files
src/accessiweather/ai_tools.py— tool schemas, tiered selection, WeatherToolExecutorsrc/accessiweather/screen_reader.py— Prismatoid wrapper with lazy importsrc/accessiweather/ui/dialogs/weather_assistant_dialog.py— dialog with tool call loop, combined client, fallback chaintests/test_ai_tools.py,test_ai_tools_extended.py,test_ai_tools_formatters.py— tool coveragetests/test_weather_assistant_*.py,test_screen_reader.py— dialog and screen reader testsNotes