Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
945ca4f
introudce chatbot client skeleton
matusdrobuliak66 Oct 14, 2025
3972828
introudce chatbot client skeleton
matusdrobuliak66 Oct 14, 2025
f5f8b9f
fix
matusdrobuliak66 Oct 14, 2025
99968ce
Merge branch 'master' into introduce-chatbot-client
matusdrobuliak66 Oct 15, 2025
81dcbe4
improve
matusdrobuliak66 Oct 15, 2025
910f649
modify docker compose
matusdrobuliak66 Oct 15, 2025
e18dcb9
review @GitHK
matusdrobuliak66 Oct 15, 2025
fdad989
review @pcrespov
matusdrobuliak66 Oct 15, 2025
0cbd54e
review @pcrespov
matusdrobuliak66 Oct 15, 2025
a8bb667
review @pcrespov
matusdrobuliak66 Oct 15, 2025
7397e6e
fix
matusdrobuliak66 Oct 15, 2025
fa97066
fix
matusdrobuliak66 Oct 15, 2025
3bbc3f9
fix
matusdrobuliak66 Oct 15, 2025
6f6e332
fix
matusdrobuliak66 Oct 15, 2025
51fd6c5
Merge branch 'master' into introduce-chatbot-client
matusdrobuliak66 Oct 15, 2025
82740f3
review @pcrespov
matusdrobuliak66 Oct 15, 2025
2625b5e
introduce AI answering support requests
matusdrobuliak66 Oct 16, 2025
972f425
improve
matusdrobuliak66 Oct 16, 2025
c31c94a
introduce to store in app state the product url
matusdrobuliak66 Oct 17, 2025
dd13139
Merge branch 'master' into use-new-chatbot-client
matusdrobuliak66 Oct 17, 2025
9ff225e
fix
matusdrobuliak66 Oct 17, 2025
d05e7e2
fix
matusdrobuliak66 Oct 17, 2025
6a35bc3
fix
matusdrobuliak66 Oct 17, 2025
d257e87
fix
matusdrobuliak66 Oct 17, 2025
f543b97
fix
matusdrobuliak66 Oct 17, 2025
c449228
fix
matusdrobuliak66 Oct 17, 2025
18beecf
fix
matusdrobuliak66 Oct 17, 2025
95e47bd
fix
matusdrobuliak66 Oct 17, 2025
e93a8b8
adding unit tests
matusdrobuliak66 Oct 19, 2025
55bee35
fixes
matusdrobuliak66 Oct 19, 2025
a777cf8
fixes
matusdrobuliak66 Oct 19, 2025
030fb4e
fixes
matusdrobuliak66 Oct 19, 2025
8664acc
Merge branch 'master' into use-new-chatbot-client
matusdrobuliak66 Oct 19, 2025
8038645
fixes
matusdrobuliak66 Oct 20, 2025
3d580a3
fixes
matusdrobuliak66 Oct 20, 2025
f472fee
fixes
matusdrobuliak66 Oct 20, 2025
d9df8ff
fixes
matusdrobuliak66 Oct 20, 2025
d00ed40
fixes
matusdrobuliak66 Oct 20, 2025
e69e74a
fixes
matusdrobuliak66 Oct 20, 2025
b0c54fa
fixes
matusdrobuliak66 Oct 20, 2025
1c561e1
fixes
matusdrobuliak66 Oct 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions packages/models-library/src/models_library/conversations.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ class ConversationMessageType(StrAutoEnum):
#


IsSupportUser: TypeAlias = bool
class ConversationUserType(StrAutoEnum):
SUPPORT_USER = auto()
CHATBOT_USER = auto()
REGULAR_USER = auto()


class ConversationGetDB(BaseModel):
Expand All @@ -58,7 +61,29 @@ class ConversationGetDB(BaseModel):
modified: datetime
last_message_created_at: datetime

model_config = ConfigDict(from_attributes=True)
model_config = ConfigDict(
from_attributes=True,
json_schema_extra={
"examples": [
# Support message
{
"conversation_id": "42838344-03de-4ce2-8d93-589a5dcdfd05",
"product_name": "osparc",
"name": "test_conversation",
"project_uuid": "42838344-03de-4ce2-8d93-589a5dcdfd05",
"user_group_id": "789",
"type": ConversationType.SUPPORT,
"extra_context": {},
"fogbugz_case_id": None,
"is_read_by_user": False,
"is_read_by_support": False,
"created": "2024-01-01T12:00:00",
"modified": "2024-01-01T12:00:00",
"last_message_created_at": "2024-01-01T12:00:00",
}
]
},
)


