diff --git a/assistants/project-assistant/assistant/chat.py b/assistants/project-assistant/assistant/chat.py index 6076638a..3201f1db 100644 --- a/assistants/project-assistant/assistant/chat.py +++ b/assistants/project-assistant/assistant/chat.py @@ -31,7 +31,7 @@ from assistant.command_processor import command_registry from assistant.respond import respond_to_conversation from assistant.team_welcome import generate_team_welcome_message -from assistant.utils import load_text_include +from assistant.utils import CONTEXT_TRANSFER_TEMPLATE_ID, DEFAULT_TEMPLATE_ID, load_text_include from .config import assistant_config from .conversation_project_link import ConversationProjectManager @@ -71,7 +71,7 @@ async def content_evaluator_factory( }, additional_templates=[ AssistantTemplate( - id="knowledge_transfer", + id=CONTEXT_TRANSFER_TEMPLATE_ID, name="Knowledge Transfer Assistant", description="An assistant for capturing and sharing complex information for others to explore.", ), @@ -80,7 +80,7 @@ async def content_evaluator_factory( **dashboard_card.metadata( dashboard_card.TemplateConfig( enabled=False, - template_id="default", + template_id=DEFAULT_TEMPLATE_ID, background_color="rgb(159, 216, 159)", icon=dashboard_card.image_to_url( pathlib.Path(__file__).parent / "assets" / "icon.svg", "image/svg+xml" @@ -92,7 +92,7 @@ async def content_evaluator_factory( ), dashboard_card.TemplateConfig( enabled=True, - template_id="knowledge_transfer", + template_id=CONTEXT_TRANSFER_TEMPLATE_ID, icon=dashboard_card.image_to_url( pathlib.Path(__file__).parent / "assets" / "icon_context_transfer.svg", "image/svg+xml" ), diff --git a/assistants/project-assistant/assistant/project_common.py b/assistants/project-assistant/assistant/project_common.py index 2b5c5c82..7055d939 100644 --- a/assistants/project-assistant/assistant/project_common.py +++ b/assistants/project-assistant/assistant/project_common.py @@ -12,6 +12,7 @@ from .conversation_project_link import ConversationProjectManager from .logging import logger +from .utils import DEFAULT_TEMPLATE_ID from .project_data import LogEntryType from .project_storage import ProjectStorage from .project_storage_models import ConversationRole @@ -28,10 +29,10 @@ class ConfigurationTemplate(Enum): def get_template(context: ConversationContext) -> ConfigurationTemplate: - template_id = context.assistant._template_id or "default" + template_id = context.assistant._template_id or DEFAULT_TEMPLATE_ID return ( ConfigurationTemplate.PROJECT_ASSISTANT - if template_id == "default" + if template_id == DEFAULT_TEMPLATE_ID else ConfigurationTemplate.CONTEXT_TRANSFER_ASSISTANT ) diff --git a/assistants/project-assistant/assistant/tools.py b/assistants/project-assistant/assistant/tools.py index c1f39af3..10428f43 100644 --- a/assistants/project-assistant/assistant/tools.py +++ b/assistants/project-assistant/assistant/tools.py @@ -38,7 +38,7 @@ from .project_notifications import ProjectNotifier from .project_storage import ProjectStorage, ProjectStorageManager from .project_storage_models import ConversationRole -from .utils import is_context_transfer_assistant +from .utils import DEFAULT_TEMPLATE_ID, is_context_transfer_assistant async def invoke_command_handler( @@ -97,10 +97,10 @@ def __init__(self, context: ConversationContext, role: ConversationRole): self.tool_functions = ToolFunctions() self.is_context_transfer = is_context_transfer_assistant(context) - template_id = context.assistant._template_id or "default" + template_id = context.assistant._template_id or DEFAULT_TEMPLATE_ID self.config_template = ( ConfigurationTemplate.PROJECT_ASSISTANT - if template_id == "default" + if template_id == DEFAULT_TEMPLATE_ID else ConfigurationTemplate.CONTEXT_TRANSFER_ASSISTANT ) diff --git a/assistants/project-assistant/assistant/utils.py b/assistants/project-assistant/assistant/utils.py index 6086bd28..1977f630 100644 --- a/assistants/project-assistant/assistant/utils.py +++ b/assistants/project-assistant/assistant/utils.py @@ -13,6 +13,7 @@ from .logging import logger CONTEXT_TRANSFER_TEMPLATE_ID = "knowledge_transfer" +DEFAULT_TEMPLATE_ID = "default" def is_context_transfer_assistant(context: ConversationContext) -> bool: diff --git a/assistants/project-assistant/tests/test_project_tools.py b/assistants/project-assistant/tests/test_project_tools.py index 3d3f197a..f4036f3c 100644 --- a/assistants/project-assistant/tests/test_project_tools.py +++ b/assistants/project-assistant/tests/test_project_tools.py @@ -26,7 +26,8 @@ def context(self): # Add the assistant attribute for the get_project_tools test context.assistant = MagicMock() # Use the correct property name (_template_id) - context.assistant._template_id = "default" + from assistant.utils import DEFAULT_TEMPLATE_ID + context.assistant._template_id = DEFAULT_TEMPLATE_ID return context def test_initialization(self, context):