mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-07-12 12:37:32 +00:00
fix(chat): require explicit web search enable
This commit is contained in:
+10
-11
@@ -24,7 +24,7 @@ from src.model_context import estimate_tokens
|
||||
from src.settings import get_setting
|
||||
from src.prompt_security import untrusted_context_message
|
||||
from src.tool_security import blocked_tools_for_owner, plan_mode_disabled_tools
|
||||
from src.tool_policy import GUIDE_ONLY_DIRECTIVE, ToolPolicy
|
||||
from src.tool_policy import GUIDE_ONLY_DIRECTIVE, WEB_TOOL_NAMES, ToolPolicy
|
||||
from src.tool_utils import _truncate, get_mcp_manager
|
||||
from src.agent_tools import (
|
||||
parse_tool_blocks,
|
||||
@@ -321,7 +321,7 @@ _DOMAIN_RULES = {
|
||||
}
|
||||
|
||||
_DOMAIN_TOOL_MAP = {
|
||||
"web": {"web_search", "web_fetch"},
|
||||
"web": set(WEB_TOOL_NAMES),
|
||||
"documents": {"create_document", "edit_document", "update_document", "suggest_document", "manage_documents"},
|
||||
"email": {"list_email_accounts", "list_emails", "read_email", "send_email", "reply_to_email", "bulk_email", "archive_email", "delete_email", "mark_email_read", "resolve_contact", "manage_contact"},
|
||||
"cookbook": {"download_model", "serve_model", "serve_preset", "list_serve_presets", "list_served_models", "stop_served_model", "tail_serve_output", "list_downloads", "cancel_download", "search_hf_models", "list_cached_models", "list_cookbook_servers", "adopt_served_model"},
|
||||
@@ -2847,13 +2847,12 @@ async def stream_agent_loop(
|
||||
if "email" in (_intent.get("domains") or set()):
|
||||
_relevant_tools.add("ui_control")
|
||||
if "web" in (_intent.get("domains") or set()):
|
||||
_relevant_tools.update({"web_search", "web_fetch"})
|
||||
_removed_web_blocks = sorted({"web_search", "web_fetch"} & disabled_tools)
|
||||
if _removed_web_blocks:
|
||||
disabled_tools.difference_update({"web_search", "web_fetch"})
|
||||
_relevant_tools.update(WEB_TOOL_NAMES)
|
||||
_blocked_web_tools = sorted(WEB_TOOL_NAMES & disabled_tools)
|
||||
if _blocked_web_tools:
|
||||
logger.info(
|
||||
"[agent-intent] web turn forced search tools enabled; removed disabled=%s",
|
||||
_removed_web_blocks,
|
||||
"[agent-intent] web domain selected but search tools remain disabled=%s",
|
||||
_blocked_web_tools,
|
||||
)
|
||||
if "ui" in (_intent.get("domains") or set()):
|
||||
_relevant_tools.add("ui_control")
|
||||
@@ -2887,9 +2886,9 @@ async def stream_agent_loop(
|
||||
_relevant_tools = set(ALWAYS_AVAILABLE)
|
||||
_relevant_tools.update({"read_file", "grep", "ls", "manage_documents"})
|
||||
|
||||
# Per-request forced tools are stronger than retrieval. Search toggles and
|
||||
# explicit lookup turns must make web tools visible even when tool RAG
|
||||
# misses them; route-level disabled_tools decides what else is allowed.
|
||||
# Per-request forced tools are stronger than retrieval. Explicit search
|
||||
# settings make web tools visible even when tool RAG misses them;
|
||||
# route-level disabled_tools decides what remains allowed.
|
||||
if not guide_only and forced_tools:
|
||||
forced_set = {t for t in forced_tools if t not in disabled_tools}
|
||||
if _relevant_tools is None:
|
||||
|
||||
Reference in New Issue
Block a user