OSM: Send events during nominatim short-circuit code paths

This commit is contained in:
projectmoon 2024-10-31 11:56:33 +01:00
parent 8ad5209d10
commit f4ea096062
2 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,10 @@
# OpenStreetMap Tool
**1.1.1:**
- Send resolution complete event when pulling Nominatim info from
cache.
- Send error event when headers not set for Nominatim search.
**1.1.0:**
- Fix bad check in fallback name assembly behavior.
- Slightly alter functions to improve specific place search.

4
osm.py
View File

@ -2,7 +2,7 @@
title: OpenStreetMap Tool
author: projectmoon
author_url: https://git.agnos.is/projectmoon/open-webui-filters
version: 1.1.0
version: 1.1.1
license: AGPL-3.0+
required_open_webui_version: 0.3.21
requirements: openrouteservice
@ -806,6 +806,7 @@ class OsmSearcher:
if data:
print(f"Got nominatim search data for {query} from cache!")
await self.event_resolving(done=True)
return data[:limit]
print(f"Searching Nominatim for: {query}")
@ -820,6 +821,7 @@ class OsmSearcher:
headers = self.create_headers()
if not headers:
await self.event_error("Headers not set")
raise ValueError("Headers not set")
response = requests.get(url, params=params, headers=headers)