refac/fix
This commit is contained in:
@@ -144,7 +144,7 @@ class ToolServerConnection(BaseModel):
|
|||||||
path: str
|
path: str
|
||||||
type: Optional[str] = "openapi" # openapi, mcp
|
type: Optional[str] = "openapi" # openapi, mcp
|
||||||
auth_type: Optional[str]
|
auth_type: Optional[str]
|
||||||
headers: Optional[dict]
|
headers: Optional[dict | str] = None
|
||||||
key: Optional[str]
|
key: Optional[str]
|
||||||
config: Optional[dict]
|
config: Optional[dict]
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ async def verify_tool_servers_config(
|
|||||||
if token:
|
if token:
|
||||||
headers = {"Authorization": f"Bearer {token}"}
|
headers = {"Authorization": f"Bearer {token}"}
|
||||||
|
|
||||||
if form_data.headers:
|
if form_data.headers and isinstance(form_data.headers, dict):
|
||||||
if headers is None:
|
if headers is None:
|
||||||
headers = {}
|
headers = {}
|
||||||
headers.update(form_data.headers)
|
headers.update(form_data.headers)
|
||||||
@@ -332,7 +332,7 @@ async def verify_tool_servers_config(
|
|||||||
if token:
|
if token:
|
||||||
headers = {"Authorization": f"Bearer {token}"}
|
headers = {"Authorization": f"Bearer {token}"}
|
||||||
|
|
||||||
if form_data.headers:
|
if form_data.headers and isinstance(form_data.headers, dict):
|
||||||
if headers is None:
|
if headers is None:
|
||||||
headers = {}
|
headers = {}
|
||||||
headers.update(form_data.headers)
|
headers.update(form_data.headers)
|
||||||
|
|||||||
@@ -1380,7 +1380,7 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||||||
oauth_token = None
|
oauth_token = None
|
||||||
|
|
||||||
connection_headers = mcp_server_connection.get("headers", None)
|
connection_headers = mcp_server_connection.get("headers", None)
|
||||||
if connection_headers:
|
if connection_headers and isinstance(connection_headers, dict):
|
||||||
for key, value in connection_headers.items():
|
for key, value in connection_headers.items():
|
||||||
headers[key] = value
|
headers[key] = value
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ async def get_tools(
|
|||||||
)
|
)
|
||||||
|
|
||||||
connection_headers = tool_server_connection.get("headers", None)
|
connection_headers = tool_server_connection.get("headers", None)
|
||||||
if connection_headers:
|
if connection_headers and isinstance(connection_headers, dict):
|
||||||
for key, value in connection_headers.items():
|
for key, value in connection_headers.items():
|
||||||
headers[key] = value
|
headers[key] = value
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user