class ConversationMessageGetDB(BaseModel):
Expand Down
12 changes: 12 additions & 0 deletions packages/models-library/src/models_library/rabbitmq_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from common_library.basic_types import DEFAULT_FACTORY
from pydantic import BaseModel, Field

from .conversations import ConversationGetDB, ConversationMessageID
from .products import ProductName
from .progress_bar import ProgressReport
from .projects import ProjectID
Expand Down Expand Up @@ -93,6 +94,17 @@ def routing_key(self) -> str | None:
return None


class WebserverChatbotRabbitMessage(RabbitMessageBase):
channel_name: Literal["simcore.services.webserver-chatbot"] = (
"simcore.services.webserver-chatbot"
)
conversation: ConversationGetDB
last_message_id: ConversationMessageID

def routing_key(self) -> str | None:
return None


class ProgressType(StrAutoEnum):
COMPUTATION_RUNNING = auto() # NOTE: this is the original only progress report

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""add chatbot user id to products table

Revision ID: e1c7e416461c
Revises: f641b3eacafd
Create Date: 2025-10-16 07:51:44.033767+00:00

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "e1c7e416461c"
down_revision = "f641b3eacafd"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"products", sa.Column("support_chatbot_user_id", sa.BigInteger(), nullable=True)
)
op.create_foreign_key(
"fk_products_support_chatbot_user_id",
"products",
"users",
["support_chatbot_user_id"],
["id"],
onupdate="CASCADE",
ondelete="SET NULL",
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(
"fk_products_support_chatbot_user_id", "products", type_="foreignkey"
)
op.drop_column("products", "support_chatbot_user_id")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Add base_url to product table

Revision ID: ff13501db935
Revises: e1c7e416461c
Create Date: 2025-10-17 14:48:02.509847+00:00

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "ff13501db935"
down_revision = "e1c7e416461c"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("products", sa.Column("base_url", sa.String(), nullable=True))
# ### end Alembic commands ###

op.execute("UPDATE products SET base_url = 'http://CHANGE_ME.localhost'")

op.alter_column("products", "base_url", existing_type=sa.String(), nullable=True)


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("products", "base_url")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .base import metadata
from .groups import groups
from .jinja2_templates import jinja2_templates
from .users import users

# NOTE: a default entry is created in the table Product
# see packages/postgres-database/src/simcore_postgres_database/migration/versions/350103a7efbd_modified_products_table.py
Expand Down Expand Up @@ -153,6 +154,12 @@ class ProductLoginSettingsDict(TypedDict, total=False):
nullable=False,
doc="Regular expression that matches product hostname from an url string",
),
sa.Column(
"base_url",
sa.String,
nullable=False,
doc="Product base URL (scheme + host), ex. https://osparc.io",
),
# EMAILS --------------------
sa.Column(
"support_email",
Expand Down Expand Up @@ -281,6 +288,19 @@ class ProductLoginSettingsDict(TypedDict, total=False):
nullable=True,
doc="Group associated to this product support",
),
sa.Column(
"support_chatbot_user_id",
sa.BigInteger,
sa.ForeignKey(
users.c.id,
name="fk_products_support_chatbot_user_id",
ondelete=RefActions.SET_NULL,
onupdate=RefActions.CASCADE,
),
unique=False,
nullable=True,
doc="User associated to this product chatbot user",
),
sa.Column(
"support_assigned_fogbugz_person_id",
sa.BigInteger,
Expand Down
4 changes: 3 additions & 1 deletion packages/postgres-database/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ async def _creator(product_name: str) -> Row:
async with asyncpg_engine.begin() as connection:
result = await connection.execute(
sa.insert(products)
.values(name=product_name, host_regex=".*")
.values(
name=product_name, host_regex=".*", base_url="https://example.com"
)
.returning(sa.literal_column("*"))
)
assert result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ def random_product(
"display_name": suffix.capitalize().replace("_", " "),
"short_name": suffix[:4],
"host_regex": r"[a-zA-Z0-9]+\.com",
"base_url": f"https://{suffix}.com",
"support_email": f"support@{suffix}.io",
"product_owners_email": fake.random_element(
elements=[f"product-owners@{suffix}.io", None]
Expand Down
Loading
Loading