diff --git a/Dockerfile b/Dockerfile index 5bbe9467f8..7a37802bf6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,16 +45,16 @@ COPY src/backend src/backend COPY docker_scripts/ ${PG_APP_HOME}/ # Install frontend dependencies -WORKDIR /workspace/src/interfaces/coral_web -COPY src/interfaces/coral_web/src ./src -COPY src/interfaces/coral_web/public ./public -COPY src/interfaces/coral_web/next.config.mjs . -COPY src/interfaces/coral_web/tsconfig.json . -COPY src/interfaces/coral_web/tailwind.config.js . -COPY src/interfaces/coral_web/postcss.config.js . -COPY src/interfaces/coral_web/package.json src/interfaces/coral_web/yarn.lock* src/interfaces/coral_web/package-lock.json* src/interfaces/coral_web/pnpm-lock.yaml* ./ -COPY src/interfaces/coral_web/.env.development . -COPY src/interfaces/coral_web/.env.production . +WORKDIR /workspace/src/interfaces/assistants_web +COPY src/interfaces/assistants_web/src ./src +COPY src/interfaces/assistants_web/public ./public +COPY src/interfaces/assistants_web/next.config.mjs . +COPY src/interfaces/assistants_web/tsconfig.json . +COPY src/interfaces/assistants_web/tailwind.config.js . +COPY src/interfaces/assistants_web/postcss.config.js . +COPY src/interfaces/assistants_web/package.json src/interfaces/assistants_web/yarn.lock* src/interfaces/assistants_web/package-lock.json* src/interfaces/assistants_web/pnpm-lock.yaml* ./ +COPY src/interfaces/assistants_web/.env.development . +COPY src/interfaces/assistants_web/.env.production . ENV NEXT_PUBLIC_API_HOSTNAME='/api' RUN npm install \ diff --git a/Makefile b/Makefile index 32d5244075..b52d5d63da 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ exec-db: .PHONY: migration migration: - docker compose run --build backend alembic -c src/backend/alembic.ini revision --autogenerate + docker compose run --build backend alembic -c src/backend/alembic.ini revision --autogenerate -m "$(message)" .PHONY: migrate migrate: @@ -100,19 +100,19 @@ win-first-run: .PHONY: format-web format-web: - cd src/interfaces/coral_web && npm run format:write + cd src/interfaces/assistants_web && npm run format:write .PHONY: generate-client-web generate-client-web: - cd src/interfaces/coral_web && npm run generate:client && npm run format:write + cd src/interfaces/assistants_web && npm run generate:client && npm run format:write .PHONY: install-web install-web: - cd src/interfaces/coral_web && npm install + cd src/interfaces/assistants_web && npm install .PHONY: build-web build-web: - cd src/interfaces/coral_web && npm run build + cd src/interfaces/assistants_web && npm run build .PHONY: test-db test-db: diff --git a/docker-compose.yml b/docker-compose.yml index 878d6ffadd..68e22f2435 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -141,7 +141,7 @@ services: frontend: build: target: ${BUILD_TARGET:-prod} - context: ./src/interfaces/coral_web + context: ./src/interfaces/assistants_web dockerfile: Dockerfile # Set environment variables directly in the docker-compose file environment: @@ -158,7 +158,7 @@ services: develop: watch: - action: sync - path: ./src/interfaces/coral_web + path: ./src/interfaces/assistants_web target: /app ignore: - node_modules/ diff --git a/docker_scripts/functions b/docker_scripts/functions index ceb4d2c94d..658edb87c1 100644 --- a/docker_scripts/functions +++ b/docker_scripts/functions @@ -270,14 +270,14 @@ run_backend_poetry() { } run_frontend_proxy() { - cd /workspace/src/interfaces/coral_web + cd /workspace/src/interfaces/assistants_web echo "Starting Frontend..." pm2 start npm -- run -- start:single-docker-proxy echo "Frontend started..." } run_frontend() { - cd /workspace/src/interfaces/coral_web + cd /workspace/src/interfaces/assistants_web echo "Building Frontend" npm run next:build echo "Starting Frontend..." diff --git a/src/backend/alembic/versions/2024_08_21_08bcb9a24d9b_remove_file_path.py b/src/backend/alembic/versions/2024_08_21_08bcb9a24d9b_remove_file_path.py new file mode 100644 index 0000000000..13d7518f68 --- /dev/null +++ b/src/backend/alembic/versions/2024_08_21_08bcb9a24d9b_remove_file_path.py @@ -0,0 +1,29 @@ +"""Remove file path + +Revision ID: 08bcb9a24d9b +Revises: c301506b3676 +Create Date: 2024-08-21 15:59:18.678457 + +""" +from typing import Sequence, Union + +import sqlalchemy as sa +from alembic import op + +# revision identifiers, used by Alembic. +revision: str = '08bcb9a24d9b' +down_revision: Union[str, None] = 'c301506b3676' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('files', 'file_path') + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('files', sa.Column('file_path', sa.VARCHAR(), autoincrement=False, nullable=False)) + # ### end Alembic commands ### diff --git a/src/backend/chat/custom/tool_calls.py b/src/backend/chat/custom/tool_calls.py index e10fa5b713..d07732d6e3 100644 --- a/src/backend/chat/custom/tool_calls.py +++ b/src/backend/chat/custom/tool_calls.py @@ -78,7 +78,16 @@ async def _call_tool_async( ) -> List[Dict[str, Any]]: tool = AVAILABLE_TOOLS.get(tool_call["name"]) if not tool: - return [] + logger.info( + event=f"[Custom Chat] Tool not included in tools parameter: {tool_call['name']}", + ) + outputs = [ + { + "call": tool_call, + "outputs": [{"text": f"Tool {tool_call['name']} not found", "success": False}], + } + ] + return outputs try: outputs = await tool.implementation().call( diff --git a/src/backend/config/settings.py b/src/backend/config/settings.py index 5512b054f3..63f92a2453 100644 --- a/src/backend/config/settings.py +++ b/src/backend/config/settings.py @@ -146,7 +146,7 @@ class CompassSettings(BaseSettings, BaseModel): ) -class WebSearchSettings(BaseSettings, BaseModel): +class TavilySearchSettings(BaseSettings, BaseModel): model_config = SETTINGS_CONFIG api_key: Optional[str] = Field( default=None, validation_alias=AliasChoices("TAVILY_API_KEY", "api_key") @@ -185,7 +185,7 @@ class ToolSettings(BaseSettings, BaseModel): python_interpreter: Optional[PythonToolSettings] = Field( default=PythonToolSettings() ) - web_search: Optional[WebSearchSettings] = Field(default=WebSearchSettings()) + tavily: Optional[TavilySearchSettings] = Field(default=TavilySearchSettings()) wolfram_alpha: Optional[WolframAlphaSettings] = Field( default=WolframAlphaSettings() ) diff --git a/src/backend/crud/agent_tool_metadata.py b/src/backend/crud/agent_tool_metadata.py index 43c3518c5b..6db3f58f8c 100644 --- a/src/backend/crud/agent_tool_metadata.py +++ b/src/backend/crud/agent_tool_metadata.py @@ -25,7 +25,7 @@ def create_agent_tool_metadata( def get_agent_tool_metadata_by_id( db: Session, agent_tool_metadata_id: str -) -> AgentToolMetadata: +) -> AgentToolMetadata | None: """ Get a agent tool metadata by its ID. @@ -61,6 +61,35 @@ def get_all_agent_tool_metadata_by_agent_id( ) +def get_agent_tool_metadata( + db: Session, + agent_id: str, + tool_name: str, + user_id: str, +) -> AgentToolMetadata | None: + """ + Get a agent tool metadata. + + Args: + db (Session): Database session. + agent_id (str): Agent ID. + tool_name (str): Tool name. + user_id (str): User ID. + + Returns: + AgentToolMetadata: Agent tool metadata. + """ + return ( + db.query(AgentToolMetadata) + .filter( + AgentToolMetadata.agent_id == agent_id, + AgentToolMetadata.tool_name == tool_name, + AgentToolMetadata.user_id == user_id, + ) + .first() + ) + + def update_agent_tool_metadata( db: Session, agent_tool_metadata: AgentToolMetadata, diff --git a/src/backend/database_models/file.py b/src/backend/database_models/file.py index 522971e640..6ce4b1f81c 100644 --- a/src/backend/database_models/file.py +++ b/src/backend/database_models/file.py @@ -9,7 +9,6 @@ class File(Base): user_id: Mapped[str] = mapped_column(String, nullable=True) file_name: Mapped[str] - file_path: Mapped[str] file_size: Mapped[int] = mapped_column(default=0) file_content: Mapped[str] = mapped_column(default="") diff --git a/src/backend/model_deployments/bedrock.py b/src/backend/model_deployments/bedrock.py index adb1f5a1fe..dd288556bf 100644 --- a/src/backend/model_deployments/bedrock.py +++ b/src/backend/model_deployments/bedrock.py @@ -33,10 +33,6 @@ class BedrockDeployment(BaseDeployment): def __init__(self, **kwargs: Any): self.client = cohere.BedrockClient( - # TODO: remove hardcoded models once the SDK is updated - chat_model="cohere.command-r-plus-v1:0", - embed_model="cohere.embed-multilingual-v3", - generate_model="cohere.command-text-v14", aws_access_key=get_model_config_var( BEDROCK_ACCESS_KEY_ENV_VAR, BedrockDeployment.access_key, **kwargs ), diff --git a/src/backend/routers/agent.py b/src/backend/routers/agent.py index 4f01b3e180..8b57be96ff 100644 --- a/src/backend/routers/agent.py +++ b/src/backend/routers/agent.py @@ -138,7 +138,7 @@ async def create_agent( } ) if file_ids: - await consolidate_agent_files_in_compass(file_ids, created_agent.id) + await consolidate_agent_files_in_compass(file_ids, created_agent.id, ctx) if deployment_db and model_db: deployment_config = ( @@ -384,6 +384,43 @@ async def update_agent( return agent +@router.delete("/{agent_id}", response_model=DeleteAgent) +async def delete_agent( + agent_id: str, + session: DBSessionDep, + ctx: Context = Depends(get_context), +) -> DeleteAgent: + """ + Delete an agent by ID. + + Args: + agent_id (str): Agent ID. + session (DBSessionDep): Database session. + ctx (Context): Context object. + + Returns: + DeleteAgent: Empty response. + + Raises: + HTTPException: If the agent with the given ID is not found. + """ + user_id = ctx.get_user_id() + ctx.with_event_type(MetricsMessageType.ASSISTANT_DELETED) + agent = validate_agent_exists(session, agent_id, user_id) + agent_schema = Agent.model_validate(agent) + ctx.with_agent(agent_schema) + ctx.with_metrics_agent(agent_to_metrics_agent(agent)) + + deleted = agent_crud.delete_agent(session, agent_id, user_id) + if not deleted: + raise HTTPException(status_code=401, detail="Could not delete Agent.") + + return DeleteAgent() + + +# Agent Tool Metadata endpoints + + async def handle_tool_metadata_update( agent: Agent, new_agent: Agent, @@ -453,43 +490,6 @@ async def update_or_create_tool_metadata( create_agent_tool_metadata(session, agent.id, create_metadata_req, ctx) -@router.delete("/{agent_id}", response_model=DeleteAgent) -async def delete_agent( - agent_id: str, - session: DBSessionDep, - ctx: Context = Depends(get_context), -) -> DeleteAgent: - """ - Delete an agent by ID. - - Args: - agent_id (str): Agent ID. - session (DBSessionDep): Database session. - ctx (Context): Context object. - - Returns: - DeleteAgent: Empty response. - - Raises: - HTTPException: If the agent with the given ID is not found. - """ - user_id = ctx.get_user_id() - ctx.with_event_type(MetricsMessageType.ASSISTANT_DELETED) - agent = validate_agent_exists(session, agent_id, user_id) - agent_schema = Agent.model_validate(agent) - ctx.with_agent(agent_schema) - ctx.with_metrics_agent(agent_to_metrics_agent(agent)) - - deleted = agent_crud.delete_agent(session, agent_id, user_id) - if not deleted: - raise HTTPException(status_code=401, detail="Could not delete Agent.") - - return DeleteAgent() - - -# Tool Metadata Endpoints - - @router.get("/{agent_id}/tool-metadata", response_model=list[AgentToolMetadataPublic]) async def list_agent_tool_metadata( agent_id: str, session: DBSessionDep, ctx: Context = Depends(get_context) @@ -539,7 +539,7 @@ def create_agent_tool_metadata( ctx (Context): Context object. Returns: - AgentToolMetadata: Created agent tool metadata. + AgentToolMetadataPublic: Created agent tool metadata. Raises: HTTPException: If the agent tool metadata creation fails. diff --git a/src/backend/schemas/file.py b/src/backend/schemas/file.py index ec66475848..6ca9cf114b 100644 --- a/src/backend/schemas/file.py +++ b/src/backend/schemas/file.py @@ -1,4 +1,5 @@ import datetime +from typing import Optional from pydantic import BaseModel, Field @@ -9,10 +10,9 @@ class File(BaseModel): updated_at: datetime.datetime user_id: str - conversation_id: str - file_content: str + conversation_id: Optional[str] = "" + file_content: Optional[str] = "" file_name: str - file_path: str file_size: int = Field(default=0, ge=0) class Config: @@ -26,7 +26,6 @@ class ConversationFilePublic(BaseModel): conversation_id: str file_name: str - file_path: str file_size: int = Field(default=0, ge=0) @@ -37,7 +36,6 @@ class AgentFilePublic(BaseModel): updated_at: datetime.datetime file_name: str - file_path: str file_size: int = Field(default=0, ge=0) class ListConversationFile(ConversationFilePublic): diff --git a/src/backend/services/chat.py b/src/backend/services/chat.py index 515497aae6..e3aa5830da 100644 --- a/src/backend/services/chat.py +++ b/src/backend/services/chat.py @@ -44,7 +44,6 @@ StreamToolResult, ToolInputType, ) -from backend.schemas.cohere_chat import CohereChatRequest from backend.schemas.context import Context from backend.schemas.conversation import UpdateConversationRequest from backend.schemas.search_query import SearchQuery @@ -86,17 +85,12 @@ def process_chat( status_code=404, detail=f"Agent with ID {agent_id} not found." ) - if chat_request.tools: - for tool in chat_request.tools: - if tool.name not in agent.tools: - raise HTTPException( - status_code=404, - detail=f"Tool {tool.name} not found in agent {agent.id}", - ) + # if tools are not provided in the chat request, use the agent's tools + if not chat_request.tools: + chat_request.tools = [Tool(name=tool) for tool in agent.tools] # Set the agent settings in the chat request chat_request.preamble = agent.preamble - chat_request.tools = [Tool(name=tool) for tool in agent.tools] should_store = chat_request.chat_history is None and not is_custom_tool_call( chat_request @@ -132,14 +126,13 @@ def process_chat( id=str(uuid4()), ) - if isinstance(chat_request, CohereChatRequest): - if should_store: - attach_files_to_messages( - session, - user_id, - user_message.id, - chat_request.file_ids, - ) + if should_store: + attach_files_to_messages( + session, + user_id, + user_message.id, + chat_request.file_ids + ) chat_history = create_chat_history( conversation, next_message_position, chat_request diff --git a/src/backend/services/file.py b/src/backend/services/file.py index 16d19585ce..69518a6e51 100644 --- a/src/backend/services/file.py +++ b/src/backend/services/file.py @@ -68,12 +68,18 @@ def get_compass(): if compass is None: try: - compass = Compass() + compass = Compass( + compass_api_url=Settings().compass.api_url, + compass_parser_url=Settings().compass.parser_url, + compass_username=Settings().compass.username, + compass_password=Settings().compass.password, + ) except Exception as e: logger.error( event=f"[Compass File Service] Error initializing Compass: {e}" ) raise e + return compass @@ -157,7 +163,7 @@ async def create_agent_files( Since agents are created after the files are upload we index files into dummy indices first We later consolidate them in consolidate_agent_files_in_compass() to a singular index when an agent is created. """ - uploaded_files = await insert_files_in_compass(files, ctx, user_id) + uploaded_files = await insert_files_in_compass(files, user_id, ctx) else: uploaded_files = await insert_files_in_db(session, files, user_id) @@ -430,7 +436,6 @@ def get_files_in_compass( id=file_id, file_name=fetched_doc["file_name"], file_size=fetched_doc["file_size"], - file_path=fetched_doc["file_path"], file_content=fetched_doc["text"], user_id=user_id, created_at=datetime.fromisoformat(fetched_doc["created_at"]), @@ -460,12 +465,21 @@ async def consolidate_agent_files_in_compass( compass = get_compass() try: - compass.invoke( + logger.info( + event="[Compass File Service] Creating index for agent files", + agent_id=agent_id + ) + response = compass.invoke( action=Compass.ValidActions.CREATE_INDEX, parameters={ "index": agent_id, }, ) + logger.info( + event="[Compass File Service] Finished creating index for agent files", + agent_id=agent_id, + response=response + ) except Exception as e: logger.Error( event=f"[Compass File Service] Error creating index for agent files: {agent_id}, error: {e}" @@ -481,17 +495,16 @@ async def consolidate_agent_files_in_compass( action=Compass.ValidActions.GET_DOCUMENT, parameters={"index": file_id, "file_id": file_id}, ).result["doc"]["content"] - compass().invoke( + compass.invoke( action=Compass.ValidActions.CREATE, parameters={ "index": agent_id, "file_id": file_id, "file_bytes": fetched_doc["text"], - "filename": fetched_doc["file_name"], + "file_extension": get_file_extension(fetched_doc["file_name"]), "custom_context": { "file_id": file_id, "file_name": fetched_doc["file_name"], - "file_path": fetched_doc["file_path"], "file_size": fetched_doc["file_size"], "user_id": fetched_doc["user_id"], "created_at": fetched_doc["created_at"], @@ -508,7 +521,7 @@ async def consolidate_agent_files_in_compass( ) # Remove the temporary file index entry compass.invoke( - action=Compass.ValidActions.DELETE_INDEX, parameters={"index": agent_id} + action=Compass.ValidActions.DELETE_INDEX, parameters={"index": file_id} ) except Exception as e: logger.error( @@ -570,11 +583,10 @@ async def insert_files_in_compass( "index": new_file_id if index is None else index, "file_id": new_file_id, "file_bytes": file_bytes, - "filename": filename, + "file_extension": get_file_extension(filename), "custom_context": { "file_id": new_file_id, "file_name": filename, - "file_path": filename, "file_size": file.size, "user_id": user_id, "created_at": datetime.now().isoformat(), @@ -596,7 +608,6 @@ async def insert_files_in_compass( file_name=filename, id=new_file_id, file_size=file.size, - file_path=filename, user_id=user_id, created_at=datetime.now(), updated_at=datetime.now(), @@ -661,7 +672,6 @@ async def insert_files_in_db( FileModel( file_name=filename, file_size=file.size, - file_path=filename, file_content=cleaned_content, user_id=user_id, ) @@ -682,7 +692,6 @@ def attach_conversation_id_to_files( conversation_id=conversation_id, file_name=file.file_name, file_size=file.file_size, - file_path=file.file_path, user_id=file.user_id, created_at=file.created_at, updated_at=file.updated_at, diff --git a/src/backend/tests/chat/test_tool_calls.py b/src/backend/tests/unit/chat/test_tool_calls.py similarity index 98% rename from src/backend/tests/chat/test_tool_calls.py rename to src/backend/tests/unit/chat/test_tool_calls.py index a91aa55928..f425336a8f 100644 --- a/src/backend/tests/chat/test_tool_calls.py +++ b/src/backend/tests/unit/chat/test_tool_calls.py @@ -9,7 +9,7 @@ from backend.config.tools import AVAILABLE_TOOLS, ToolName from backend.schemas.tool import ManagedTool from backend.services.context import Context -from backend.tests.model_deployments.mock_deployments import MockCohereDeployment +from backend.tests.unit.model_deployments.mock_deployments import MockCohereDeployment from backend.tools.base import BaseTool diff --git a/src/backend/tests/unit/crud/test_file.py b/src/backend/tests/unit/crud/test_file.py index 7e562d026e..00102a750f 100644 --- a/src/backend/tests/unit/crud/test_file.py +++ b/src/backend/tests/unit/crud/test_file.py @@ -13,20 +13,17 @@ def conversation(session, user): def test_create_file(session, user): file_data = File( file_name="test.txt", - file_path="/tmp/test.txt", file_size=100, user_id=user.id, ) file = file_crud.create_file(session, file_data) assert file.file_name == file_data.file_name - assert file.file_path == file_data.file_path assert file.file_size == file_data.file_size assert file.user_id == file_data.user_id file = file_crud.get_file(session, file.id, user.id) assert file.file_name == file_data.file_name - assert file.file_path == file_data.file_path assert file.file_size == file_data.file_size assert file.user_id == file_data.user_id @@ -34,13 +31,11 @@ def test_create_file(session, user): def test_batch_create_files(session, user): file_data = File( file_name="test.txt", - file_path="/tmp/test.txt", file_size=100, user_id=user.id, ) file_data2 = File( file_name="test2.txt", - file_path="/tmp/test2.txt", file_size=100, user_id=user.id, ) diff --git a/src/backend/tests/unit/factories/file.py b/src/backend/tests/unit/factories/file.py index 8231b4be64..f7f0b56d13 100644 --- a/src/backend/tests/unit/factories/file.py +++ b/src/backend/tests/unit/factories/file.py @@ -11,5 +11,4 @@ class Meta: user_id = factory.Faker("uuid4") file_name = factory.Faker("file_name") - file_path = factory.Faker("file_path") file_size = factory.Faker("random_int", min=1, max=20000000) diff --git a/src/backend/tests/unit/routers/test_chat.py b/src/backend/tests/unit/routers/test_chat.py index f6ab15d855..6b74fefe54 100644 --- a/src/backend/tests/unit/routers/test_chat.py +++ b/src/backend/tests/unit/routers/test_chat.py @@ -266,7 +266,7 @@ def test_streaming_chat_with_existing_conversation_from_other_agent( def test_streaming_chat_with_tools_not_in_agent_tools( session_client_chat: TestClient, session_chat: Session, user: User ): - agent = get_factory("Agent", session_chat).create(user=user) + agent = get_factory("Agent", session_chat).create(user=user, tools=["wikipedia"]) deployment = get_factory("Deployment", session_chat).create() model = get_factory("Model", session_chat).create(deployment=deployment) get_factory("AgentDeploymentModel", session_chat).create( @@ -283,17 +283,45 @@ def test_streaming_chat_with_tools_not_in_agent_tools( "Deployment-Name": agent.deployment, }, json={ - "message": "Hello", - "max_tokens": 10, + "message": "Who is a tallest nba player", "tools": [{"name": "web_search"}], "agent_id": agent.id, }, ) - assert response.status_code == 404 - assert response.json() == { - "detail": f"Tool web_search not found in agent {agent.id}" - } + assert response.status_code == 200 + validate_chat_streaming_tool_cals_response(response, ["web_search"]) + + +@pytest.mark.skipif(not is_cohere_env_set, reason="Cohere API key not set") +def test_streaming_chat_with_agent_tools_and_empty_request_tools( + session_client_chat: TestClient, session_chat: Session, user: User +): + agent = get_factory("Agent", session_chat).create(user=user, tools=["web_search"]) + deployment = get_factory("Deployment", session_chat).create() + model = get_factory("Model", session_chat).create(deployment=deployment) + get_factory("AgentDeploymentModel", session_chat).create( + agent=agent, + deployment=deployment, + model=model, + is_default_deployment=True, + is_default_model=True, + ) + response = session_client_chat.post( + "/v1/chat-stream", + headers={ + "User-Id": agent.user.id, + "Deployment-Name": agent.deployment, + }, + json={ + "message": "Who is a tallest NBA player", + "tools": [], + "agent_id": agent.id, + }, + ) + + assert response.status_code == 200 + validate_chat_streaming_tool_cals_response(response, ["web_search"]) @pytest.mark.skipif(not is_cohere_env_set, reason="Cohere API key not set") @@ -1065,6 +1093,26 @@ def validate_stream_end_event( return data["conversation_id"] +def validate_chat_streaming_tool_cals_response(response: Any, tools: list) -> None: + data = [] + for line in response.iter_lines(): + if not line or ":ping" in line or ": ping" in line: + continue + + # remove the 'data' prefix to make it a valid JSON + line = line.replace("data: ", "") + if "event" in line: + response_json = json.loads(line) + assert response_json["event"] in [e.value for e in StreamEvent] + if response_json["event"] == StreamEvent.TOOL_CALLS_GENERATION: + data.append(response_json["data"]) + + tool_calls_names = [tool['name'] for entry in data for tool in entry['tool_calls']] + + # Check if all required tools are in the tool_names + assert all(tool in tool_calls_names for tool in tools) + + def is_valid_uuid(id: str) -> bool: try: uuid.UUID(id, version=4) diff --git a/src/backend/tools/files.py b/src/backend/tools/files.py index 8b50cb9abf..c153bdbc00 100644 --- a/src/backend/tools/files.py +++ b/src/backend/tools/files.py @@ -33,38 +33,36 @@ def compass_file_search( for file_id in file_ids ] + compass = get_compass() + # Search conversation ID index - hits = ( - get_compass() - .invoke( + search_results = compass.invoke( action=Compass.ValidActions.SEARCH, parameters={ "index": conversation_id, "query": query, "top_k": search_limit, "filters": search_filters, - }, - ) - .result["hits"] + }, ) - results.extend(hits) + + if search_results.result: + results.extend(search_results.result["hits"]) # Search agent ID index if agent_id: - hits = ( - get_compass() - .invoke( - action=Compass.ValidActions.SEARCH, - parameters={ - "index": agent_id, - "query": query, - "top_k": search_limit, - "filters": search_filters, - }, - ) - .result["hits"] + search_results = compass.invoke( + action=Compass.ValidActions.SEARCH, + parameters={ + "index": agent_id, + "query": query, + "top_k": search_limit, + "filters": search_filters, + }, ) - results.extend(hits) + + if search_results.result: + results.extend(search_results.result["hits"]) chunks = sorted( [ diff --git a/src/backend/tools/tavily.py b/src/backend/tools/tavily.py index de2bfac4e4..52a20f6019 100644 --- a/src/backend/tools/tavily.py +++ b/src/backend/tools/tavily.py @@ -4,28 +4,65 @@ from tavily import TavilyClient from backend.config.settings import Settings +from backend.crud import agent_tool_metadata as agent_tool_metadata_crud +from backend.database_models.database import DBSessionDep from backend.model_deployments.base import BaseDeployment +from backend.schemas.context import Context from backend.tools.base import BaseTool class TavilyInternetSearch(BaseTool): NAME = "web_search" - TAVILY_API_KEY = Settings().tools.web_search.api_key + TAVILY_API_KEY = Settings().tools.tavily.api_key + POST_RERANK_MAX_RESULTS = 6 def __init__(self): self.client = TavilyClient(api_key=self.TAVILY_API_KEY) - self.num_results = 6 @classmethod def is_available(cls) -> bool: return cls.TAVILY_API_KEY is not None + def get_filtered_domains(self, session: DBSessionDep, ctx: Context) -> list[str]: + agent_id = ctx.get_agent_id() + user_id = ctx.get_user_id() + + if not agent_id or not user_id: + # Default for Tavily is None + return [] + + agent_tool_metadata = agent_tool_metadata_crud.get_agent_tool_metadata( + db=session, + agent_id=agent_id, + tool_name=self.NAME, + user_id=user_id, + ) + + if not agent_tool_metadata: + # Default for Tavily is None + return [] + + return [ + artifact["domain"] + for artifact in agent_tool_metadata.artifacts + if "domain" in artifact + ] + async def call( - self, parameters: dict, ctx: Any, **kwargs: Any + self, parameters: dict, ctx: Any, session: DBSessionDep, **kwargs: Any ) -> List[Dict[str, Any]]: + # Gather search parameters query = parameters.get("query", "") + # Get domains set on Agent tool metadata artifacts + filter_domains = None + domains = self.get_filtered_domains(session, ctx) + + if domains: + filter_domains = domains + + # Do search result = self.client.search( - query=query, search_depth="advanced", include_raw_content=True + query=query, search_depth="advanced", include_raw_content=True, include_domains=filter_domains ) if "results" not in result: @@ -96,14 +133,14 @@ async def rerank_page_snippets( seen_urls.append(result["url"]) reranked.append(result) - return reranked[: self.num_results] + return reranked[:self.POST_RERANK_MAX_RESULTS] def to_langchain_tool(self) -> TavilySearchResults: internet_search = TavilySearchResults() internet_search.name = "internet_search" internet_search.description = "Returns a list of relevant document snippets for a textual query retrieved from the internet." - # pydantic v1 base model + # Pydantic v1 base model from langchain_core.pydantic_v1 import BaseModel, Field class TavilySearchInput(BaseModel): diff --git a/src/interfaces/assistants_web/.storybook/preview.tsx b/src/interfaces/assistants_web/.storybook/preview.tsx index 29e0c9a914..91bcab9569 100644 --- a/src/interfaces/assistants_web/.storybook/preview.tsx +++ b/src/interfaces/assistants_web/.storybook/preview.tsx @@ -2,7 +2,7 @@ import type { Preview } from '@storybook/react'; import { ThemeProvider } from 'next-themes'; import React from 'react'; -import '../src/styles/main.css'; +import '@/styles/main.css'; const preview: Preview = { decorators: [ diff --git a/src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/CompleteOauth.tsx b/src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/OauthCallback.tsx similarity index 88% rename from src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/CompleteOauth.tsx rename to src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/OauthCallback.tsx index facaad3c59..1c4e326c8e 100644 --- a/src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/CompleteOauth.tsx +++ b/src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/OauthCallback.tsx @@ -3,15 +3,14 @@ import { useParams, useRouter, useSearchParams } from 'next/navigation'; import { useEffect } from 'react'; -import { Text } from '@/components/Shared'; -import { useAuthConfig } from '@/hooks/authConfig'; -import { useSession } from '@/hooks/session'; +import { Text } from '@/components/UI'; +import { useAuthConfig, useSession } from '@/hooks'; import { getQueryString } from '@/utils'; /** * @description This page handles callbacks from OAuth providers and forwards the request to the backend. */ -const CompleteOauth: React.FC = () => { +const OauthCallback: React.FC = () => { const router = useRouter(); const params = useParams(); const search = useSearchParams(); @@ -72,4 +71,4 @@ const CompleteOauth: React.FC = () => { ); }; -export default CompleteOauth; +export default OauthCallback; diff --git a/src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/page.tsx b/src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/page.tsx index 17dea70e53..9b8173f8f4 100644 --- a/src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/page.tsx +++ b/src/interfaces/assistants_web/src/app/(auth)/auth/[strategy]/page.tsx @@ -1,14 +1,14 @@ import { NextPage } from 'next'; import { Suspense } from 'react'; -import CompleteOauth from './CompleteOauth'; +import OauthCallback from './OauthCallback'; -const CompleteOauthPage: NextPage = () => { +const OauthCallbackPage: NextPage = () => { return ( - + ); }; -export default CompleteOauthPage; +export default OauthCallbackPage; diff --git a/src/interfaces/assistants_web/src/app/(auth)/layout.tsx b/src/interfaces/assistants_web/src/app/(auth)/layout.tsx index 4f5756bde9..42bea08ac4 100644 --- a/src/interfaces/assistants_web/src/app/(auth)/layout.tsx +++ b/src/interfaces/assistants_web/src/app/(auth)/layout.tsx @@ -1,4 +1,4 @@ -import { WelcomePage } from '@/components/WelcomePage'; +import { WelcomePage } from '@/components/Auth'; const AuthLayout: React.FC = ({ children }) => { return {children}; diff --git a/src/interfaces/assistants_web/src/app/(auth)/login/Login.tsx b/src/interfaces/assistants_web/src/app/(auth)/login/Login.tsx index 799e2fc26f..bf5260f9a0 100644 --- a/src/interfaces/assistants_web/src/app/(auth)/login/Login.tsx +++ b/src/interfaces/assistants_web/src/app/(auth)/login/Login.tsx @@ -5,13 +5,9 @@ import { useMemo, useState } from 'react'; import { SubmitHandler, useForm } from 'react-hook-form'; import { CohereUnauthorizedError, ListAuthStrategy } from '@/cohere-client'; -import { AuthLink } from '@/components/AuthLink'; -import { Button, Input, Text } from '@/components/Shared'; -import { OidcSSOButton } from '@/components/Welcome/OidcSSOButton'; -import { useAuthConfig } from '@/hooks/authConfig'; -import { useOidcAuthRoute } from '@/hooks/oidcAuthRoute'; -import { useSession } from '@/hooks/session'; -import { useNotify } from '@/hooks/toast'; +import { AuthLink, OidcSSOButton } from '@/components/Auth'; +import { Button, Input, Text } from '@/components/UI'; +import { useAuthConfig, useNotify, useOidcAuthRoute, useSession } from '@/hooks'; import type { NoNullProperties } from '@/types/util'; import { getQueryString, simpleEmailValidation } from '@/utils'; diff --git a/src/interfaces/assistants_web/src/app/(auth)/logout/Logout.tsx b/src/interfaces/assistants_web/src/app/(auth)/logout/Logout.tsx index c42d276f07..59c7269bea 100644 --- a/src/interfaces/assistants_web/src/app/(auth)/logout/Logout.tsx +++ b/src/interfaces/assistants_web/src/app/(auth)/logout/Logout.tsx @@ -3,8 +3,8 @@ import { useRouter } from 'next/navigation'; import { useEffect } from 'react'; -import { Text } from '@/components/Shared'; -import { useSession } from '@/hooks/session'; +import { Text } from '@/components/UI'; +import { useSession } from '@/hooks'; /** * @description The login page supports logging in with an email and password. diff --git a/src/interfaces/assistants_web/src/app/(auth)/register/Register.tsx b/src/interfaces/assistants_web/src/app/(auth)/register/Register.tsx index 27eec2a8d0..b3fe361493 100644 --- a/src/interfaces/assistants_web/src/app/(auth)/register/Register.tsx +++ b/src/interfaces/assistants_web/src/app/(auth)/register/Register.tsx @@ -3,9 +3,9 @@ import { useRouter, useSearchParams } from 'next/navigation'; import { SubmitHandler, useForm } from 'react-hook-form'; -import { AuthLink } from '@/components/AuthLink'; -import { Button, Input, Text } from '@/components/Shared'; -import { useSession } from '@/hooks/session'; +import { AuthLink } from '@/components/Auth'; +import { Button, Input, Text } from '@/components/UI'; +import { useSession } from '@/hooks'; import { getQueryString, simpleEmailValidation } from '@/utils'; interface Credentials { diff --git a/src/interfaces/assistants_web/src/app/(main)/(chat)/Chat.tsx b/src/interfaces/assistants_web/src/app/(main)/(chat)/Chat.tsx index 684a51c8e3..32a350336e 100644 --- a/src/interfaces/assistants_web/src/app/(main)/(chat)/Chat.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/(chat)/Chat.tsx @@ -3,16 +3,17 @@ import { useEffect } from 'react'; import { Document, ManagedTool } from '@/cohere-client'; -import Conversation from '@/components/Conversation'; -import { ConversationError } from '@/components/ConversationError'; +import { Conversation, ConversationError } from '@/components/Conversation'; import { TOOL_PYTHON_INTERPRETER_ID } from '@/constants'; -import { useAgent } from '@/hooks/agents'; -import { useConversation } from '@/hooks/conversation'; -import { useListTools } from '@/hooks/tools'; +import { useAgent, useConversation, useListTools } from '@/hooks'; import { useCitationsStore, useConversationStore, useParamsStore } from '@/stores'; import { OutputFiles } from '@/stores/slices/citationsSlice'; -import { createStartEndKey, fixCitationsLeadingMarkdown, mapHistoryToMessages } from '@/utils'; -import { parsePythonInterpreterToolFields } from '@/utils/tools'; +import { + createStartEndKey, + fixInlineCitationsForMarkdown, + mapHistoryToMessages, + parsePythonInterpreterToolFields, +} from '@/utils'; const Chat: React.FC<{ agentId?: string; conversationId?: string }> = ({ agentId, @@ -85,7 +86,7 @@ const Chat: React.FC<{ agentId?: string; conversationId?: string }> = ({ } } }); - fixCitationsLeadingMarkdown(message.citations, message.text)?.forEach((citation) => { + fixInlineCitationsForMarkdown(message.citations, message.text)?.forEach((citation) => { const startEndKey = createStartEndKey(citation.start ?? 0, citation.end ?? 0); const documents = citation.document_ids?.map((id) => documentsMap[id]) ?? []; addCitation(message.generation_id ?? '', startEndKey, documents); diff --git a/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/c/[conversationId]/loading.tsx b/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/c/[conversationId]/loading.tsx index ecbdeb6758..642f13c4da 100644 --- a/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/c/[conversationId]/loading.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/c/[conversationId]/loading.tsx @@ -1,4 +1,4 @@ -import { Spinner } from '@/components/Shared'; +import { Spinner } from '@/components/UI'; const Loading: React.FC = () => { return ( diff --git a/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/loading.tsx b/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/loading.tsx index ecbdeb6758..642f13c4da 100644 --- a/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/loading.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/(chat)/a/[agentId]/loading.tsx @@ -1,4 +1,4 @@ -import { Spinner } from '@/components/Shared'; +import { Spinner } from '@/components/UI'; const Loading: React.FC = () => { return ( diff --git a/src/interfaces/assistants_web/src/app/(main)/(chat)/c/[conversationId]/loading.tsx b/src/interfaces/assistants_web/src/app/(main)/(chat)/c/[conversationId]/loading.tsx index ecbdeb6758..642f13c4da 100644 --- a/src/interfaces/assistants_web/src/app/(main)/(chat)/c/[conversationId]/loading.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/(chat)/c/[conversationId]/loading.tsx @@ -1,4 +1,4 @@ -import { Spinner } from '@/components/Shared'; +import { Spinner } from '@/components/UI'; const Loading: React.FC = () => { return ( diff --git a/src/interfaces/assistants_web/src/app/(main)/(chat)/layout.tsx b/src/interfaces/assistants_web/src/app/(main)/(chat)/layout.tsx index 99b30115fa..b025aaf889 100644 --- a/src/interfaces/assistants_web/src/app/(main)/(chat)/layout.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/(chat)/layout.tsx @@ -3,9 +3,8 @@ import { Transition } from '@headlessui/react'; import { useEffect } from 'react'; -import RightPanel from '@/components/Agents/RightPanel'; -import { useIsDesktop } from '@/hooks/breakpoint'; -import { useListAllDeployments } from '@/hooks/deployments'; +import { ConversationPanel } from '@/components/Conversation'; +import { useIsDesktop, useListAllDeployments } from '@/hooks'; import { useConversationStore, useParamsStore, useSettingsStore } from '@/stores'; import { cn } from '@/utils'; @@ -55,7 +54,7 @@ const ChatLayout: React.FC = ({ children }) => { leaveFrom="translate-x-0 opacity-100" leaveTo="translate-x-full opacity-0" > - + ); diff --git a/src/interfaces/assistants_web/src/components/Agents/DiscoverAgentCard.tsx b/src/interfaces/assistants_web/src/app/(main)/discover/DiscoverAgentCard.tsx similarity index 88% rename from src/interfaces/assistants_web/src/components/Agents/DiscoverAgentCard.tsx rename to src/interfaces/assistants_web/src/app/(main)/discover/DiscoverAgentCard.tsx index a14c8b9a60..89ebb38bbd 100644 --- a/src/interfaces/assistants_web/src/components/Agents/DiscoverAgentCard.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/discover/DiscoverAgentCard.tsx @@ -3,14 +3,11 @@ import Link from 'next/link'; import { AgentPublic } from '@/cohere-client'; -import { DeleteAgent } from '@/components/Agents/DeleteAgent'; -import { KebabMenu } from '@/components/KebabMenu'; -import { CoralLogo, Text } from '@/components/Shared'; +import { DeleteAgent } from '@/components/Modals/DeleteAgent'; +import { CoralLogo, KebabMenu, Text } from '@/components/UI'; import { useContextStore } from '@/context'; -import { useBrandedColors } from '@/hooks/brandedColors'; -import { useSession } from '@/hooks/session'; -import { cn } from '@/utils'; -import { checkIsBaseAgent } from '@/utils/agents'; +import { useBrandedColors, useSession } from '@/hooks'; +import { checkIsBaseAgent, cn } from '@/utils'; type Props = { agent?: AgentPublic; diff --git a/src/interfaces/assistants_web/src/components/Agents/DiscoverAgents.tsx b/src/interfaces/assistants_web/src/app/(main)/discover/DiscoverAgents.tsx similarity index 93% rename from src/interfaces/assistants_web/src/components/Agents/DiscoverAgents.tsx rename to src/interfaces/assistants_web/src/app/(main)/discover/DiscoverAgents.tsx index df507cf717..4d864104de 100644 --- a/src/interfaces/assistants_web/src/components/Agents/DiscoverAgents.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/discover/DiscoverAgents.tsx @@ -3,14 +3,13 @@ import { useDeferredValue, useMemo, useState } from 'react'; import { AgentPublic, ConversationWithoutMessages } from '@/cohere-client'; -import { DiscoverAgentCard } from '@/components/Agents/DiscoverAgentCard'; -import { MobileHeader } from '@/components/MobileHeader'; -import { Button, Input, Text } from '@/components/Shared'; -import { useListAgents } from '@/hooks/agents'; -import { useConversations } from '@/hooks/conversation'; -import { useSession } from '@/hooks/session'; +import { MobileHeader } from '@/components/Global'; +import { Button, Input, Text } from '@/components/UI'; +import { useConversations, useListAgents, useSession } from '@/hooks'; import { cn } from '@/utils'; +import { DiscoverAgentCard } from './DiscoverAgentCard'; + const GROUPED_ASSISTANTS_LIMIT = 15; export const DiscoverAgents = () => { diff --git a/src/interfaces/assistants_web/src/app/(main)/discover/page.tsx b/src/interfaces/assistants_web/src/app/(main)/discover/page.tsx index cfa519c495..dfdf9f2f85 100644 --- a/src/interfaces/assistants_web/src/app/(main)/discover/page.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/discover/page.tsx @@ -1,6 +1,6 @@ import { Metadata } from 'next'; -import { DiscoverAgents } from '@/components/Agents/DiscoverAgents'; +import { DiscoverAgents } from './DiscoverAgents'; export const metadata: Metadata = { title: 'Discover Assistants', diff --git a/src/interfaces/assistants_web/src/components/Agents/UpdateAgent.tsx b/src/interfaces/assistants_web/src/app/(main)/edit/[agentId]/UpdateAgent.tsx similarity index 87% rename from src/interfaces/assistants_web/src/components/Agents/UpdateAgent.tsx rename to src/interfaces/assistants_web/src/app/(main)/edit/[agentId]/UpdateAgent.tsx index 6a8b7e63f2..91a5551e5c 100644 --- a/src/interfaces/assistants_web/src/components/Agents/UpdateAgent.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/edit/[agentId]/UpdateAgent.tsx @@ -4,17 +4,13 @@ import Link from 'next/link'; import React, { useState } from 'react'; import { AgentPublic } from '@/cohere-client'; -import { - AgentSettingsFields, - AgentSettingsForm, -} from '@/components/Agents/AgentSettings/AgentSettingsForm'; -import { DeleteAgent } from '@/components/Agents/DeleteAgent'; -import { MobileHeader } from '@/components/MobileHeader'; -import { Button, Icon, Spinner, Text } from '@/components/Shared'; +import { AgentSettingsFields, AgentSettingsForm } from '@/components/AgentSettingsForm'; +import { MobileHeader } from '@/components/Global'; +import { DeleteAgent } from '@/components/Modals/DeleteAgent'; +import { Button, Icon, Spinner, Text } from '@/components/UI'; import { DEFAULT_AGENT_MODEL, DEPLOYMENT_COHERE_PLATFORM } from '@/constants'; import { useContextStore } from '@/context'; -import { useIsAgentNameUnique, useUpdateAgent } from '@/hooks/agents'; -import { useNotify } from '@/hooks/toast'; +import { useIsAgentNameUnique, useNotify, useUpdateAgent } from '@/hooks'; type Props = { agent: AgentPublic; @@ -65,7 +61,7 @@ export const UpdateAgent: React.FC = ({ agent }) => { }; return ( -
+
diff --git a/src/interfaces/assistants_web/src/app/(main)/edit/[agentId]/page.tsx b/src/interfaces/assistants_web/src/app/(main)/edit/[agentId]/page.tsx index 8776e588f6..a41be96c39 100644 --- a/src/interfaces/assistants_web/src/app/(main)/edit/[agentId]/page.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/edit/[agentId]/page.tsx @@ -1,6 +1,6 @@ import { NextPage } from 'next'; -import { UpdateAgent } from '@/components/Agents/UpdateAgent'; +import { UpdateAgent } from './UpdateAgent'; import { getCohereServerClient } from '@/server/cohereServerClient'; type Props = { diff --git a/src/interfaces/assistants_web/src/app/(main)/layout.tsx b/src/interfaces/assistants_web/src/app/(main)/layout.tsx index 80eaf3ad45..e5112cd503 100644 --- a/src/interfaces/assistants_web/src/app/(main)/layout.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/layout.tsx @@ -3,9 +3,9 @@ import { NextPage } from 'next'; import { cookies } from 'next/headers'; import { redirect } from 'next/navigation'; -import { LeftPanel } from '@/components/Agents/LeftPanel'; -import { HotKeys } from '@/components/Shared/HotKeys'; -import { Swipeable } from '@/components/Swipeable'; +import { Swipeable } from '@/components/Global'; +import { HotKeys } from '@/components/HotKeys'; +import { SideNavPanel } from '@/components/SideNavPanel'; import { COOKIE_KEYS, DEFAULT_AGENT_TOOLS } from '@/constants'; import { getCohereServerClient } from '@/server/cohereServerClient'; @@ -48,7 +48,7 @@ const MainLayout: NextPage = async ({ children }) => {
- +
@@ -56,7 +56,7 @@ const MainLayout: NextPage = async ({ children }) => {
- +
); }; diff --git a/src/interfaces/assistants_web/src/app/(main)/loading.tsx b/src/interfaces/assistants_web/src/app/(main)/loading.tsx index ecbdeb6758..642f13c4da 100644 --- a/src/interfaces/assistants_web/src/app/(main)/loading.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/loading.tsx @@ -1,4 +1,4 @@ -import { Spinner } from '@/components/Shared'; +import { Spinner } from '@/components/UI'; const Loading: React.FC = () => { return ( diff --git a/src/interfaces/assistants_web/src/components/Agents/CreateAgent.tsx b/src/interfaces/assistants_web/src/app/(main)/new/CreateAgent.tsx similarity index 88% rename from src/interfaces/assistants_web/src/components/Agents/CreateAgent.tsx rename to src/interfaces/assistants_web/src/app/(main)/new/CreateAgent.tsx index 94d8ece187..67ff7731e3 100644 --- a/src/interfaces/assistants_web/src/components/Agents/CreateAgent.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/new/CreateAgent.tsx @@ -5,12 +5,9 @@ import Link from 'next/link'; import { useRouter } from 'next/navigation'; import React, { useState } from 'react'; -import { - AgentSettingsFields, - AgentSettingsForm, -} from '@/components/Agents//AgentSettings/AgentSettingsForm'; -import { MobileHeader } from '@/components/MobileHeader'; -import { Button, Icon, Text } from '@/components/Shared'; +import { AgentSettingsFields, AgentSettingsForm } from '@/components/AgentSettingsForm'; +import { MobileHeader } from '@/components/Global'; +import { Button, Icon, Text } from '@/components/UI'; import { DEFAULT_AGENT_MODEL, DEFAULT_AGENT_TOOLS, @@ -18,8 +15,7 @@ import { DEPLOYMENT_COHERE_PLATFORM, } from '@/constants'; import { useContextStore } from '@/context'; -import { useCreateAgent } from '@/hooks/agents'; -import { useNotify } from '@/hooks/toast'; +import { useCreateAgent, useNotify } from '@/hooks'; const DEFAULT_FIELD_VALUES = { name: '', @@ -77,7 +73,7 @@ export const CreateAgent: React.FC = () => { }; return ( -
+
diff --git a/src/interfaces/assistants_web/src/app/(main)/new/page.tsx b/src/interfaces/assistants_web/src/app/(main)/new/page.tsx index 28d642b0e4..1a48ab8ea6 100644 --- a/src/interfaces/assistants_web/src/app/(main)/new/page.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/new/page.tsx @@ -1,6 +1,6 @@ import { Metadata } from 'next'; -import { CreateAgent } from '@/components/Agents/CreateAgent'; +import { CreateAgent } from './CreateAgent'; export const metadata: Metadata = { title: 'New Assistant', diff --git a/src/interfaces/assistants_web/src/components/Agents/Settings.tsx b/src/interfaces/assistants_web/src/app/(main)/settings/Settings.tsx similarity index 92% rename from src/interfaces/assistants_web/src/components/Agents/Settings.tsx rename to src/interfaces/assistants_web/src/app/(main)/settings/Settings.tsx index 9dfdec3c7e..4b2a9b4ebd 100644 --- a/src/interfaces/assistants_web/src/components/Agents/Settings.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/settings/Settings.tsx @@ -2,13 +2,10 @@ import { PropsWithChildren, useState } from 'react'; -import { DarkModeToggle } from '@/components/DarkModeToggle'; -import { MobileHeader } from '@/components/MobileHeader'; -import { Button, Icon, Tabs, Text } from '@/components/Shared'; -import { useNotify } from '@/hooks/toast'; -import { useDeleteAuthTool, useListTools } from '@/hooks/tools'; -import { cn } from '@/utils'; -import { getToolAuthUrl } from '@/utils/getToolAuthUrl'; +import { MobileHeader } from '@/components/Global'; +import { Button, DarkModeToggle, Icon, Tabs, Text } from '@/components/UI'; +import { useDeleteAuthTool, useListTools, useNotify } from '@/hooks'; +import { cn, getToolAuthUrl } from '@/utils'; const tabs = [
@@ -162,7 +159,7 @@ const GoogleDriveConnection = () => { label="Authenticate" href={getToolAuthUrl(googleDriveTool.auth_url)} kind="secondary" - theme="evolved-green" + theme="default" icon="arrow-up-right" /> )} diff --git a/src/interfaces/assistants_web/src/app/(main)/settings/page.tsx b/src/interfaces/assistants_web/src/app/(main)/settings/page.tsx index 882b078bd5..aedef0a65c 100644 --- a/src/interfaces/assistants_web/src/app/(main)/settings/page.tsx +++ b/src/interfaces/assistants_web/src/app/(main)/settings/page.tsx @@ -1,7 +1,7 @@ import { Metadata } from 'next'; import { Suspense } from 'react'; -import { Settings } from '@/components/Agents/Settings'; +import { Settings } from './Settings'; export const metadata: Metadata = { title: 'Settings', diff --git a/src/interfaces/assistants_web/src/app/_providers.tsx b/src/interfaces/assistants_web/src/app/_providers.tsx index 9092a840e7..f82c1ec942 100644 --- a/src/interfaces/assistants_web/src/app/_providers.tsx +++ b/src/interfaces/assistants_web/src/app/_providers.tsx @@ -12,12 +12,15 @@ import { CohereUnauthorizedError, Fetch, } from '@/cohere-client'; -import { ToastNotification, WebManifestHead } from '@/components/Shared'; -import { GlobalHead } from '@/components/Shared/GlobalHead'; -import { ViewportFix } from '@/components/ViewportFix'; +import { + GlobalHead, + ToastNotification, + ViewportFix, + WebManifestHead, +} from '@/components/Providers'; import { ContextStore } from '@/context'; import { env } from '@/env.mjs'; -import { useLazyRef } from '@/hooks/lazyRef'; +import { useLazyRef } from '@/hooks'; import { clearAuthToken } from '@/server/actions'; const makeCohereClient = (authToken?: string) => { diff --git a/src/interfaces/assistants_web/src/app/error.tsx b/src/interfaces/assistants_web/src/app/error.tsx index 96148686ae..bd76c156d1 100644 --- a/src/interfaces/assistants_web/src/app/error.tsx +++ b/src/interfaces/assistants_web/src/app/error.tsx @@ -2,7 +2,7 @@ import { useEffect } from 'react'; -import { PageServerError } from '@/components/Shared'; +import { Button, Text } from '@/components/UI'; export default function Error({ error, @@ -14,5 +14,17 @@ export default function Error({ console.error(error); }, [error]); - return ; + return ( +
+
+ + 500 + + Whoops! Something went wrong. +
+ +
+ ); } diff --git a/src/interfaces/assistants_web/src/app/not-found.tsx b/src/interfaces/assistants_web/src/app/not-found.tsx index a6887a1a3f..12901237d0 100644 --- a/src/interfaces/assistants_web/src/app/not-found.tsx +++ b/src/interfaces/assistants_web/src/app/not-found.tsx @@ -1,7 +1,19 @@ 'use client'; -import { PageNotFound } from '@/components/Shared'; +import { Button, Text } from '@/components/UI'; export default function NotFound() { - return ; + return ( +
+
+ + 404 + + This page could not be found. +
+ +
+ ); } diff --git a/src/interfaces/assistants_web/src/components/ReadOnlyConversation.tsx b/src/interfaces/assistants_web/src/app/share/[id]/ReadOnlyConversation.tsx similarity index 93% rename from src/interfaces/assistants_web/src/components/ReadOnlyConversation.tsx rename to src/interfaces/assistants_web/src/app/share/[id]/ReadOnlyConversation.tsx index 5117926b6a..61693dcfa7 100644 --- a/src/interfaces/assistants_web/src/components/ReadOnlyConversation.tsx +++ b/src/interfaces/assistants_web/src/app/share/[id]/ReadOnlyConversation.tsx @@ -1,7 +1,7 @@ 'use client'; -import MessageRow from '@/components/MessageRow'; -import { Button, Text } from '@/components/Shared'; +import { MessageRow } from '@/components/MessageRow'; +import { Button, Text } from '@/components/UI'; import { ChatMessage } from '@/types/message'; import { cn } from '@/utils'; diff --git a/src/interfaces/assistants_web/src/app/share/[id]/page.tsx b/src/interfaces/assistants_web/src/app/share/[id]/page.tsx index ef436da287..1eece2c77a 100644 --- a/src/interfaces/assistants_web/src/app/share/[id]/page.tsx +++ b/src/interfaces/assistants_web/src/app/share/[id]/page.tsx @@ -6,10 +6,9 @@ import { useParams } from 'next/navigation'; import { PropsWithChildren, useEffect, useState } from 'react'; import { Document } from '@/cohere-client'; -import { ReadOnlyConversation } from '@/components/ReadOnlyConversation'; -import { Icon, Spinner, Text } from '@/components/Shared'; +import { Icon, Spinner, Text } from '@/components/UI'; import { DEFAULT_CONVERSATION_NAME, TOOL_PYTHON_INTERPRETER_ID } from '@/constants'; -import { useGetSnapshotByLinkId } from '@/hooks/snapshots'; +import { useGetSnapshotByLinkId } from '@/hooks'; import { useCitationsStore } from '@/stores'; import { OutputFiles } from '@/stores/slices/citationsSlice'; import { @@ -17,8 +16,10 @@ import { createStartEndKey, isShareLinkExpiredError, mapHistoryToMessages, + parsePythonInterpreterToolFields, } from '@/utils'; -import { parsePythonInterpreterToolFields } from '@/utils/tools'; + +import { ReadOnlyConversation } from './ReadOnlyConversation'; const ShareConversationPage: NextPage = () => { const params = useParams(); diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Add.tsx b/src/interfaces/assistants_web/src/assets/icons/Add.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Add.tsx rename to src/interfaces/assistants_web/src/assets/icons/Add.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowClockwise.tsx b/src/interfaces/assistants_web/src/assets/icons/ArrowClockwise.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowClockwise.tsx rename to src/interfaces/assistants_web/src/assets/icons/ArrowClockwise.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowDown.tsx b/src/interfaces/assistants_web/src/assets/icons/ArrowDown.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowDown.tsx rename to src/interfaces/assistants_web/src/assets/icons/ArrowDown.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowLeft.tsx b/src/interfaces/assistants_web/src/assets/icons/ArrowLeft.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowLeft.tsx rename to src/interfaces/assistants_web/src/assets/icons/ArrowLeft.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowRight.tsx b/src/interfaces/assistants_web/src/assets/icons/ArrowRight.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowRight.tsx rename to src/interfaces/assistants_web/src/assets/icons/ArrowRight.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowSubmit.tsx b/src/interfaces/assistants_web/src/assets/icons/ArrowSubmit.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowSubmit.tsx rename to src/interfaces/assistants_web/src/assets/icons/ArrowSubmit.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowUp.tsx b/src/interfaces/assistants_web/src/assets/icons/ArrowUp.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowUp.tsx rename to src/interfaces/assistants_web/src/assets/icons/ArrowUp.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowUpRight.tsx b/src/interfaces/assistants_web/src/assets/icons/ArrowUpRight.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ArrowUpRight.tsx rename to src/interfaces/assistants_web/src/assets/icons/ArrowUpRight.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/BookOpenText.tsx b/src/interfaces/assistants_web/src/assets/icons/BookOpenText.tsx similarity index 98% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/BookOpenText.tsx rename to src/interfaces/assistants_web/src/assets/icons/BookOpenText.tsx index d8bd9fe56e..dee7af304b 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/BookOpenText.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/BookOpenText.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Calculator.tsx b/src/interfaces/assistants_web/src/assets/icons/Calculator.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Calculator.tsx rename to src/interfaces/assistants_web/src/assets/icons/Calculator.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ChatCircleDots.tsx b/src/interfaces/assistants_web/src/assets/icons/ChatCircleDots.tsx similarity index 98% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ChatCircleDots.tsx rename to src/interfaces/assistants_web/src/assets/icons/ChatCircleDots.tsx index 76ac2170bb..963034799b 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ChatCircleDots.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/ChatCircleDots.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Checkmark.tsx b/src/interfaces/assistants_web/src/assets/icons/Checkmark.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Checkmark.tsx rename to src/interfaces/assistants_web/src/assets/icons/Checkmark.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ChevronDown.tsx b/src/interfaces/assistants_web/src/assets/icons/ChevronDown.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ChevronDown.tsx rename to src/interfaces/assistants_web/src/assets/icons/ChevronDown.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ChevronLeft.tsx b/src/interfaces/assistants_web/src/assets/icons/ChevronLeft.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ChevronLeft.tsx rename to src/interfaces/assistants_web/src/assets/icons/ChevronLeft.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ChevronRight.tsx b/src/interfaces/assistants_web/src/assets/icons/ChevronRight.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ChevronRight.tsx rename to src/interfaces/assistants_web/src/assets/icons/ChevronRight.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ChevronUp.tsx b/src/interfaces/assistants_web/src/assets/icons/ChevronUp.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ChevronUp.tsx rename to src/interfaces/assistants_web/src/assets/icons/ChevronUp.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/CirclesFour.tsx b/src/interfaces/assistants_web/src/assets/icons/CirclesFour.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/CirclesFour.tsx rename to src/interfaces/assistants_web/src/assets/icons/CirclesFour.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/CirclesThree.tsx b/src/interfaces/assistants_web/src/assets/icons/CirclesThree.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/CirclesThree.tsx rename to src/interfaces/assistants_web/src/assets/icons/CirclesThree.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Close.tsx b/src/interfaces/assistants_web/src/assets/icons/Close.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Close.tsx rename to src/interfaces/assistants_web/src/assets/icons/Close.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/CloseDrawer.tsx b/src/interfaces/assistants_web/src/assets/icons/CloseDrawer.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/CloseDrawer.tsx rename to src/interfaces/assistants_web/src/assets/icons/CloseDrawer.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/CodeSimple.tsx b/src/interfaces/assistants_web/src/assets/icons/CodeSimple.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/CodeSimple.tsx rename to src/interfaces/assistants_web/src/assets/icons/CodeSimple.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Compass.tsx b/src/interfaces/assistants_web/src/assets/icons/Compass.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Compass.tsx rename to src/interfaces/assistants_web/src/assets/icons/Compass.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Copy.tsx b/src/interfaces/assistants_web/src/assets/icons/Copy.tsx similarity index 97% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Copy.tsx rename to src/interfaces/assistants_web/src/assets/icons/Copy.tsx index e25e0cebaa..6dc0508cb4 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Copy.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/Copy.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Desktop.tsx b/src/interfaces/assistants_web/src/assets/icons/Desktop.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Desktop.tsx rename to src/interfaces/assistants_web/src/assets/icons/Desktop.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Download.tsx b/src/interfaces/assistants_web/src/assets/icons/Download.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Download.tsx rename to src/interfaces/assistants_web/src/assets/icons/Download.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Edit.tsx b/src/interfaces/assistants_web/src/assets/icons/Edit.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Edit.tsx rename to src/interfaces/assistants_web/src/assets/icons/Edit.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/File.tsx b/src/interfaces/assistants_web/src/assets/icons/File.tsx similarity index 96% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/File.tsx rename to src/interfaces/assistants_web/src/assets/icons/File.tsx index c8411e9a50..8a040cfd5e 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/File.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/File.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/FileSearch.tsx b/src/interfaces/assistants_web/src/assets/icons/FileSearch.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/FileSearch.tsx rename to src/interfaces/assistants_web/src/assets/icons/FileSearch.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Folder.tsx b/src/interfaces/assistants_web/src/assets/icons/Folder.tsx similarity index 97% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Folder.tsx rename to src/interfaces/assistants_web/src/assets/icons/Folder.tsx index 7be336c6ed..625a3da210 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Folder.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/Folder.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/GoogleDrive.tsx b/src/interfaces/assistants_web/src/assets/icons/GoogleDrive.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/GoogleDrive.tsx rename to src/interfaces/assistants_web/src/assets/icons/GoogleDrive.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Hide.tsx b/src/interfaces/assistants_web/src/assets/icons/Hide.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Hide.tsx rename to src/interfaces/assistants_web/src/assets/icons/Hide.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Information.tsx b/src/interfaces/assistants_web/src/assets/icons/Information.tsx similarity index 97% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Information.tsx rename to src/interfaces/assistants_web/src/assets/icons/Information.tsx index a57aef4b60..7c4d51c037 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Information.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/Information.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Kebab.tsx b/src/interfaces/assistants_web/src/assets/icons/Kebab.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Kebab.tsx rename to src/interfaces/assistants_web/src/assets/icons/Kebab.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Link.tsx b/src/interfaces/assistants_web/src/assets/icons/Link.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Link.tsx rename to src/interfaces/assistants_web/src/assets/icons/Link.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/List.tsx b/src/interfaces/assistants_web/src/assets/icons/List.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/List.tsx rename to src/interfaces/assistants_web/src/assets/icons/List.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Menu.tsx b/src/interfaces/assistants_web/src/assets/icons/Menu.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Menu.tsx rename to src/interfaces/assistants_web/src/assets/icons/Menu.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Moon.tsx b/src/interfaces/assistants_web/src/assets/icons/Moon.tsx similarity index 98% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Moon.tsx rename to src/interfaces/assistants_web/src/assets/icons/Moon.tsx index c4d343a52f..32a18563e3 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Moon.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/Moon.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/NewMessage.tsx b/src/interfaces/assistants_web/src/assets/icons/NewMessage.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/NewMessage.tsx rename to src/interfaces/assistants_web/src/assets/icons/NewMessage.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/OneDrive.tsx b/src/interfaces/assistants_web/src/assets/icons/OneDrive.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/OneDrive.tsx rename to src/interfaces/assistants_web/src/assets/icons/OneDrive.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Paperclip.tsx b/src/interfaces/assistants_web/src/assets/icons/Paperclip.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Paperclip.tsx rename to src/interfaces/assistants_web/src/assets/icons/Paperclip.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Profile.tsx b/src/interfaces/assistants_web/src/assets/icons/Profile.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Profile.tsx rename to src/interfaces/assistants_web/src/assets/icons/Profile.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Search.tsx b/src/interfaces/assistants_web/src/assets/icons/Search.tsx similarity index 98% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Search.tsx rename to src/interfaces/assistants_web/src/assets/icons/Search.tsx index 15e849218f..7e8a35b736 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Search.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/Search.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Settings.tsx b/src/interfaces/assistants_web/src/assets/icons/Settings.tsx similarity index 99% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Settings.tsx rename to src/interfaces/assistants_web/src/assets/icons/Settings.tsx index fdc189995e..889ae4b944 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Settings.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/Settings.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Share.tsx b/src/interfaces/assistants_web/src/assets/icons/Share.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Share.tsx rename to src/interfaces/assistants_web/src/assets/icons/Share.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Show.tsx b/src/interfaces/assistants_web/src/assets/icons/Show.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Show.tsx rename to src/interfaces/assistants_web/src/assets/icons/Show.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/SignOut.tsx b/src/interfaces/assistants_web/src/assets/icons/SignOut.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/SignOut.tsx rename to src/interfaces/assistants_web/src/assets/icons/SignOut.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Sparkle.tsx b/src/interfaces/assistants_web/src/assets/icons/Sparkle.tsx similarity index 99% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Sparkle.tsx rename to src/interfaces/assistants_web/src/assets/icons/Sparkle.tsx index 8e08ef4acb..bf1750daf2 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Sparkle.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/Sparkle.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Subtract.tsx b/src/interfaces/assistants_web/src/assets/icons/Subtract.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Subtract.tsx rename to src/interfaces/assistants_web/src/assets/icons/Subtract.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Sun.tsx b/src/interfaces/assistants_web/src/assets/icons/Sun.tsx similarity index 99% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Sun.tsx rename to src/interfaces/assistants_web/src/assets/icons/Sun.tsx index 056c59b4fc..a8900001d9 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Sun.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/Sun.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ThumbsDown.tsx b/src/interfaces/assistants_web/src/assets/icons/ThumbsDown.tsx similarity index 97% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ThumbsDown.tsx rename to src/interfaces/assistants_web/src/assets/icons/ThumbsDown.tsx index dd5ee099f2..4ae38915da 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ThumbsDown.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/ThumbsDown.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ThumbsUp.tsx b/src/interfaces/assistants_web/src/assets/icons/ThumbsUp.tsx similarity index 97% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ThumbsUp.tsx rename to src/interfaces/assistants_web/src/assets/icons/ThumbsUp.tsx index aaa9b43ff9..b319db4cbf 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/ThumbsUp.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/ThumbsUp.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Trash.tsx b/src/interfaces/assistants_web/src/assets/icons/Trash.tsx similarity index 98% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Trash.tsx rename to src/interfaces/assistants_web/src/assets/icons/Trash.tsx index 93e75de48e..e8e370eec5 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Trash.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/Trash.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Upload.tsx b/src/interfaces/assistants_web/src/assets/icons/Upload.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Upload.tsx rename to src/interfaces/assistants_web/src/assets/icons/Upload.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/UsersThree.tsx b/src/interfaces/assistants_web/src/assets/icons/UsersThree.tsx similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/UsersThree.tsx rename to src/interfaces/assistants_web/src/assets/icons/UsersThree.tsx diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Warning.tsx b/src/interfaces/assistants_web/src/assets/icons/Warning.tsx similarity index 97% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Warning.tsx rename to src/interfaces/assistants_web/src/assets/icons/Warning.tsx index d784e585b7..170f420483 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Warning.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/Warning.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Web.tsx b/src/interfaces/assistants_web/src/assets/icons/Web.tsx similarity index 99% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Web.tsx rename to src/interfaces/assistants_web/src/assets/icons/Web.tsx index 26ed82de3a..5e83e0a2c5 100644 --- a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/Web.tsx +++ b/src/interfaces/assistants_web/src/assets/icons/Web.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { SVGProps } from 'react'; -import { IconKind } from '@/components/Shared/Icon/Icon'; +import { IconKind } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Shared/Icon/Icons/index.ts b/src/interfaces/assistants_web/src/assets/icons/index.ts similarity index 100% rename from src/interfaces/assistants_web/src/components/Shared/Icon/Icons/index.ts rename to src/interfaces/assistants_web/src/assets/icons/index.ts diff --git a/src/interfaces/assistants_web/src/components/Agents/AgentSettings/DataSourcesStep.tsx b/src/interfaces/assistants_web/src/components/AgentSettingsForm/DataSourcesStep.tsx similarity index 99% rename from src/interfaces/assistants_web/src/components/Agents/AgentSettings/DataSourcesStep.tsx rename to src/interfaces/assistants_web/src/components/AgentSettingsForm/DataSourcesStep.tsx index 0cbfac6d34..7dc376a0b5 100644 --- a/src/interfaces/assistants_web/src/components/Agents/AgentSettings/DataSourcesStep.tsx +++ b/src/interfaces/assistants_web/src/components/AgentSettingsForm/DataSourcesStep.tsx @@ -2,9 +2,9 @@ import { uniqBy } from 'lodash'; import Link from 'next/link'; import { Dispatch, ReactNode, RefObject, SetStateAction, useRef } from 'react'; -import { Button, Icon, IconName, Spinner, Text } from '@/components/Shared'; +import { Button, Icon, IconName, Spinner, Text } from '@/components/UI'; import { ACCEPTED_FILE_TYPES, TOOL_GOOGLE_DRIVE_ID } from '@/constants'; -import { useUploadAgentFile } from '@/hooks/files'; +import { useUploadAgentFile } from '@/hooks'; import { DataSourceArtifact } from '@/types/tools'; import { pluralize } from '@/utils'; diff --git a/src/interfaces/assistants_web/src/components/Agents/AgentSettings/DefineStep.tsx b/src/interfaces/assistants_web/src/components/AgentSettingsForm/DefineStep.tsx similarity index 90% rename from src/interfaces/assistants_web/src/components/Agents/AgentSettings/DefineStep.tsx rename to src/interfaces/assistants_web/src/components/AgentSettingsForm/DefineStep.tsx index c24acb96aa..e86ac5fc97 100644 --- a/src/interfaces/assistants_web/src/components/Agents/AgentSettings/DefineStep.tsx +++ b/src/interfaces/assistants_web/src/components/AgentSettingsForm/DefineStep.tsx @@ -1,7 +1,7 @@ import Link from 'next/link'; -import { AgentSettingsFields } from '@/components/Agents/AgentSettings/AgentSettingsForm'; -import { Input, Text, Textarea } from '@/components/Shared'; +import { AgentSettingsFields } from '@/components/AgentSettingsForm'; +import { Input, Text, Textarea } from '@/components/UI'; type Props = { fields: AgentSettingsFields; diff --git a/src/interfaces/assistants_web/src/components/Agents/AgentSettings/ToolsStep.tsx b/src/interfaces/assistants_web/src/components/AgentSettingsForm/ToolsStep.tsx similarity index 97% rename from src/interfaces/assistants_web/src/components/Agents/AgentSettings/ToolsStep.tsx rename to src/interfaces/assistants_web/src/components/AgentSettingsForm/ToolsStep.tsx index e772e1b8dd..7033aa1df3 100644 --- a/src/interfaces/assistants_web/src/components/Agents/AgentSettings/ToolsStep.tsx +++ b/src/interfaces/assistants_web/src/components/AgentSettingsForm/ToolsStep.tsx @@ -1,7 +1,7 @@ import Link from 'next/link'; import { ManagedTool } from '@/cohere-client'; -import { Icon, IconName, Switch, Text } from '@/components/Shared'; +import { Icon, IconName, Switch, Text } from '@/components/UI'; import { AGENT_SETTINGS_TOOLS, TOOL_FALLBACK_ICON, TOOL_ID_TO_DISPLAY_INFO } from '@/constants'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Agents/AgentSettings/VisibilityStep.tsx b/src/interfaces/assistants_web/src/components/AgentSettingsForm/VisibilityStep.tsx similarity index 95% rename from src/interfaces/assistants_web/src/components/Agents/AgentSettings/VisibilityStep.tsx rename to src/interfaces/assistants_web/src/components/AgentSettingsForm/VisibilityStep.tsx index e61ee5e6b1..97c5a7ce13 100644 --- a/src/interfaces/assistants_web/src/components/Agents/AgentSettings/VisibilityStep.tsx +++ b/src/interfaces/assistants_web/src/components/AgentSettingsForm/VisibilityStep.tsx @@ -1,4 +1,4 @@ -import { Icon, RadioGroup, Text } from '@/components/Shared'; +import { Icon, RadioGroup, Text } from '@/components/UI'; import { cn } from '@/utils'; type Props = { diff --git a/src/interfaces/assistants_web/src/components/Agents/AgentSettings/AgentSettingsForm.tsx b/src/interfaces/assistants_web/src/components/AgentSettingsForm/index.tsx similarity index 93% rename from src/interfaces/assistants_web/src/components/Agents/AgentSettings/AgentSettingsForm.tsx rename to src/interfaces/assistants_web/src/components/AgentSettingsForm/index.tsx index adc9bc9baf..695ac1197f 100644 --- a/src/interfaces/assistants_web/src/components/Agents/AgentSettings/AgentSettingsForm.tsx +++ b/src/interfaces/assistants_web/src/components/AgentSettingsForm/index.tsx @@ -5,18 +5,15 @@ import { useSearchParams } from 'next/navigation'; import { useEffect, useState } from 'react'; import { CreateAgentRequest, UpdateAgentRequest } from '@/cohere-client'; -import { DataSourcesStep } from '@/components/Agents/AgentSettings/DataSourcesStep'; -import { DefineAssistantStep } from '@/components/Agents/AgentSettings/DefineStep'; -import { ToolsStep } from '@/components/Agents/AgentSettings/ToolsStep'; -import { VisibilityStep } from '@/components/Agents/AgentSettings/VisibilityStep'; -import { CollapsibleSection } from '@/components/CollapsibleSection'; -import { Button } from '@/components/Shared'; +import { DataSourcesStep } from '@/components/AgentSettingsForm/DataSourcesStep'; +import { DefineAssistantStep } from '@/components/AgentSettingsForm/DefineStep'; +import { ToolsStep } from '@/components/AgentSettingsForm/ToolsStep'; +import { VisibilityStep } from '@/components/AgentSettingsForm/VisibilityStep'; +import { Button, CollapsibleSection } from '@/components/UI'; import { TOOL_GOOGLE_DRIVE_ID, TOOL_READ_DOCUMENT_ID, TOOL_SEARCH_FILE_ID } from '@/constants'; -import { useIsAgentNameUnique } from '@/hooks/agents'; -import { useListTools, useOpenGoogleDrivePicker } from '@/hooks/tools'; +import { useIsAgentNameUnique, useListTools, useOpenGoogleDrivePicker } from '@/hooks'; import { DataSourceArtifact } from '@/types/tools'; -import { cn } from '@/utils'; -import { getToolAuthUrl } from '@/utils/getToolAuthUrl'; +import { cn, getToolAuthUrl } from '@/utils'; type RequiredAndNotNull = { [P in keyof T]-?: Exclude; diff --git a/src/interfaces/assistants_web/src/components/Agents/AgentLogo.tsx b/src/interfaces/assistants_web/src/components/Agents/AgentLogo.tsx index ff914f57ec..4207ce0711 100644 --- a/src/interfaces/assistants_web/src/components/Agents/AgentLogo.tsx +++ b/src/interfaces/assistants_web/src/components/Agents/AgentLogo.tsx @@ -1,6 +1,6 @@ import { AgentPublic } from '@/cohere-client'; -import { CoralLogo, Text } from '@/components/Shared'; -import { useBrandedColors } from '@/hooks/brandedColors'; +import { CoralLogo, Text } from '@/components/UI'; +import { useBrandedColors } from '@/hooks'; import { cn } from '@/utils'; export const AgentLogo = ({ agent }: { agent: AgentPublic }) => { diff --git a/src/interfaces/assistants_web/src/components/Agents/AgentToolFilePicker.tsx b/src/interfaces/assistants_web/src/components/Agents/AgentToolFilePicker.tsx deleted file mode 100644 index a86c647ce4..0000000000 --- a/src/interfaces/assistants_web/src/components/Agents/AgentToolFilePicker.tsx +++ /dev/null @@ -1,64 +0,0 @@ -'use client'; - -import { IconButton } from '@/components/IconButton'; -import { Button, Icon, Text } from '@/components/Shared'; -import { DataSourceArtifact } from '@/types/tools'; - -type Props = { - googleDriveFiles?: DataSourceArtifact[]; - disabled?: boolean; - handleRemoveGoogleDriveFiles: (id: string) => void; - handleOpenFilePicker: VoidFunction; -}; - -/** - * @description Component to display the selected files/folders from Google Drive - * @param {DataSourceArtifact[]} googleDriveFiles - List of selected files/folders from Google Drive - * @param {boolean} disabled - Flag to disable the file picker - * @param {Function} handleRemoveGoogleDriveFiles - Function to remove a file/folder from the selected list - * @param {Function} handleOpenFilePicker - Function to open the file picker - */ -export const AgentToolFilePicker: React.FC = ({ - googleDriveFiles, - disabled, - handleRemoveGoogleDriveFiles, - handleOpenFilePicker, -}) => { - return ( -
- {!disabled && ( -
- ); -}; diff --git a/src/interfaces/assistants_web/src/components/AuthLink.tsx b/src/interfaces/assistants_web/src/components/Auth/AuthLink.tsx similarity index 92% rename from src/interfaces/assistants_web/src/components/AuthLink.tsx rename to src/interfaces/assistants_web/src/components/Auth/AuthLink.tsx index 64c921eb9a..e2ee4baffb 100644 --- a/src/interfaces/assistants_web/src/components/AuthLink.tsx +++ b/src/interfaces/assistants_web/src/components/Auth/AuthLink.tsx @@ -2,8 +2,8 @@ import React from 'react'; -import { Button, ButtonTheme, IconName } from '@/components/Shared'; -import { useAuthConfig } from '@/hooks/authConfig'; +import { Button, ButtonTheme, IconName } from '@/components/UI'; +import { useAuthConfig } from '@/hooks'; type Props = { action: 'login' | 'register' | 'logout'; diff --git a/src/interfaces/assistants_web/src/components/Welcome/CellBackground.tsx b/src/interfaces/assistants_web/src/components/Auth/CellBackground.tsx similarity index 94% rename from src/interfaces/assistants_web/src/components/Welcome/CellBackground.tsx rename to src/interfaces/assistants_web/src/components/Auth/CellBackground.tsx index bda1731160..ff012a8767 100644 --- a/src/interfaces/assistants_web/src/components/Welcome/CellBackground.tsx +++ b/src/interfaces/assistants_web/src/components/Auth/CellBackground.tsx @@ -2,7 +2,7 @@ import { useState } from 'react'; -import { useIsDesktop } from '@/hooks/breakpoint'; +import { useIsDesktop } from '@/hooks'; import { cn } from '@/utils'; export const CellBackground: React.FC = () => { diff --git a/src/interfaces/assistants_web/src/components/Welcome/Navigation.tsx b/src/interfaces/assistants_web/src/components/Auth/Navigation.tsx similarity index 91% rename from src/interfaces/assistants_web/src/components/Welcome/Navigation.tsx rename to src/interfaces/assistants_web/src/components/Auth/Navigation.tsx index 0b264e965b..a85a4d4ff4 100644 --- a/src/interfaces/assistants_web/src/components/Welcome/Navigation.tsx +++ b/src/interfaces/assistants_web/src/components/Auth/Navigation.tsx @@ -2,7 +2,7 @@ import Link from 'next/link'; -import { Logo } from '@/components/Shared'; +import { Logo } from '@/components/UI'; import { cn } from '@/utils'; /** diff --git a/src/interfaces/assistants_web/src/components/NavigationUserMenu.tsx b/src/interfaces/assistants_web/src/components/Auth/NavigationUserMenu.tsx similarity index 96% rename from src/interfaces/assistants_web/src/components/NavigationUserMenu.tsx rename to src/interfaces/assistants_web/src/components/Auth/NavigationUserMenu.tsx index 6637efc90d..9d39364eae 100644 --- a/src/interfaces/assistants_web/src/components/NavigationUserMenu.tsx +++ b/src/interfaces/assistants_web/src/components/Auth/NavigationUserMenu.tsx @@ -3,8 +3,8 @@ import { Popover, Transition } from '@headlessui/react'; import { Fragment } from 'react'; -import { AuthLink } from '@/components/AuthLink'; -import { Icon, Text } from '@/components/Shared'; +import { AuthLink } from '@/components/Auth'; +import { Icon, Text } from '@/components/UI'; import { cn } from '@/utils'; /** diff --git a/src/interfaces/assistants_web/src/components/Welcome/OidcSSOButton.tsx b/src/interfaces/assistants_web/src/components/Auth/OidcSSOButton.tsx similarity index 97% rename from src/interfaces/assistants_web/src/components/Welcome/OidcSSOButton.tsx rename to src/interfaces/assistants_web/src/components/Auth/OidcSSOButton.tsx index 4d15601bb5..0fe70d725e 100644 --- a/src/interfaces/assistants_web/src/components/Welcome/OidcSSOButton.tsx +++ b/src/interfaces/assistants_web/src/components/Auth/OidcSSOButton.tsx @@ -1,7 +1,6 @@ 'use client'; -import { Button } from '@/components/Shared'; -import { cn } from '@/utils'; +import { Button } from '@/components/UI'; type ButtonProps = { onClick: () => void; diff --git a/src/interfaces/assistants_web/src/components/WelcomePage.tsx b/src/interfaces/assistants_web/src/components/Auth/WelcomePage.tsx similarity index 83% rename from src/interfaces/assistants_web/src/components/WelcomePage.tsx rename to src/interfaces/assistants_web/src/components/Auth/WelcomePage.tsx index b348c7d3fc..aa0146824a 100644 --- a/src/interfaces/assistants_web/src/components/WelcomePage.tsx +++ b/src/interfaces/assistants_web/src/components/Auth/WelcomePage.tsx @@ -3,11 +3,8 @@ import { usePathname } from 'next/navigation'; import { PropsWithChildren } from 'react'; -import { AuthLink } from '@/components/AuthLink'; -import { NavigationUserMenu } from '@/components/NavigationUserMenu'; -import { Text } from '@/components/Shared'; -import { CellBackground } from '@/components/Welcome/CellBackground'; -import { Navigation } from '@/components/Welcome/Navigation'; +import { AuthLink, CellBackground, Navigation, NavigationUserMenu } from '@/components/Auth'; +import { Text } from '@/components/UI'; type Props = PropsWithChildren<{ userEmail?: string; diff --git a/src/interfaces/assistants_web/src/components/Auth/index.ts b/src/interfaces/assistants_web/src/components/Auth/index.ts new file mode 100644 index 0000000000..ee4d306123 --- /dev/null +++ b/src/interfaces/assistants_web/src/components/Auth/index.ts @@ -0,0 +1,6 @@ +export * from './AuthLink'; +export * from './CellBackground'; +export * from './Navigation'; +export * from './NavigationUserMenu'; +export * from './OidcSSOButton'; +export * from './WelcomePage'; diff --git a/src/interfaces/assistants_web/src/components/Conversation/Composer/index.tsx b/src/interfaces/assistants_web/src/components/Composer/Composer.tsx similarity index 90% rename from src/interfaces/assistants_web/src/components/Conversation/Composer/index.tsx rename to src/interfaces/assistants_web/src/components/Composer/Composer.tsx index 2a93db9006..418109480d 100644 --- a/src/interfaces/assistants_web/src/components/Conversation/Composer/index.tsx +++ b/src/interfaces/assistants_web/src/components/Composer/Composer.tsx @@ -4,14 +4,10 @@ import { useResizeObserver } from '@react-hookz/web'; import React, { useEffect, useRef, useState } from 'react'; import { AgentPublic, ManagedTool } from '@/cohere-client'; -import { ComposerError } from '@/components/Conversation/Composer/ComposerError'; -import { ComposerFiles } from '@/components/Conversation/Composer/ComposerFiles'; -import { ComposerToolbar } from '@/components/Conversation/Composer/ComposerToolbar'; -import { DragDropFileUploadOverlay } from '@/components/Conversation/Composer/DragDropFileUploadOverlay'; -import { Icon, STYLE_LEVEL_TO_CLASSES } from '@/components/Shared'; +import { ComposerError, ComposerFiles, ComposerToolbar } from '@/components/Composer'; +import { DragDropFileInput, Icon, STYLE_LEVEL_TO_CLASSES } from '@/components/UI'; import { CHAT_COMPOSER_TEXTAREA_ID } from '@/constants'; -import { useBreakpoint, useIsDesktop } from '@/hooks/breakpoint'; -import { useAvailableTools } from '@/hooks/tools'; +import { useAvailableTools, useBreakpoint, useIsDesktop } from '@/hooks'; import { ConfigurableParams } from '@/stores/slices/paramsSlice'; import { ChatMessage } from '@/types/message'; import { cn } from '@/utils'; @@ -144,7 +140,7 @@ export const Composer: React.FC = ({ }, 100); }} > - +