feat(assistant): #91 etapes enrichies (sous-sections Reflechon/Sources, chevrons, indicateur anime, suppression barre de chargement)
This commit is contained in:
@@ -84,6 +84,10 @@ def tool_step_label(name: str, arguments: dict[str, Any] | None = None) -> dict[
|
||||
|
||||
|
||||
def thought_step_label(text: str) -> dict[str, Any]:
|
||||
"""Step descriptor for one intermediate reasoning note of the model."""
|
||||
"""Step descriptor for one intermediate reasoning note of the model.
|
||||
|
||||
The note is shown expanded under a “Thought” sub-section in the UI, so it
|
||||
is kept long enough to be readable (truncation is the safety net).
|
||||
"""
|
||||
cleaned = " ".join((text or "").split())
|
||||
return {"key": "thought", "params": {"value": cleaned[:400]}}
|
||||
return {"key": "thought", "params": {"value": cleaned[:1200]}}
|
||||
|
||||
+18
-1
@@ -150,12 +150,29 @@ def web_search(ctx, params: WebSearchInput) -> dict[str, Any]:
|
||||
"score": item.get("score"),
|
||||
}
|
||||
)
|
||||
return {
|
||||
unresponsive = [
|
||||
name for entry in (data.get("unresponsive_engines") or [])
|
||||
for name in ([entry[0]] if isinstance(entry, (list, tuple)) and entry else [entry])
|
||||
if isinstance(name, str)
|
||||
]
|
||||
payload: dict[str, Any] = {
|
||||
"query": query,
|
||||
"engine": "searxng",
|
||||
"results": results,
|
||||
"count": len(results),
|
||||
}
|
||||
if unresponsive:
|
||||
payload["unresponsive_engines"] = unresponsive[:8]
|
||||
if not results:
|
||||
# An instance whose upstream engines are all blocked (CAPTCHA / rate
|
||||
# limit) answers 200 with an empty list. Without an explicit hint the
|
||||
# model retries the same search until it burns its tool quota.
|
||||
payload["warning"] = (
|
||||
"Aucun résultat : les moteurs de recherche de l'instance SearXNG sont "
|
||||
f"indisponibles ({', '.join(unresponsive[:5]) or 'inconnus'}). "
|
||||
"Ne relance pas la même recherche — dis-le à l'utilisateur."
|
||||
)
|
||||
return payload
|
||||
|
||||
|
||||
@tool(
|
||||
|
||||
Reference in New Issue
Block a user