From 608c8df91f546225cd1b99202e6dc1a56d89348f Mon Sep 17 00:00:00 2001 From: tcollins2011 Date: Tue, 29 Oct 2024 17:47:31 -0400 Subject: [PATCH] added tool id to chatgxy_response table --- client/src/components/GalaxyWizard.vue | 5 +++-- lib/galaxy/model/__init__.py | 1 + .../versions_gxy/8067ed6a55e7_create_chatgxy_table.py | 1 + lib/galaxy/webapps/galaxy/api/chat.py | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/src/components/GalaxyWizard.vue b/client/src/components/GalaxyWizard.vue index 9280a71846c7..ab166d427a3d 100644 --- a/client/src/components/GalaxyWizard.vue +++ b/client/src/components/GalaxyWizard.vue @@ -56,16 +56,17 @@ function submitQuery() {
Ask the wizard -
+ diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 18b0ba2e6831..fe0636afcad8 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -11544,6 +11544,7 @@ class ChatGXYResponses(Base): id: Mapped[int] = mapped_column(primary_key=True) job_id: Mapped[Optional[int]] = mapped_column(ForeignKey("job.id"), index=True) + tool_id: Mapped[Optional[int]] = mapped_column(ForeignKey("tool.id"), index=True) response: Mapped[str] = mapped_column(TEXT, nullable=False) feedback: Mapped[int] = mapped_column(Integer, nullable=True) diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/8067ed6a55e7_create_chatgxy_table.py b/lib/galaxy/model/migrations/alembic/versions_gxy/8067ed6a55e7_create_chatgxy_table.py index 1ecb5ea9f380..f109767df932 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/8067ed6a55e7_create_chatgxy_table.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/8067ed6a55e7_create_chatgxy_table.py @@ -31,6 +31,7 @@ def upgrade(): table_name, Column('id', Integer, primary_key=True), Column('job_id', Integer, ForeignKey('job.id'), index=True), + Column('tool_id', Integer, ForeignKey('tool.id'), index=True), Column('response', Text, nullable=False), Column('feedback', Integer, nullable=True), ) diff --git a/lib/galaxy/webapps/galaxy/api/chat.py b/lib/galaxy/webapps/galaxy/api/chat.py index 08cadff2612f..37d3fe290f81 100644 --- a/lib/galaxy/webapps/galaxy/api/chat.py +++ b/lib/galaxy/webapps/galaxy/api/chat.py @@ -34,6 +34,9 @@ class ChatAPI: @router.post("/api/chat") def query(self, query: ChatPayload, trans: ProvidesUserContext = DependsOnTrans) -> str: """We're off to ask the wizard""" + + # Add logic to check if the job id is in the chatgxy_responses table, if it is return the response + self._ensure_openai_configured() messages = self._build_messages(query, trans)