mirror of
https://github.com/MrSleeps/jellyfin-scene-search.git
synced 2026-11-17 07:21:28 +00:00
Fix JSON serialization for search vectors
This commit is contained in:
@@ -19,6 +19,11 @@ class Meili:
|
||||
raise RuntimeError(f"Meilisearch {response.status_code}: {response.text}")
|
||||
return response
|
||||
|
||||
@staticmethod
|
||||
def _json_vector(vector: Iterable[float]) -> list[float]:
|
||||
"""Convert NumPy/PyTorch scalar values into JSON-native floats."""
|
||||
return [float(value) for value in vector]
|
||||
|
||||
def ensure_index(self) -> None:
|
||||
r = self.session.get(f"{self.url}/indexes/{self.index}")
|
||||
if r.status_code == 404:
|
||||
@@ -51,7 +56,7 @@ class Meili:
|
||||
|
||||
def search_vector(self, vector: Iterable[float], limit: int = 10) -> dict:
|
||||
payload = {
|
||||
"vector": list(vector),
|
||||
"vector": self._json_vector(vector),
|
||||
"hybrid": {"embedder": "siglip2", "semanticRatio": 1.0},
|
||||
"limit": limit,
|
||||
"showRankingScore": True,
|
||||
|
||||
Reference in New Issue
Block a user