Skip to content

Commit 6ef7188

Browse files
authored
Merge branch 'master' into fix/handler-wrong-password
2 parents 02bb36c + 13d4661 commit 6ef7188

File tree

27 files changed

+201
-69
lines changed

27 files changed

+201
-69
lines changed

packages/models-library/src/models_library/api_schemas_webserver/groups.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ class MyGroupsGet(OutputSchema):
202202
description="Group ID of the app support team or None if no support is defined for this product"
203203
),
204204
] = None
205+
chatbot: Annotated[
206+
GroupGetBase | None,
207+
Field(
208+
description="Group ID of the support chatbot user or None if no chatbot is defined for this product"
209+
),
210+
] = None
205211

206212
model_config = ConfigDict(
207213
json_schema_extra={
@@ -246,6 +252,12 @@ class MyGroupsGet(OutputSchema):
246252
"description": "The support team of the application",
247253
"thumbnail": "https://placekitten.com/15/15",
248254
},
255+
"chatbot": {
256+
"gid": "6",
257+
"label": "Chatbot User",
258+
"description": "The chatbot user of the application",
259+
"thumbnail": "https://placekitten.com/15/15",
260+
},
249261
}
250262
}
251263
)
@@ -256,6 +268,7 @@ def from_domain_model(
256268
groups_by_type: GroupsByTypeTuple,
257269
my_product_group: tuple[Group, AccessRightsDict] | None,
258270
product_support_group: Group | None,
271+
product_chatbot_primary_group: Group | None,
259272
) -> Self:
260273
assert groups_by_type.primary # nosec
261274
assert groups_by_type.everyone # nosec
@@ -278,6 +291,13 @@ def from_domain_model(
278291
if product_support_group
279292
else None
280293
),
294+
chatbot=(
295+
GroupGetBase.model_validate(
296+
GroupGetBase.dump_basic_group_data(product_chatbot_primary_group)
297+
)
298+
if product_chatbot_primary_group
299+
else None
300+
),
281301
)
282302

283303

packages/models-library/src/models_library/api_schemas_webserver/users.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def from_domain_model(
178178
my_product_group: tuple[Group, AccessRightsDict] | None,
179179
my_preferences: AggregatedPreferences,
180180
my_support_group: Group | None,
181+
my_chatbot_user_group: Group | None,
181182
profile_contact: MyProfileAddressGet | None = None,
182183
) -> Self:
183184
profile_data = remap_keys(
@@ -200,7 +201,10 @@ def from_domain_model(
200201
return cls(
201202
**profile_data,
202203
groups=MyGroupsGet.from_domain_model(
203-
my_groups_by_type, my_product_group, my_support_group
204+
my_groups_by_type,
205+
my_product_group,
206+
my_support_group,
207+
my_chatbot_user_group,
204208
),
205209
preferences=my_preferences,
206210
contact=profile_contact,

packages/models-library/src/models_library/conversations.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class ConversationType(StrAutoEnum):
2424
auto() # Something like sticky note, can be located anywhere in the pipeline UI
2525
)
2626
SUPPORT = auto() # Support conversation
27+
SUPPORT_CALL = auto() # Support call conversation
28+
29+
def is_support_type(self) -> bool:
30+
return self in {ConversationType.SUPPORT, ConversationType.SUPPORT_CALL}
2731

2832

2933
class ConversationMessageType(StrAutoEnum):

packages/models-library/src/models_library/groups.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ def _update_json_schema_extra(schema: JsonDict) -> None:
7777
"type": "standard",
7878
"thumbnail": None,
7979
}
80+
chatbot: JsonDict = {
81+
"gid": 5,
82+
"name": "Chatbot",
83+
"description": "chatbot group",
84+
"type": "primary",
85+
"thumbnail": None,
86+
}
8087

8188
schema.update(
8289
{
@@ -86,6 +93,7 @@ def _update_json_schema_extra(schema: JsonDict) -> None:
8693
organization,
8794
product,
8895
support,
96+
chatbot,
8997
]
9098
}
9199
)

packages/models-library/tests/test_users.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
from pydantic import TypeAdapter
99

1010

11+
@pytest.mark.parametrize("with_chatbot_user_group", [True, False])
1112
@pytest.mark.parametrize("with_support_group", [True, False])
1213
@pytest.mark.parametrize("with_standard_groups", [True, False])
1314
def test_adapter_from_model_to_schema(
14-
with_support_group: bool, with_standard_groups: bool
15+
with_support_group: bool, with_standard_groups: bool, with_chatbot_user_group: bool
1516
):
1617
my_profile = MyProfile.model_validate(MyProfile.model_json_schema()["example"])
1718

@@ -31,6 +32,7 @@ def test_adapter_from_model_to_schema(
3132
)
3233

3334
my_support_group = groups[4]
35+
my_chatbot_user_group = groups[5]
3436

3537
my_preferences = {"foo": Preference(default_value=3, value=1)}
3638

@@ -40,4 +42,5 @@ def test_adapter_from_model_to_schema(
4042
my_product_group,
4143
my_preferences,
4244
my_support_group if with_support_group else None,
45+
my_chatbot_user_group if with_chatbot_user_group else None,
4346
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Add SUPPORT_CALL conversationt ype
2+
3+
Revision ID: 5756d9282a0a
4+
Revises: ff13501db935
5+
Create Date: 2025-10-21 13:40:20.182151+00:00
6+
7+
"""
8+
9+
import sqlalchemy as sa
10+
from alembic import op
11+
12+
# revision identifiers, used by Alembic.
13+
revision = "5756d9282a0a"
14+
down_revision = "ff13501db935"
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
# ### commands auto generated by Alembic - please adjust! ###
21+
op.alter_column("products", "base_url", existing_type=sa.VARCHAR(), nullable=False)
22+
23+
op.execute("ALTER TYPE conversationtype ADD VALUE 'SUPPORT_CALL'")
24+
25+
# ### end Alembic commands ###
26+
27+
28+
def downgrade():
29+
# ### commands auto generated by Alembic - please adjust! ###
30+
op.alter_column("products", "base_url", existing_type=sa.VARCHAR(), nullable=True)
31+
# ### end Alembic commands ###

packages/postgres-database/src/simcore_postgres_database/models/conversations.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class ConversationType(enum.Enum):
1313
PROJECT_STATIC = "PROJECT_STATIC" # Static conversation for the project
1414
PROJECT_ANNOTATION = "PROJECT_ANNOTATION" # Something like sticky note, can be located anywhere in the pipeline UI
1515
SUPPORT = "SUPPORT" # Support conversation
16+
SUPPORT_CALL = "SUPPORT_CALL" # Support call conversation
1617

1718

1819
conversations = sa.Table(

services/agent/src/simcore_service_agent/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
from fastapi import FastAPI
66
from servicelib.fastapi.logging_lifespan import create_logging_shutdown_event
77
from servicelib.tracing import TracingConfig
8+
from simcore_service_agent._meta import APP_NAME
89
from simcore_service_agent.core.application import create_app
910
from simcore_service_agent.core.settings import ApplicationSettings
1011

11-
from ._meta import APP_NAME
12-
1312
_logger = logging.getLogger(__name__)
1413

1514
_NOISY_LOGGERS: Final[tuple[str, ...]] = (

services/api-server/src/simcore_service_api_server/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
from fastapi import FastAPI
88
from servicelib.fastapi.logging_lifespan import create_logging_shutdown_event
99
from servicelib.tracing import TracingConfig
10+
from simcore_service_api_server._meta import APP_NAME
1011
from simcore_service_api_server.core.application import create_app
1112
from simcore_service_api_server.core.settings import ApplicationSettings
1213

13-
from ._meta import APP_NAME
14-
1514
_logger = logging.getLogger(__name__)
1615

1716
_NOISY_LOGGERS: Final[tuple[str, ...]] = (

services/autoscaling/src/simcore_service_autoscaling/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
from fastapi import FastAPI
88
from servicelib import tracing
99
from servicelib.fastapi.logging_lifespan import create_logging_shutdown_event
10+
from simcore_service_autoscaling._meta import APP_NAME
1011
from simcore_service_autoscaling.core.application import create_app
1112
from simcore_service_autoscaling.core.settings import ApplicationSettings
1213

13-
from ._meta import APP_NAME
14-
1514
_logger = logging.getLogger(__name__)
1615

1716
_NOISY_LOGGERS: Final[tuple[str, ...]] = (

0 commit comments

Comments
 (0)