Feat: add local & ssh provider in admin panel (#15039)

### What problem does this PR solve?

Feat: add local & ssh provider in admin panel

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
Magicbook1108
2026-05-20 16:56:20 +08:00
committed by GitHub
parent 6499bce2a6
commit b28e134944
19 changed files with 1836 additions and 408 deletions

View File

@@ -391,6 +391,10 @@ class Base(ABC):
name = tc.function.name
try:
args = json_repair.loads(tc.function.arguments)
if not isinstance(args, dict):
raise TypeError(
f"Tool arguments for {name} must be a JSON object, got {type(args).__name__}"
)
if hasattr(self.toolcall_session, "tool_call_async"):
result = await self.toolcall_session.tool_call_async(name, args)
else:
@@ -493,6 +497,10 @@ class Base(ABC):
name = tc.function.name
try:
args = json_repair.loads(tc.function.arguments)
if not isinstance(args, dict):
raise TypeError(
f"Tool arguments for {name} must be a JSON object, got {type(args).__name__}"
)
if hasattr(self.toolcall_session, "tool_call_async"):
result = await self.toolcall_session.tool_call_async(name, args)
else:
@@ -1495,7 +1503,11 @@ class LiteLLMBase(ABC):
return msg
def _verbose_tool_use(self, name, args, res):
return "<tool_call>" + json.dumps({"name": name, "args": args, "result": res}, ensure_ascii=False, indent=2) + "</tool_call>"
return "<tool_call>" + json.dumps(
{"name": name, "args": args, "result": str(res) if isinstance(res, Exception) else res},
ensure_ascii=False,
indent=2,
) + "</tool_call>"
def _append_history(self, hist, tool_call, tool_res, reasoning_content=None):
assistant_msg = {
@@ -1604,6 +1616,8 @@ class LiteLLMBase(ABC):
name = tc.function.name
try:
args = json_repair.loads(tc.function.arguments)
if not isinstance(args, dict):
raise TypeError(f"Tool arguments for {name} must be a JSON object, got {type(args).__name__}")
if hasattr(self.toolcall_session, "tool_call_async"):
result = await self.toolcall_session.tool_call_async(name, args)
else:
@@ -1720,6 +1734,8 @@ class LiteLLMBase(ABC):
name = tc.function.name
try:
args = json_repair.loads(tc.function.arguments)
if not isinstance(args, dict):
raise TypeError(f"Tool arguments for {name} must be a JSON object, got {type(args).__name__}")
if hasattr(self.toolcall_session, "tool_call_async"):
result = await self.toolcall_session.tool_call_async(name, args)
else: