mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-27 17:18:13 +00:00
agent: improve knowledge naming (#2041)
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from typing import Any, Dict, List, Literal, Optional, Union
|
from typing import Any, Dict, List, Literal, Optional, Union
|
||||||
@@ -153,7 +154,8 @@ class Agent(BaseAgent):
|
|||||||
def _set_knowledge(self):
|
def _set_knowledge(self):
|
||||||
try:
|
try:
|
||||||
if self.knowledge_sources:
|
if self.knowledge_sources:
|
||||||
knowledge_agent_name = f"{self.role.replace(' ', '_')}"
|
full_pattern = re.compile(r'[^a-zA-Z0-9\-_\r\n]|(\.\.)')
|
||||||
|
knowledge_agent_name = f"{re.sub(full_pattern, '_', self.role)}"
|
||||||
if isinstance(self.knowledge_sources, list) and all(
|
if isinstance(self.knowledge_sources, list) and all(
|
||||||
isinstance(k, BaseKnowledgeSource) for k in self.knowledge_sources
|
isinstance(k, BaseKnowledgeSource) for k in self.knowledge_sources
|
||||||
):
|
):
|
||||||
|
|||||||
Reference in New Issue
Block a user