Fix new-question landing and question-language HITL
Publish documentation / publish (push) Successful in 34s
Publish documentation / publish (push) Successful in 34s
Reset the activity panel when starting a new question so the landing navigation is restored. Detect and persist the original question language, pass it through runtime and widget descriptors, and scope HITL controls to that language. Validated with gate, session, backend and frontend tests, TypeScript checks, Ruff and strict docs build. Rebuilt and restarted local core/frontend; both healthy and serving HTTP successfully.
This commit is contained in:
@@ -178,7 +178,8 @@ def list_cmd(
|
||||
def new_cmd(
|
||||
question: str = typer.Argument(..., help="La domanda in linguaggio naturale."),
|
||||
interaction_language: str = typer.Option(
|
||||
None, "--interaction-language", help="BCP-47 interaction language; defaults to workspace language."
|
||||
None, "--interaction-language",
|
||||
help="BCP-47 fallback for ambiguous questions; otherwise use the question's language.",
|
||||
),
|
||||
provider: str = typer.Option(None, "--provider", help="Provider LLM (es. zai, anthropic)."),
|
||||
model: str = typer.Option(None, "--model", help="Modello LLM (es. glm-5.2)."),
|
||||
@@ -193,10 +194,11 @@ def new_cmd(
|
||||
from tht.session.store import _extract_name, new_session_manifest, render_question_md
|
||||
|
||||
cfg = _load_config_or_exit(config)
|
||||
from tht.session.language import validate_language_tag
|
||||
from tht.session.language import question_interaction_language
|
||||
|
||||
try:
|
||||
language = validate_language_tag(
|
||||
language = question_interaction_language(
|
||||
question,
|
||||
interaction_language if interaction_language is not None else getattr(cfg, "language", "en")
|
||||
)
|
||||
except ValueError as exc:
|
||||
@@ -209,7 +211,7 @@ def new_cmd(
|
||||
repository.create(manifest)
|
||||
repository.write_artifact(manifest.id, "question", render_question_md(question))
|
||||
if json_out:
|
||||
typer.echo(json.dumps({"id": manifest.id}, ensure_ascii=False))
|
||||
typer.echo(json.dumps({"id": manifest.id, "interaction_language": language}, ensure_ascii=False))
|
||||
return
|
||||
typer.secho(f"OK: sessione creata ({manifest.id})", fg=typer.colors.GREEN)
|
||||
typer.echo(manifest.id)
|
||||
@@ -384,7 +386,7 @@ def ensure_interaction_language_cmd(
|
||||
json_out: bool = typer.Option(False, "--json", help="Emit pristine JSON."),
|
||||
config: Path = CONFIG_OPT,
|
||||
) -> None:
|
||||
"""Pin a missing legacy language from the workspace; never override a saved value."""
|
||||
"""Pin a missing language from the question; never override a saved value."""
|
||||
cfg = _load_config_or_exit(config)
|
||||
manifest = ensure_session_language_or_exit(cfg, session_id)
|
||||
if json_out:
|
||||
|
||||
Reference in New Issue
Block a user