feat(harness): derive a 3-5 keyword session name (YAKE, no LLM)
New sessions get a concise Italian-keyword `name` instead of the truncated question. `tht session new` (when no --name is given) derives it via a new `_extract_name` helper using YAKE (pure-Python, unsupervised, Italian, no LLM), dropping generic query verbs and keeping the top keywords in reading order; falls back to `_summarize` if YAKE is unavailable. `create_session` core keeps its `name=None` default — the policy lives at the CLI layer. TDD: tests/test_session_name.py (unit + CliRunner integration). Full harness suite 269 passed; ruff clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -78,11 +78,12 @@ def new_cmd(
|
||||
config: Path = CONFIG_OPT,
|
||||
) -> None:
|
||||
"""Crea una sessione e stampa il suo id (ultima riga dell'output)."""
|
||||
from tht.session.store import create_session
|
||||
from tht.session.store import _extract_name, create_session
|
||||
|
||||
cfg = _load_config_or_exit(config)
|
||||
manifest = create_session(question, cfg.database, cfg.paths.sessions,
|
||||
provider=provider, model=model, thinking=thinking, name=name)
|
||||
provider=provider, model=model, thinking=thinking,
|
||||
name=name or _extract_name(question))
|
||||
if json_out:
|
||||
typer.echo(json.dumps({"id": manifest.id}, ensure_ascii=False))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user