Merge the remote area: remote tokens, role_remote, remote_from, model wins for remote (wp-remote-a)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # app/models.py
This commit is contained in:
commit
e5572cab9d
21 files changed
+1250
-143
No files matched your search
+17
-5
@@ -293,7 +293,7 @@ class PlaceSuggestion(BaseModel):
|
||||
|
||||
token: str
|
||||
label: str
|
||||
kind: Literal["country", "region", "place"]
|
||||
kind: Literal["country", "region", "place", "remote"]
|
||||
count: int
|
||||
|
||||
|
||||
@@ -337,13 +337,25 @@ def suggest_companies(
|
||||
def suggest_places(
|
||||
store: StoreDep,
|
||||
q: str = "",
|
||||
agent: int | None = None,
|
||||
limit: Annotated[int, Query(ge=1, le=50)] = 12,
|
||||
) -> list[PlaceSuggestion]:
|
||||
"""Place tokens for the text typed so far: countries, then regions, then
|
||||
towns, each by open roles (`places.suggest`, over every open role's place
|
||||
line). An empty `q` suggests nothing."""
|
||||
"""Place tokens for the text typed so far: "Remote" (`remote:any`) when
|
||||
`q` starts "remote", countries, the remote tokens ("Remote · Denmark"),
|
||||
regions, then towns, each by open roles (`places.suggest`, over every
|
||||
open role's place line and every open remote role's area). The count of
|
||||
`remote:any` is the remote roles in the scope of `agent`, the default
|
||||
agent when absent, as the feed counts them. An empty `q` suggests
|
||||
nothing."""
|
||||
if not places.fold(q):
|
||||
return []
|
||||
viewer = _agent_id(store, agent)
|
||||
return [PlaceSuggestion(token=s.token, label=s.label, kind=s.kind, count=s.count)
|
||||
for s in places.suggest(q, store.open_places(), limit)]
|
||||
for s in places.suggest(
|
||||
q, store.open_places(), limit, remote=store.open_remote_areas(),
|
||||
gaz=store.gazetteer(),
|
||||
remote_any=lambda: store.count_roles(places=["remote:any"], agent=viewer,
|
||||
by_score=False))]
|
||||
|
||||
|
||||
@router.get("/places/labels")
|
||||
|
||||
Reference in new issue
Block a user