From 3243226e2d2e1eea300a066a73c8ec0f8675227a Mon Sep 17 00:00:00 2001 From: "David L. Qiu" Date: Tue, 10 Dec 2024 13:54:03 -0800 Subject: [PATCH 1/3] fix check release by bumping to impossible version --- .github/workflows/check-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml index 542206dc4..97b1f74d9 100644 --- a/.github/workflows/check-release.yml +++ b/.github/workflows/check-release.yml @@ -24,7 +24,7 @@ jobs: uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2 with: token: ${{ secrets.GITHUB_TOKEN }} - version_spec: minor + version_spec: "12.34.56" - name: Upload Distributions uses: actions/upload-artifact@v4 From 855b75dea955a14fc8fa076d801d486eadd3687f Mon Sep 17 00:00:00 2001 From: "David L. Qiu" Date: Tue, 10 Dec 2024 14:10:25 -0800 Subject: [PATCH 2/3] fix types --- .../jupyter_ai/chat_handlers/base.py | 18 ++++++++++++------ packages/jupyter-ai/jupyter_ai/extension.py | 9 ++++++--- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py index 233099151..1ff5d13dd 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py @@ -182,7 +182,7 @@ def __init__( self.context_providers = context_providers self.message_interrupted = message_interrupted self.ychat = ychat - self.indexes_by_id: Dict[str, str] = {} + self.indexes_by_id: Dict[str, int] = {} """ Indexes of messages in the YChat document by message ID. @@ -282,17 +282,23 @@ async def _default_handle_exc(self, e: Exception, message: HumanChatMessage): ) self.reply(response, message) - def write_message(self, body: str, id: Optional[str] = None) -> None: - """[Jupyter Chat only] Writes a message to the YChat shared document - that this chat handler is assigned to.""" + def write_message(self, body: str, id: Optional[str] = None) -> str: + """ + [Jupyter Chat only] Writes a message to the YChat shared document + that this chat handler is assigned to. + + Returns the new message ID. This will be identical to the `id` argument + if passed. + """ + # TODO: remove this once `ychat` becomes a required attribute. if not self.ychat: - return + return "" bot = self.ychat.get_user(BOT["username"]) if not bot: self.ychat.set_user(BOT) - index = self.indexes_by_id.get(id, None) + index = self.indexes_by_id.get(id, None) if id else None id = id if id else str(uuid4()) new_index = self.ychat.set_message( { diff --git a/packages/jupyter-ai/jupyter_ai/extension.py b/packages/jupyter-ai/jupyter_ai/extension.py index 7c02b9e40..83cc00c13 100644 --- a/packages/jupyter-ai/jupyter_ai/extension.py +++ b/packages/jupyter-ai/jupyter_ai/extension.py @@ -57,11 +57,11 @@ JCOLLAB_VERSION = int(jupyter_collaboration_version[0]) if JCOLLAB_VERSION >= 3: - from jupyter_server_ydoc.utils import ( # type:ignore[import-untyped] + from jupyter_server_ydoc.utils import ( # type:ignore[import-not-found,import-untyped] JUPYTER_COLLABORATION_EVENTS_URI, ) else: - from jupyter_collaboration.utils import ( # type:ignore[import-untyped] + from jupyter_collaboration.utils import ( # type:ignore[import-not-found,import-untyped] JUPYTER_COLLABORATION_EVENTS_URI, ) @@ -294,6 +294,7 @@ async def get_chat(self, room_id: str) -> Optional[YChat]: if room_id in self.ychats_by_room: return self.ychats_by_room[room_id] + assert self.serverapp if JCOLLAB_VERSION >= 3: collaboration = self.serverapp.web_app.settings["jupyter_server_ydoc"] document = await collaboration.get_document(room_id=room_id, copy=False) @@ -509,9 +510,11 @@ def _init_chat_handlers( TODO: Make `ychat` required once Jupyter Chat migration is complete. """ + assert self.serverapp + eps = entry_points() chat_handler_eps = eps.select(group="jupyter_ai.chat_handlers") - chat_handlers = {} + chat_handlers: Dict[str, BaseChatHandler] = {} chat_handler_kwargs = { "log": self.log, "config_manager": self.settings["jai_config_manager"], From 259de0a6a7cbaa9d9365c08cfd675748b19867bd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 10 Dec 2024 22:27:13 +0000 Subject: [PATCH 3/3] Update Playwright Snapshots --- .../sidebar-linux.png | Bin 2246 -> 893 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/packages/jupyter-ai/ui-tests/tests/jupyter-ai.spec.ts-snapshots/sidebar-linux.png b/packages/jupyter-ai/ui-tests/tests/jupyter-ai.spec.ts-snapshots/sidebar-linux.png index 7b310395501cc8eaadefc72ef2f078b896f92f74..acfd60c1d929f7b67ab8e89506ed883860a3426a 100644 GIT binary patch delta 881 zcmX>m_?K;hWIY2A_@8Py2Ba8^gWR1M)}51i$-uyD?&;zfQgQ3;jobdhjv{OY|E{iI z+UVr)l+$^Si+O{1$HykakaxS1nglqS#BYU&6n1EEwF)@wEYb8henh>K|Hp;A?VGJ{ z_p&4@+^>A~box!>^s+Rg;4%S`R1pz(rA^7rUOj(HI`7wq7P!8Z4~^*1efDUr@3zp5 ztp}NZ2islxuXTy_qxSU7&GphhC2Y{}pd})8o)qT}p+?n0xe{OyBk$7HmlVT$=9f{rt$Z`5xshMW+*XST7d6oIZEyro1raWzI)eXZ~E{Ub8+#{LbcS z(MRrNe-fU4LyNs(hCsa&$3;GdtJSL{*cm$Rh%++G2y)#WK4aC6r=q#5c03j>554$Q z)OJ-zwQG>*Z9#??=f7@~XINytuB&vH_O}zUm%mDh&hf5x%UifhVov0>o_|GinO|N1 zk{_V+pJ~eXcR%*FN+-*jNAG$hmafXmdi16E%7^Fc9!0<3`c8BwOG1$TrTVQ5tIXOM zj@T&uUSOJus!L?9lVxX+3@7S%!vFp`kWx4bMM^ALfYtb%UMZMX>AqL<#@nhZ!0!Tv(Dh zEA38nf5?q{4QaKj?uFb~r1y*C`GxTMc~`q+FLQS18?gf2mw5Es^_+$sO%Fp4cYZwF z@nE^Z<^K~kK{B2K-7^_3Hh64W@`Gu?)+HUxE53^^?rjU?UvS8v=l5zU#VOT$(t15K z7X6#iGUfAh*}%jtXS1qicWQ+1jr6sh(tUEmQ&IgXA@6q1pJWu>^>3YU_B@}*Km9`L ze|%HrW0)$xq;zqLt(=$Ub%qCf+;l|OP3X?+id~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