Chiusura fase di ristrutturazione e modularizzazione del workflow per favorire sviluppo modulare
This commit is contained in:
@@ -9,8 +9,8 @@ import re
|
||||
import shutil
|
||||
import tempfile
|
||||
import uuid
|
||||
from collections.abc import Sequence
|
||||
from pathlib import Path
|
||||
from typing import Sequence
|
||||
|
||||
import portalocker
|
||||
import yaml
|
||||
@@ -147,7 +147,7 @@ class FilesystemSessionRepository:
|
||||
return {}
|
||||
data = json.loads(path.read_text())
|
||||
if not isinstance(data, dict):
|
||||
raise ValueError(f"Invalid preferences: {path}")
|
||||
raise TypeError(f"Invalid preferences: {path}")
|
||||
return data
|
||||
|
||||
def set_preferences(self, preferences: dict) -> None:
|
||||
|
||||
@@ -8,7 +8,7 @@ from typing import Literal, Self
|
||||
|
||||
import portalocker
|
||||
import yaml
|
||||
from pydantic import BaseModel, Field, ConfigDict
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from tht.decisions import DecisionRecord
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@ import hashlib
|
||||
import json
|
||||
import re
|
||||
import uuid
|
||||
from collections.abc import Iterator, Sequence
|
||||
from contextlib import contextmanager
|
||||
from dataclasses import dataclass
|
||||
from datetime import UTC, datetime
|
||||
from importlib.resources import files
|
||||
from importlib.resources.abc import Traversable
|
||||
from pathlib import Path
|
||||
from typing import Iterator, Sequence
|
||||
|
||||
from sqlalchemy import Engine, create_engine, text
|
||||
from sqlalchemy.engine import URL, make_url
|
||||
@@ -204,7 +204,7 @@ class PostgresSessionRepository:
|
||||
self._runtime_role = runtime_role
|
||||
|
||||
@classmethod
|
||||
def from_config(cls, config, principal: PrincipalContext) -> "PostgresSessionRepository":
|
||||
def from_config(cls, config, principal: PrincipalContext) -> PostgresSessionRepository:
|
||||
query = {"sslmode": config.sslmode}
|
||||
if config.sslrootcert is not None:
|
||||
query["sslrootcert"] = str(config.sslrootcert)
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Protocol, Sequence
|
||||
from collections.abc import Sequence
|
||||
from typing import Protocol
|
||||
|
||||
from tht.decisions import DecisionInput, DecisionRecord
|
||||
from tht.session.models import PrincipalContext, SessionManifest, SessionSnapshot
|
||||
|
||||
@@ -55,7 +55,7 @@ def _extract_name(question: str) -> str:
|
||||
try:
|
||||
extractor = yake.KeywordExtractor(lan="it", n=1, top=8, dedupLim=0.9)
|
||||
ranked = [k for k, _ in extractor.extract_keywords(q)]
|
||||
except Exception:
|
||||
except Exception: # noqa: BLE001 - keyword extraction has a deterministic fallback
|
||||
return _summarize(question)
|
||||
seen: set[str] = set()
|
||||
picked: list[str] = []
|
||||
@@ -117,7 +117,7 @@ def create_session(
|
||||
from tht.workflow import load_workflow
|
||||
|
||||
schema_version = load_workflow().schema_version
|
||||
except Exception:
|
||||
except Exception: # noqa: BLE001 - legacy sessions may predate workflow metadata
|
||||
schema_version = None
|
||||
manifest = SessionManifest(
|
||||
id=session_id, created_at=now, question=question,
|
||||
|
||||
Reference in New Issue
Block a user