update
Some checks failed
CI / test (push) Failing after 19s

This commit is contained in:
2026-05-06 05:06:45 +02:00
parent bbc75b1559
commit 54b202bdc2
5 changed files with 15 additions and 10 deletions

View File

@@ -54,3 +54,7 @@ select = ["E", "F", "I", "UP", "B"]
python_version = "3.11" python_version = "3.11"
strict = true strict = true
warn_unused_configs = true warn_unused_configs = true
[[tool.mypy.overrides]]
module = ["chromadb", "chromadb.*"]
ignore_missing_imports = true

View File

@@ -9,7 +9,6 @@ from __future__ import annotations
from chromadb.config import System from chromadb.config import System
from chromadb.telemetry.product import ProductTelemetryClient, ProductTelemetryEvent from chromadb.telemetry.product import ProductTelemetryClient, ProductTelemetryEvent
from overrides import override
class NoOpProductTelemetryClient(ProductTelemetryClient): class NoOpProductTelemetryClient(ProductTelemetryClient):
@@ -18,7 +17,6 @@ class NoOpProductTelemetryClient(ProductTelemetryClient):
def __init__(self, system: System): def __init__(self, system: System):
super().__init__(system) super().__init__(system)
@override
def capture(self, event: ProductTelemetryEvent) -> None: def capture(self, event: ProductTelemetryEvent) -> None:
del event del event
return None return None

View File

@@ -411,7 +411,7 @@ async def _interactive_loop(
else: else:
line = sys.stdin.readline() # non-TTY / piped mode line = sys.stdin.readline() # non-TTY / piped mode
if not line: if not line:
return return last_response
command = line.strip() command = line.strip()
console.print(f"\n[bold cyan]tai[/bold cyan][dim] >[/dim] {command}") console.print(f"\n[bold cyan]tai[/bold cyan][dim] >[/dim] {command}")
except (EOFError, KeyboardInterrupt): except (EOFError, KeyboardInterrupt):

View File

@@ -17,7 +17,7 @@ from __future__ import annotations
import re import re
from dataclasses import dataclass, field from dataclasses import dataclass, field
from pathlib import Path from pathlib import Path
from typing import TYPE_CHECKING from typing import TYPE_CHECKING, Any
if TYPE_CHECKING: if TYPE_CHECKING:
from tai.ai_client import AIClient from tai.ai_client import AIClient
@@ -123,7 +123,7 @@ class RunbookStore:
self._client = chromadb.PersistentClient(path=str(path)) self._client = chromadb.PersistentClient(path=str(path))
else: else:
self._client = chromadb.PersistentClient(path=str(path), settings=settings) self._client = chromadb.PersistentClient(path=str(path), settings=settings)
self._collection = self._client.get_or_create_collection( self._collection: Any = self._client.get_or_create_collection(
name=_COLLECTION_NAME, name=_COLLECTION_NAME,
metadata={"hnsw:space": "cosine"}, metadata={"hnsw:space": "cosine"},
) )
@@ -241,11 +241,14 @@ class RunbookStore:
return [] return []
results = self._collection.get(include=["metadatas"]) results = self._collection.get(include=["metadatas"])
metas = results.get("metadatas") or [] metas = results.get("metadatas") or []
return [dict(m) for m in metas] entries: list[dict[str, str]] = []
for meta in metas:
entries.append({str(k): str(v) for k, v in dict(meta).items()})
return entries
def count(self) -> int: def count(self) -> int:
"""Return the number of indexed runbook documents.""" """Return the number of indexed runbook documents."""
return self._collection.count() return int(self._collection.count())
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@@ -5,7 +5,7 @@ from __future__ import annotations
from dataclasses import dataclass from dataclasses import dataclass
from datetime import UTC, datetime from datetime import UTC, datetime
from pathlib import Path from pathlib import Path
from typing import TYPE_CHECKING from typing import TYPE_CHECKING, Any
if TYPE_CHECKING: if TYPE_CHECKING:
from tai.ai_client import AIClient from tai.ai_client import AIClient
@@ -48,14 +48,14 @@ class SessionStore:
self._client = chromadb.PersistentClient(path=str(path)) self._client = chromadb.PersistentClient(path=str(path))
else: else:
self._client = chromadb.PersistentClient(path=str(path), settings=settings) self._client = chromadb.PersistentClient(path=str(path), settings=settings)
self._collection = self._client.get_or_create_collection( self._collection: Any = self._client.get_or_create_collection(
name=_COLLECTION_NAME, name=_COLLECTION_NAME,
metadata={"hnsw:space": "cosine"}, metadata={"hnsw:space": "cosine"},
) )
def count(self) -> int: def count(self) -> int:
"""Return number of indexed session summaries.""" """Return number of indexed session summaries."""
return self._collection.count() return int(self._collection.count())
def index_session(self, host: str, issue: str, summary: str, ai: AIClient) -> str: def index_session(self, host: str, issue: str, summary: str, ai: AIClient) -> str:
"""Embed and upsert one session summary into persistent storage.""" """Embed and upsert one session summary into persistent storage."""