From 53b7d26063dd00ab7ad2027006676e4e8c9356e8 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 20 Oct 2025 11:10:59 +0200 Subject: [PATCH 01/12] share table --- enums.py | 2 ++ models.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/enums.py b/enums.py index ebaa432..9c569fd 100644 --- a/enums.py +++ b/enums.py @@ -177,6 +177,8 @@ class Tablenames(Enum): SUMS_TABLE = "sums_table" ADMIN_QUERY_MESSAGE_SUMMARY = "admin_query_message_summary" RELEASE_NOTIFICATION = "release_notification" + CONVERSATION_SHARE = "conversation_share" + CONVERSATION_GLOBAL_SHARE = "conversation_global_share" def snake_case_to_pascal_case(self): # the type name (written in PascalCase) of a table is needed to create backrefs diff --git a/models.py b/models.py index 5932911..d9fc891 100644 --- a/models.py +++ b/models.py @@ -2504,3 +2504,55 @@ class ReleaseNotification(Base): ) link = Column(String, nullable=False) config = Column(JSON) # e.g. {"en": {"headline":"", "description":""}, "de": {...}} + + +class ConversationShare(Base): + __tablename__ = Tablenames.CONVERSATION_SHARE.value + __table_args__ = {"schema": "cognition"} + + id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) + conversation_id = Column( + UUID(as_uuid=True), + ForeignKey(f"cognition.{Tablenames.CONVERSATION.value}.id", ondelete="CASCADE"), + nullable=False, + index=True, + ) + shared_with = Column( + UUID(as_uuid=True), + ForeignKey(f"{Tablenames.USER.value}.id", ondelete="CASCADE"), + nullable=False, + index=True, + ) + shared_by = Column( + UUID(as_uuid=True), + ForeignKey(f"{Tablenames.USER.value}.id", ondelete="CASCADE"), + nullable=False, + index=True, + ) + can_copy = Column(Boolean, default=False) + created_at = Column(DateTime, default=sql.func.now()) + + +class ConversationGlobalShare(Base): + __tablename__ = Tablenames.CONVERSATION_GLOBAL_SHARE.value + __table_args__ = {"schema": "cognition"} + + id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) + conversation_id = Column( + UUID(as_uuid=True), + ForeignKey(f"cognition.{Tablenames.CONVERSATION.value}.id", ondelete="CASCADE"), + nullable=False, + index=True, + ) + + public_token = Column(String, unique=True, nullable=False) # {xyz id} in URL + is_active = Column(Boolean, default=True) + shared_by = Column( + UUID(as_uuid=True), + ForeignKey(f"{Tablenames.USER.value}.id", ondelete="CASCADE"), + nullable=False, + index=True, + ) + + created_at = Column(DateTime, default=sql.func.now()) + warning_acknowledged = Column(Boolean, default=False) From 48a1bcfa6f907787040147d35b357d7faad3f53e Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Tue, 21 Oct 2025 16:23:40 +0200 Subject: [PATCH 02/12] index and deletions shared conversation --- cognition_objects/conversation_shares.py | 142 +++++++++++++++++++++++ models.py | 6 +- 2 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 cognition_objects/conversation_shares.py diff --git a/cognition_objects/conversation_shares.py b/cognition_objects/conversation_shares.py new file mode 100644 index 0000000..5a318c7 --- /dev/null +++ b/cognition_objects/conversation_shares.py @@ -0,0 +1,142 @@ +from operator import or_ +from typing import List, Optional +from ..business_objects import general +from ..session import session +from ..models import ConversationShare, CognitionConversation +from submodules.model.util import sql_alchemy_to_dict + + +def get(share_id: str, user_id: str) -> Optional[ConversationShare]: + return ( + session.query(ConversationShare) + .filter(ConversationShare.id == share_id) + .filter( + or_( + ConversationShare.shared_by == user_id, + ConversationShare.shared_with == user_id, + ) + ) + .first() + ) + + +def get_all_by_conversation(conversation_id: str) -> List[ConversationShare]: + return ( + session.query(ConversationShare) + .filter(ConversationShare.conversation_id == conversation_id) + .all() + ) + + +def get_all_shared_by_or_for_user( + project_id: str, user_id: str, with_header: bool = True +) -> List[ConversationShare]: + conversation_shares = ( + session.query(ConversationShare, CognitionConversation.header) + .join( + CognitionConversation, + ConversationShare.conversation_id == CognitionConversation.id, + ) + .filter(CognitionConversation.project_id == project_id) + .filter( + or_( + ConversationShare.shared_by == user_id, + ConversationShare.shared_with == user_id, + ) + ) + .all() + ) + conversation_shares_dict = [] + for share_obj, header in conversation_shares: + share_dict = sql_alchemy_to_dict(share_obj) + share_dict["conversation_header"] = header + conversation_shares_dict.append(share_dict) + + return conversation_shares_dict + + +def get_all_shared_by_user(user_id: str) -> List[ConversationShare]: + return ( + session.query(ConversationShare) + .filter(ConversationShare.shared_by == user_id) + .all() + ) + + +def create( + conversation_id: str, + shared_with: str, + shared_by: str, + can_copy: bool = False, + with_commit: bool = True, +) -> ConversationShare: + share = ConversationShare( + conversation_id=conversation_id, + shared_with=shared_with, + shared_by=shared_by, + can_copy=can_copy, + ) + general.add(share, with_commit) + return share + + +def create_many( + conversation_id: str, + shared_with_user_ids: List[str], + shared_by: str, + can_copy: bool = False, + with_commit: bool = True, +) -> List[ConversationShare]: + + shares = [] + + for user_id in shared_with_user_ids: + share = ConversationShare( + conversation_id=conversation_id, + shared_with=user_id, + shared_by=shared_by, + can_copy=can_copy, + ) + general.add(share, with_commit=False) + shares.append(share) + + general.flush_or_commit(with_commit) + return shares + + +def update( + share_id: str, + user_id: str, + can_copy: Optional[bool] = None, + with_commit: bool = True, +) -> Optional[ConversationShare]: + share_entity = get(share_id) + if share_entity is None: + return None + + if str(share_entity.shared_by) != user_id: + raise ValueError("You are not allowed to update this sharing context.") + + if can_copy is not None: + share_entity.can_copy = can_copy + + general.flush_or_commit(with_commit) + return share_entity + + +def delete_shared_with( + conversation_share_id: str, user_id: str, with_commit: bool = True +) -> None: + session.query(ConversationShare).filter( + ConversationShare.id == conversation_share_id + ).filter(ConversationShare.shared_with == user_id).delete() + general.flush_or_commit(with_commit) + + +def delete_shared_by_by_conversation_id( + conversation_id: str, user_id: str, with_commit: bool = True +) -> None: + session.query(ConversationShare).filter( + ConversationShare.conversation_id == conversation_id + ).filter(ConversationShare.shared_by == user_id).delete() + general.flush_or_commit(with_commit) diff --git a/models.py b/models.py index d9fc891..333e0f0 100644 --- a/models.py +++ b/models.py @@ -2544,8 +2544,10 @@ class ConversationGlobalShare(Base): nullable=False, index=True, ) - - public_token = Column(String, unique=True, nullable=False) # {xyz id} in URL + # indexed for easy lookup when accessing a shared conversation via public link + public_token = Column( + String, unique=True, nullable=False, index=True + ) # {xyz id} in URL is_active = Column(Boolean, default=True) shared_by = Column( UUID(as_uuid=True), From 8589b8b49579250a3d01218fab0a32196f86fe80 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 27 Oct 2025 13:47:35 +0100 Subject: [PATCH 03/12] global update --- models.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/models.py b/models.py index 333e0f0..eae9042 100644 --- a/models.py +++ b/models.py @@ -2544,17 +2544,10 @@ class ConversationGlobalShare(Base): nullable=False, index=True, ) - # indexed for easy lookup when accessing a shared conversation via public link - public_token = Column( - String, unique=True, nullable=False, index=True - ) # {xyz id} in URL - is_active = Column(Boolean, default=True) shared_by = Column( UUID(as_uuid=True), ForeignKey(f"{Tablenames.USER.value}.id", ondelete="CASCADE"), nullable=False, index=True, ) - created_at = Column(DateTime, default=sql.func.now()) - warning_acknowledged = Column(Boolean, default=False) From 682442e9e4e596ed079eea64c1a534db8e1dcf61 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Wed, 29 Oct 2025 18:02:53 +0100 Subject: [PATCH 04/12] global sharing --- cognition_objects/conversation.py | 8 ++++ .../conversation_global_shares.py | 41 +++++++++++++++++ cognition_objects/conversation_shares.py | 45 +++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 cognition_objects/conversation_global_shares.py diff --git a/cognition_objects/conversation.py b/cognition_objects/conversation.py index ea9990e..265de08 100644 --- a/cognition_objects/conversation.py +++ b/cognition_objects/conversation.py @@ -29,6 +29,14 @@ def get(project_id: str, conversation_id: str) -> CognitionConversation: ) +def get_by_id(conversation_id: str) -> CognitionConversation: + return ( + session.query(CognitionConversation) + .filter(CognitionConversation.id == conversation_id) + .first() + ) + + def exists(project_id: str, conversation_id: str) -> bool: return ( session.query(CognitionConversation) diff --git a/cognition_objects/conversation_global_shares.py b/cognition_objects/conversation_global_shares.py new file mode 100644 index 0000000..0f495a9 --- /dev/null +++ b/cognition_objects/conversation_global_shares.py @@ -0,0 +1,41 @@ +from operator import or_ +from typing import List, Optional +from ..business_objects import general +from ..session import session +from ..models import ConversationGlobalShare +from submodules.model.util import sql_alchemy_to_dict + + +def get_by_conversation(conversation_id: str) -> List[ConversationGlobalShare]: + return ( + session.query(ConversationGlobalShare) + .filter(ConversationGlobalShare.conversation_id == conversation_id) + .first() + ) + + +def create( + conversation_id: str, + shared_by: str, + with_commit: bool = True, +) -> ConversationGlobalShare: + global_share = ConversationGlobalShare( + conversation_id=conversation_id, shared_by=shared_by + ) + general.add(global_share, with_commit) + return global_share + + +def delete_by_conversation( + conversation_id: str, user_id: str, with_commit: bool = True +): + ( + session.query(ConversationGlobalShare) + .filter( + ConversationGlobalShare.conversation_id == conversation_id, + ConversationGlobalShare.shared_by == user_id, + ) + .delete() + ) + if with_commit: + session.commit() diff --git a/cognition_objects/conversation_shares.py b/cognition_objects/conversation_shares.py index 5a318c7..c022016 100644 --- a/cognition_objects/conversation_shares.py +++ b/cognition_objects/conversation_shares.py @@ -28,6 +28,51 @@ def get_all_by_conversation(conversation_id: str) -> List[ConversationShare]: ) +def update_by_conversation( + conversation_id: str, + user_id: str, + shared_with: List[str], + can_copy: Optional[bool] = None, + with_commit: bool = True, +) -> List[ConversationShare]: + existing_shares = ( + session.query(ConversationShare) + .filter(ConversationShare.conversation_id == conversation_id) + .filter(ConversationShare.shared_by == user_id) + .all() + ) + + existing_shared_with = {share.shared_with: share for share in existing_shares} + shared_with_set = set(shared_with) + + for share in existing_shares: + if share.shared_with not in shared_with_set: + session.delete(share) + + for sharing_user_id in shared_with: + if sharing_user_id not in existing_shared_with: + share = ConversationShare( + conversation_id=conversation_id, + shared_with=sharing_user_id, + shared_by=user_id, + can_copy=can_copy if can_copy is not None else False, + ) + general.add(share, with_commit=False) + else: + if can_copy is not None: + existing_shared_with[sharing_user_id].can_copy = can_copy + + general.flush_or_commit(with_commit) + + updated_shares = ( + session.query(ConversationShare) + .filter(ConversationShare.conversation_id == conversation_id) + .filter(ConversationShare.shared_by == user_id) + .all() + ) + return updated_shares + + def get_all_shared_by_or_for_user( project_id: str, user_id: str, with_header: bool = True ) -> List[ConversationShare]: From ad77b35afd89198bbd8fedd7827002b4459d3498 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Thu, 30 Oct 2025 19:00:49 +0100 Subject: [PATCH 05/12] get by user global share --- .../conversation_global_shares.py | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/cognition_objects/conversation_global_shares.py b/cognition_objects/conversation_global_shares.py index 0f495a9..0d2febf 100644 --- a/cognition_objects/conversation_global_shares.py +++ b/cognition_objects/conversation_global_shares.py @@ -2,7 +2,7 @@ from typing import List, Optional from ..business_objects import general from ..session import session -from ..models import ConversationGlobalShare +from ..models import CognitionConversation, ConversationGlobalShare from submodules.model.util import sql_alchemy_to_dict @@ -39,3 +39,22 @@ def delete_by_conversation( ) if with_commit: session.commit() + + +def get_by_user(project_id: str, user_id: str) -> List[ConversationGlobalShare]: + conversation_global_shares = ( + session.query(ConversationGlobalShare, CognitionConversation.header) + .join( + CognitionConversation, + ConversationGlobalShare.conversation_id == CognitionConversation.id, + ) + .filter(ConversationGlobalShare.shared_by == user_id) + .filter(CognitionConversation.project_id == project_id) + .all() + ) + conversation_global_shares_dict = [] + for share_obj, header in conversation_global_shares: + share_dict = sql_alchemy_to_dict(share_obj) + share_dict["conversation_header"] = header + conversation_global_shares_dict.append(share_dict) + return conversation_global_shares_dict From bd41e25aaf3444d3803f12db8bda541873ca42fb Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 3 Nov 2025 14:03:21 +0100 Subject: [PATCH 06/12] adding project sharing settings --- models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/models.py b/models.py index 2327677..0ba844f 100644 --- a/models.py +++ b/models.py @@ -1115,6 +1115,8 @@ class CognitionProject(Base): tokenizer = Column(String) # options from component - only visible with new UI selected (user setting) icon = Column(String, default="IconBolt") + allow_conversation_sharing_organization = Column(Boolean, default=False) + allow_conversation_sharing_global = Column(Boolean, default=False) class CognitionStrategy(Base): From 769f600c8072af5ca14a04dad8dddd2744e5cf57 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 3 Nov 2025 18:47:22 +0100 Subject: [PATCH 07/12] user management and project and tags --- business_objects/user.py | 16 +++++++++++++++- cognition_objects/conversation_tags.py | 12 ++++++++++++ cognition_objects/project.py | 8 ++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/business_objects/user.py b/business_objects/user.py index ed5c2f4..d5ade61 100644 --- a/business_objects/user.py +++ b/business_objects/user.py @@ -1,6 +1,6 @@ from datetime import datetime from . import general, organization, team_member -from .. import User, enums +from .. import User, enums, Team, TeamMember, TeamResource from ..session import session from typing import List, Optional from sqlalchemy import sql @@ -52,6 +52,20 @@ def get_all( return query.all() +def get_all_team_members_by_project(project_id: str) -> List[User]: + query = ( + session.query(User) + .join(TeamMember, TeamMember.user_id == User.id) + .join(Team, Team.id == TeamMember.team_id) + .join(TeamResource, TeamResource.team_id == Team.id) + .filter(TeamResource.resource_id == project_id) + .filter( + TeamResource.resource_type == enums.TeamResourceType.COGNITION_PROJECT.value + ) + ) + return query.all() + + def get_count_assigned() -> int: return session.query(User.id).filter(User.organization_id != None).count() diff --git a/cognition_objects/conversation_tags.py b/cognition_objects/conversation_tags.py index 0279465..33a92bc 100644 --- a/cognition_objects/conversation_tags.py +++ b/cognition_objects/conversation_tags.py @@ -128,6 +128,18 @@ def delete_association( general.flush_or_commit(with_commit) +def delete_associations_by_conversation( + conversation_id: str, + with_commit: bool = True, +) -> None: + + session.query(CognitionConversationTagAssociation).filter( + CognitionConversationTagAssociation.conversation_id == conversation_id, + ).delete(synchronize_session=False) + + general.flush_or_commit(with_commit) + + def get_lookup_by_conversation_ids( conversation_ids: List[str], ) -> Dict[str, List[Dict[str, Any]]]: diff --git a/cognition_objects/project.py b/cognition_objects/project.py index 11d5c8c..51f5990 100644 --- a/cognition_objects/project.py +++ b/cognition_objects/project.py @@ -215,6 +215,8 @@ def update( llm_config: Optional[Dict[str, Any]] = None, tokenizer: Optional[str] = None, icon: Optional[str] = None, + allow_conversation_sharing_organization: Optional[bool] = None, + allow_conversation_sharing_global: Optional[bool] = None, with_commit: bool = True, ) -> CognitionProject: project: CognitionProject = get(project_id) @@ -288,6 +290,12 @@ def update( project.tokenizer = tokenizer if icon is not None: project.icon = icon + if allow_conversation_sharing_organization is not None: + project.allow_conversation_sharing_organization = ( + allow_conversation_sharing_organization + ) + if allow_conversation_sharing_global is not None: + project.allow_conversation_sharing_global = allow_conversation_sharing_global general.flush_or_commit(with_commit) return project From a184024c56dd04dff359112256893aa23d052917 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Tue, 4 Nov 2025 12:04:12 +0100 Subject: [PATCH 08/12] get global share --- cognition_objects/conversation_global_shares.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cognition_objects/conversation_global_shares.py b/cognition_objects/conversation_global_shares.py index 0d2febf..907aca4 100644 --- a/cognition_objects/conversation_global_shares.py +++ b/cognition_objects/conversation_global_shares.py @@ -6,6 +6,14 @@ from submodules.model.util import sql_alchemy_to_dict +def get(conversation_global_share_id: str) -> Optional[ConversationGlobalShare]: + return ( + session.query(ConversationGlobalShare) + .filter(ConversationGlobalShare.id == conversation_global_share_id) + .first() + ) + + def get_by_conversation(conversation_id: str) -> List[ConversationGlobalShare]: return ( session.query(ConversationGlobalShare) From f890096e9c2c3d3daa55034f1ada64aaf9b0c23d Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Thu, 6 Nov 2025 09:32:24 +0100 Subject: [PATCH 09/12] PR comments --- business_objects/user.py | 3 +-- cognition_objects/conversation_global_shares.py | 6 +++--- cognition_objects/conversation_shares.py | 15 ++++++--------- cognition_objects/project.py | 2 +- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/business_objects/user.py b/business_objects/user.py index d5ade61..8fa65dd 100644 --- a/business_objects/user.py +++ b/business_objects/user.py @@ -54,8 +54,7 @@ def get_all( def get_all_team_members_by_project(project_id: str) -> List[User]: query = ( - session.query(User) - .join(TeamMember, TeamMember.user_id == User.id) + session.query(TeamMember) .join(Team, Team.id == TeamMember.team_id) .join(TeamResource, TeamResource.team_id == Team.id) .filter(TeamResource.resource_id == project_id) diff --git a/cognition_objects/conversation_global_shares.py b/cognition_objects/conversation_global_shares.py index 907aca4..83ad8e8 100644 --- a/cognition_objects/conversation_global_shares.py +++ b/cognition_objects/conversation_global_shares.py @@ -1,5 +1,5 @@ from operator import or_ -from typing import List, Optional +from typing import List, Optional, Dict, Any from ..business_objects import general from ..session import session from ..models import CognitionConversation, ConversationGlobalShare @@ -46,10 +46,10 @@ def delete_by_conversation( .delete() ) if with_commit: - session.commit() + general.flush_or_commit(with_commit) -def get_by_user(project_id: str, user_id: str) -> List[ConversationGlobalShare]: +def get_by_user(project_id: str, user_id: str) -> List[Dict[str, Any]]: conversation_global_shares = ( session.query(ConversationGlobalShare, CognitionConversation.header) .join( diff --git a/cognition_objects/conversation_shares.py b/cognition_objects/conversation_shares.py index c022016..aa9e366 100644 --- a/cognition_objects/conversation_shares.py +++ b/cognition_objects/conversation_shares.py @@ -47,7 +47,7 @@ def update_by_conversation( for share in existing_shares: if share.shared_with not in shared_with_set: - session.delete(share) + general.delete(share, with_commit=False) for sharing_user_id in shared_with: if sharing_user_id not in existing_shared_with: @@ -133,19 +133,16 @@ def create_many( with_commit: bool = True, ) -> List[ConversationShare]: - shares = [] - - for user_id in shared_with_user_ids: - share = ConversationShare( + shares = [ + ConversationShare( conversation_id=conversation_id, shared_with=user_id, shared_by=shared_by, can_copy=can_copy, ) - general.add(share, with_commit=False) - shares.append(share) - - general.flush_or_commit(with_commit) + for user_id in shared_with_user_ids + ] + general.add_all(shares, with_commit=True) return shares diff --git a/cognition_objects/project.py b/cognition_objects/project.py index 51f5990..b3d723c 100644 --- a/cognition_objects/project.py +++ b/cognition_objects/project.py @@ -35,7 +35,7 @@ def get_org_id(project_id: str) -> str: raise ValueError(f"Project with id {project_id} not found") -def get_by_user(project_id: str, user_id: str) -> CognitionProject: +def get_by_user(project_id: str, user_id: str) -> List[Dict[str, Any]]: user_item = user.get(user_id) if user_item.role == enums.UserRoles.ENGINEER.value: return get(project_id) From f4b9d5d98d54cbcb0905fb28e52b5d647b396374 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Thu, 6 Nov 2025 16:23:02 +0100 Subject: [PATCH 10/12] filter conversation tags by user --- cognition_objects/conversation_tags.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cognition_objects/conversation_tags.py b/cognition_objects/conversation_tags.py index 33a92bc..d95b3c9 100644 --- a/cognition_objects/conversation_tags.py +++ b/cognition_objects/conversation_tags.py @@ -141,15 +141,19 @@ def delete_associations_by_conversation( def get_lookup_by_conversation_ids( - conversation_ids: List[str], + conversation_ids: List[str], user_id: Optional[str] = None ) -> Dict[str, List[Dict[str, Any]]]: - associations = ( - session.query(CognitionConversationTagAssociation) - .filter( - CognitionConversationTagAssociation.conversation_id.in_(conversation_ids) - ) - .all() + query = session.query(CognitionConversationTagAssociation) + if user_id is not None: + query = query.join( + CognitionConversationTag, + CognitionConversationTag.id == CognitionConversationTagAssociation.tag_id, + ).filter(CognitionConversationTag.created_by == user_id) + query = query.filter( + CognitionConversationTagAssociation.conversation_id.in_(conversation_ids) ) + associations = query.all() + tag_lookup: Dict[str, List[Dict[str, Any]]] = {} for association in associations: From 313b6485996d036a4e9b5df6cf6aed6845d79815 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Sun, 9 Nov 2025 16:08:31 +0100 Subject: [PATCH 11/12] PR comments --- cognition_objects/conversation_global_shares.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cognition_objects/conversation_global_shares.py b/cognition_objects/conversation_global_shares.py index 83ad8e8..b14aaa5 100644 --- a/cognition_objects/conversation_global_shares.py +++ b/cognition_objects/conversation_global_shares.py @@ -14,7 +14,7 @@ def get(conversation_global_share_id: str) -> Optional[ConversationGlobalShare]: ) -def get_by_conversation(conversation_id: str) -> List[ConversationGlobalShare]: +def get_by_conversation(conversation_id: str) -> Optional[ConversationGlobalShare]: return ( session.query(ConversationGlobalShare) .filter(ConversationGlobalShare.conversation_id == conversation_id) From 0d271272548c4c5b442f03e2cf61cbb4d059bd46 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Sun, 9 Nov 2025 16:14:24 +0100 Subject: [PATCH 12/12] PR comments --- cognition_objects/conversation_global_shares.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cognition_objects/conversation_global_shares.py b/cognition_objects/conversation_global_shares.py index b14aaa5..7152605 100644 --- a/cognition_objects/conversation_global_shares.py +++ b/cognition_objects/conversation_global_shares.py @@ -45,8 +45,7 @@ def delete_by_conversation( ) .delete() ) - if with_commit: - general.flush_or_commit(with_commit) + general.flush_or_commit(with_commit) def get_by_user(project_id: str, user_id: str) -> List[Dict[str, Any]]: