From 7b62b61d52a4d8055df63a64498fbbc1460805de Mon Sep 17 00:00:00 2001 From: Nicolas Brichet <32258950+brichet@users.noreply.github.com> Date: Fri, 22 Nov 2024 18:31:25 +0100 Subject: [PATCH] Update extension to jupyterlab_chat (0.6.0) (#8) --- .../{{cookiecutter.python_name}}/slash_command.py | 2 +- .../jupyter_ai_test/test_slash_commands.py | 2 +- .../jupyter-ai/jupyter_ai/chat_handlers/__init__.py | 2 +- packages/jupyter-ai/jupyter_ai/chat_handlers/ask.py | 2 +- packages/jupyter-ai/jupyter_ai/chat_handlers/base.py | 4 ++-- packages/jupyter-ai/jupyter_ai/chat_handlers/clear.py | 2 +- .../jupyter-ai/jupyter_ai/chat_handlers/default.py | 2 +- packages/jupyter-ai/jupyter_ai/chat_handlers/export.py | 2 +- packages/jupyter-ai/jupyter_ai/chat_handlers/fix.py | 2 +- .../jupyter-ai/jupyter_ai/chat_handlers/generate.py | 2 +- packages/jupyter-ai/jupyter_ai/chat_handlers/help.py | 2 +- packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py | 2 +- packages/jupyter-ai/jupyter_ai/extension.py | 2 +- packages/jupyter-ai/package.json | 2 +- packages/jupyter-ai/pyproject.toml | 2 +- packages/jupyter-ai/src/components/chat-settings.tsx | 4 ++-- packages/jupyter-ai/src/index.ts | 6 +++--- yarn.lock | 10 +++++----- 18 files changed, 26 insertions(+), 26 deletions(-) diff --git a/packages/jupyter-ai-module-cookiecutter/{{cookiecutter.root_dir_name}}/{{cookiecutter.python_name}}/slash_command.py b/packages/jupyter-ai-module-cookiecutter/{{cookiecutter.root_dir_name}}/{{cookiecutter.python_name}}/slash_command.py index d8f7a1443..6a97facdf 100644 --- a/packages/jupyter-ai-module-cookiecutter/{{cookiecutter.root_dir_name}}/{{cookiecutter.python_name}}/slash_command.py +++ b/packages/jupyter-ai-module-cookiecutter/{{cookiecutter.root_dir_name}}/{{cookiecutter.python_name}}/slash_command.py @@ -2,7 +2,7 @@ from jupyter_ai.models import HumanChatMessage try: - from jupyterlab_collaborative_chat.ychat import YChat + from jupyterlab_chat.ychat import YChat except: from typing import Any as YChat diff --git a/packages/jupyter-ai-test/jupyter_ai_test/test_slash_commands.py b/packages/jupyter-ai-test/jupyter_ai_test/test_slash_commands.py index f4ae3dcfb..2060b7bf4 100644 --- a/packages/jupyter-ai-test/jupyter_ai_test/test_slash_commands.py +++ b/packages/jupyter-ai-test/jupyter_ai_test/test_slash_commands.py @@ -2,7 +2,7 @@ from jupyter_ai.models import HumanChatMessage try: - from jupyterlab_collaborative_chat.ychat import YChat + from jupyterlab_chat.ychat import YChat except: from typing import Any as YChat diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/__init__.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/__init__.py index a46b74e4d..463369244 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/__init__.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/__init__.py @@ -1,5 +1,5 @@ # The following import is to make sure jupyter_ydoc is imported before -# jupyterlab_collaborative_chat, otherwise it leads to circular import because of the +# jupyterlab_chat, otherwise it leads to circular import because of the # YChat relying on YBaseDoc, and jupyter_ydoc registering YChat from the entry point. import jupyter_ydoc diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/ask.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/ask.py index 56228b43e..7c4b546ca 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/ask.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/ask.py @@ -8,7 +8,7 @@ from langchain_core.prompts import PromptTemplate try: - from jupyterlab_collaborative_chat.ychat import YChat + from jupyterlab_chat.ychat import YChat except: from typing import Any as YChat diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py index 853335cbb..5f91f507c 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py @@ -45,7 +45,7 @@ from langchain_core.runnables.utils import Input try: - from jupyterlab_collaborative_chat.ychat import YChat + from jupyterlab_chat.ychat import YChat except: from typing import Any as YChat @@ -392,7 +392,7 @@ def pending( Context manager that sends a pending message to the client, and closes it after the block is executed. - TODO: Simplify it by only modifying the awareness as soon as collaborative chat + TODO: Simplify it by only modifying the awareness as soon as jupyterlab chat is the only used chat. """ pending_msg = self.start_pending(text, human_msg=human_msg, chat=chat, ellipsis=ellipsis) diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/clear.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/clear.py index 1d378009d..a22aca777 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/clear.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/clear.py @@ -3,7 +3,7 @@ from jupyter_ai.models import ClearRequest try: - from jupyterlab_collaborative_chat.ychat import YChat + from jupyterlab_chat.ychat import YChat except: from typing import Any as YChat diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/default.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/default.py index 0e2765adb..9b0185e57 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/default.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/default.py @@ -7,7 +7,7 @@ from langchain_core.runnables.history import RunnableWithMessageHistory try: - from jupyterlab_collaborative_chat.ychat import YChat + from jupyterlab_chat.ychat import YChat except: from typing import Any as YChat diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/export.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/export.py index ce114473d..6b7795869 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/export.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/export.py @@ -6,7 +6,7 @@ from jupyter_ai.models import AgentChatMessage, AgentStreamMessage, HumanChatMessage try: - from jupyterlab_collaborative_chat.ychat import YChat + from jupyterlab_chat.ychat import YChat except: from typing import Any as YChat diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/fix.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/fix.py index 8e0b765a4..30f715274 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/fix.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/fix.py @@ -5,7 +5,7 @@ from langchain.prompts import PromptTemplate try: - from jupyterlab_collaborative_chat.ychat import YChat + from jupyterlab_chat.ychat import YChat except: from typing import Any as YChat diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/generate.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/generate.py index 36273c78b..2a5d9612e 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/generate.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/generate.py @@ -17,7 +17,7 @@ from langchain_core.prompts import PromptTemplate try: - from jupyterlab_collaborative_chat.ychat import YChat + from jupyterlab_chat.ychat import YChat except: from typing import Any as YChat diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/help.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/help.py index 82b6e8607..ca118f30d 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/help.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/help.py @@ -3,7 +3,7 @@ from jupyter_ai.models import HumanChatMessage try: - from jupyterlab_collaborative_chat.ychat import YChat + from jupyterlab_chat.ychat import YChat except: from typing import Any as YChat diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py index a74c147de..305afa495 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py @@ -31,7 +31,7 @@ from langchain_community.vectorstores import FAISS try: - from jupyterlab_collaborative_chat.ychat import YChat + from jupyterlab_chat.ychat import YChat except: from typing import Any as YChat diff --git a/packages/jupyter-ai/jupyter_ai/extension.py b/packages/jupyter-ai/jupyter_ai/extension.py index 9ecdf1cda..79430e04a 100644 --- a/packages/jupyter-ai/jupyter_ai/extension.py +++ b/packages/jupyter-ai/jupyter_ai/extension.py @@ -17,7 +17,7 @@ from jupyter_events import EventLogger from jupyter_server.extension.application import ExtensionApp from jupyter_server.utils import url_path_join -from jupyterlab_collaborative_chat.ychat import YChat +from jupyterlab_chat.ychat import YChat from pycrdt import ArrayEvent from tornado.web import StaticFileHandler from traitlets import Dict, Integer, List, Unicode diff --git a/packages/jupyter-ai/package.json b/packages/jupyter-ai/package.json index ff56520df..d0c899662 100644 --- a/packages/jupyter-ai/package.json +++ b/packages/jupyter-ai/package.json @@ -61,7 +61,7 @@ "dependencies": { "@emotion/react": "^11.10.5", "@emotion/styled": "^11.10.5", - "@jupyter/chat": "^0.5.0", + "@jupyter/chat": "^0.6.0", "@jupyter/collaboration": "^1", "@jupyterlab/application": "^4.2.0", "@jupyterlab/apputils": "^4.2.0", diff --git a/packages/jupyter-ai/pyproject.toml b/packages/jupyter-ai/pyproject.toml index 9fd9ea274..90581c718 100644 --- a/packages/jupyter-ai/pyproject.toml +++ b/packages/jupyter-ai/pyproject.toml @@ -35,7 +35,7 @@ dependencies = [ "typing_extensions>=4.5.0", "traitlets>=5.0", "deepmerge>=2.0,<3", - "jupyterlab-collaborative-chat>=0.5.0", + "jupyterlab-chat>=0.6.0", ] dynamic = ["version", "description", "authors", "urls", "keywords"] diff --git a/packages/jupyter-ai/src/components/chat-settings.tsx b/packages/jupyter-ai/src/components/chat-settings.tsx index b9e9d8bd1..78312edee 100644 --- a/packages/jupyter-ai/src/components/chat-settings.tsx +++ b/packages/jupyter-ai/src/components/chat-settings.tsx @@ -34,7 +34,7 @@ type ChatSettingsProps = { rmRegistry: IRenderMimeRegistry; completionProvider: IJaiCompletionProvider | null; openInlineCompleterSettings: () => void; - // The temporary input options, should be removed when the collaborative chat is + // The temporary input options, should be removed when jupyterlab chat is // the only chat. inputOptions?: boolean; }; @@ -514,7 +514,7 @@ export function ChatSettings(props: ChatSettingsProps): JSX.Element { onSuccess={server.refetchApiKeys} /> - {/* Input - to remove when the collaborative chat is the only chat */} + {/* Input - to remove when jupyterlab chat is the only chat */} {(props.inputOptions ?? true) && ( <>

Input

diff --git a/packages/jupyter-ai/src/index.ts b/packages/jupyter-ai/src/index.ts index e08cfcd2b..c6d965ce0 100644 --- a/packages/jupyter-ai/src/index.ts +++ b/packages/jupyter-ai/src/index.ts @@ -184,9 +184,9 @@ const plugin: JupyterFrontEndPlugin = { }; /** - * Add slash commands to collaborative chat. + * Add slash commands to jupyterlab chat. */ -const collaborative_autocompletion: JupyterFrontEndPlugin = { +const chat_autocompletion: JupyterFrontEndPlugin = { id: '@jupyter-ai/core:autocompletion', autoStart: true, requires: [IAutocompletionRegistry], @@ -203,7 +203,7 @@ export default [ statusItemPlugin, completionPlugin, menuPlugin, - collaborative_autocompletion + chat_autocompletion ]; export * from './contexts'; diff --git a/yarn.lock b/yarn.lock index a36cfc1dd..dea68e659 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2220,7 +2220,7 @@ __metadata: "@babel/preset-env": ^7.0.0 "@emotion/react": ^11.10.5 "@emotion/styled": ^11.10.5 - "@jupyter/chat": ^0.5.0 + "@jupyter/chat": ^0.6.0 "@jupyter/collaboration": ^1 "@jupyterlab/application": ^4.2.0 "@jupyterlab/apputils": ^4.2.0 @@ -2286,9 +2286,9 @@ __metadata: languageName: unknown linkType: soft -"@jupyter/chat@npm:^0.5.0": - version: 0.5.0 - resolution: "@jupyter/chat@npm:0.5.0" +"@jupyter/chat@npm:^0.6.0": + version: 0.6.0 + resolution: "@jupyter/chat@npm:0.6.0" dependencies: "@emotion/react": ^11.10.5 "@emotion/styled": ^11.10.5 @@ -2307,7 +2307,7 @@ __metadata: clsx: ^2.1.0 react: ^18.2.0 react-dom: ^18.2.0 - checksum: 0c935344e3cf8b60ded1df83c1b608f77becd7ea8c82c175a8588606c6c56a46525130b429b5acfaab441d9ccac9d478b25646bdb8aa3dfd1af82c8f372e07cf + checksum: 1af125488113fbe9089014ae2fd6bf39f5645e6a8387ee513cbae2ed24183ebd6611347e6c6bca05832a6d90fdb001ebce508f7b08e3ae92edd9946b9253dec9 languageName: node linkType: hard