Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve the problem of resource duplication and solve the problem of slow recall of table structure #1381

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions dbgpt/serve/agent/team/plan/planner_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from dbgpt._private.config import Config
from dbgpt.agent.agents.base_agent_new import ConversableAgent

from dbgpt.agent.resource.resource_api import AgentResource
from .plan_action import PlanAction

CFG = Config()
Expand Down Expand Up @@ -70,11 +70,19 @@ def _init_reply_message(self, recive_message):
}
return reply_message

@staticmethod
def get_unique_resources_codes(resource: AgentResource) -> str:
return resource.name + "_" + resource.type.value + "_" + resource.value

def bind_agents(self, agents: List[ConversableAgent]) -> ConversableAgent:
self.agents = agents
unique_resources = set()
for agent in self.agents:
if agent.resources and len(agent.resources) > 0:
self.resources.extend(agent.resources)
for resource in agent.resources:
if self.get_unique_resources_codes(resource) not in unique_resources:
unique_resources.add(self.get_unique_resources_codes(resource))
self.resources.append(resource)
return self

def prepare_act_param(self) -> Optional[Dict]:
Expand Down
Loading