refac
This commit is contained in:
@@ -159,7 +159,7 @@ def get_citation_source_from_tool_result(
|
||||
Returns a list of sources (usually one, but query_knowledge_bases may return multiple).
|
||||
"""
|
||||
try:
|
||||
if tool_name == "web_search":
|
||||
if tool_name == "search_web":
|
||||
# Parse JSON array: [{"title": "...", "link": "...", "snippet": "..."}]
|
||||
results = json.loads(tool_result)
|
||||
documents = []
|
||||
@@ -178,7 +178,7 @@ def get_citation_source_from_tool_result(
|
||||
})
|
||||
|
||||
return [{
|
||||
"source": {"name": "web_search", "id": "web_search"},
|
||||
"source": {"name": "search_web", "id": "search_web"},
|
||||
"document": documents,
|
||||
"metadata": metadata,
|
||||
}]
|
||||
@@ -3233,7 +3233,7 @@ async def process_chat_response(
|
||||
)
|
||||
|
||||
# Extract citation sources from tool results
|
||||
if tool_function_name in ["web_search", "view_knowledge_file", "query_knowledge_bases"] and tool_result:
|
||||
if tool_function_name in ["search_web", "view_knowledge_file", "query_knowledge_bases"] and tool_result:
|
||||
try:
|
||||
citation_sources = get_citation_source_from_tool_result(
|
||||
tool_name=tool_function_name,
|
||||
|
||||
@@ -44,7 +44,7 @@ from open_webui.env import (
|
||||
AIOHTTP_CLIENT_SESSION_TOOL_SERVER_SSL,
|
||||
)
|
||||
from open_webui.tools.builtin import (
|
||||
web_search,
|
||||
search_web,
|
||||
fetch_url,
|
||||
generate_image,
|
||||
edit_image,
|
||||
@@ -389,7 +389,7 @@ def get_builtin_tools(
|
||||
if getattr(request.app.state.config, "ENABLE_WEB_SEARCH", False) and get_model_capability(
|
||||
"web_search"
|
||||
):
|
||||
builtin_functions.extend([web_search, fetch_url])
|
||||
builtin_functions.extend([search_web, fetch_url])
|
||||
|
||||
# Add image generation/edit tools if enabled globally AND model has image_generation capability
|
||||
if getattr(
|
||||
|
||||
Reference in New Issue
Block a user