mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 08:33:20 +00:00
Merge pull request #1869 from siiddhantt/refactor/tools-dict
refactor: update user tools dict to use enumeration based key
This commit is contained in:
@@ -91,8 +91,8 @@ class BaseAgent(ABC):
|
|||||||
user_tools_collection = db["user_tools"]
|
user_tools_collection = db["user_tools"]
|
||||||
user_tools = user_tools_collection.find({"user": user, "status": True})
|
user_tools = user_tools_collection.find({"user": user, "status": True})
|
||||||
user_tools = list(user_tools)
|
user_tools = list(user_tools)
|
||||||
tools_by_id = {str(tool["_id"]): tool for tool in user_tools}
|
|
||||||
return tools_by_id
|
return {str(i): tool for i, tool in enumerate(user_tools)}
|
||||||
|
|
||||||
def _build_tool_parameters(self, action):
|
def _build_tool_parameters(self, action):
|
||||||
params = {"type": "object", "properties": {}, "required": []}
|
params = {"type": "object", "properties": {}, "required": []}
|
||||||
@@ -313,7 +313,6 @@ class BaseAgent(ABC):
|
|||||||
if hasattr(response, "message") and getattr(response.message, "content", None):
|
if hasattr(response, "message") and getattr(response.message, "content", None):
|
||||||
yield {"answer": response.message.content}
|
yield {"answer": response.message.content}
|
||||||
return
|
return
|
||||||
|
|
||||||
processed_response_gen = self._llm_handler(
|
processed_response_gen = self._llm_handler(
|
||||||
response, tools_dict, messages, log_context, self.attachments
|
response, tools_dict, messages, log_context, self.attachments
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user