mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-15 05:04:27 +08:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user