From 66d782e1da18fd9f59a0598d8d46ed7d1d23fcc3 Mon Sep 17 00:00:00 2001 From: Ville Kr Date: Wed, 29 May 2024 08:28:52 +0300 Subject: [PATCH] Dependency updates (#37) * Upgrade dependency versions * Langchain deprecation warning fixes * Enable scroll to end when opening app --- pyproject.toml | 13 +++++++------ src/paita/__about__.py | 2 +- src/paita/ai/chat_history.py | 2 +- src/paita/tui/app.py | 6 +----- tests/integration/ai/test_chat.py | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bc323c2..3bfe26f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,19 +21,20 @@ classifiers = [ "Programming Language :: Python :: Implementation :: PyPy", ] dependencies = [ - "textual==0.54", + "textual~=0.63", "boto3~=1.34", "loguru~=0.7", - "langchain~=0.1", + "langchain-core~=0.2", + "langchain-community~=0.2", "langchain-openai~=0.1", + "langchain~=0.2", "appdirs~=1.4", - "pydantic~=2.6", + "pydantic~=2.7", "cache3~=0.4", "aiofiles~=23.2", "pyperclip~=1.8", - "eval-type-backport~=0.1", - "aiohttp~=3.9.3", - "ollama~=0.1.8", + "eval-type-backport~=0.2", + "ollama~=0.2", ] [project.urls] diff --git a/src/paita/__about__.py b/src/paita/__about__.py index 73bc3ab..21c143f 100644 --- a/src/paita/__about__.py +++ b/src/paita/__about__.py @@ -1,4 +1,4 @@ # SPDX-FileCopyrightText: 2024-present Ville Kärkkäinen # # SPDX-License-Identifier: MIT -__version__ = "0.1.10" +__version__ = "0.1.11" diff --git a/src/paita/ai/chat_history.py b/src/paita/ai/chat_history.py index 6cb5029..5e1007a 100644 --- a/src/paita/ai/chat_history.py +++ b/src/paita/ai/chat_history.py @@ -1,6 +1,6 @@ from typing import TYPE_CHECKING -from langchain.memory import ChatMessageHistory, FileChatMessageHistory +from langchain_community.chat_message_histories import ChatMessageHistory, FileChatMessageHistory from langchain_core.chat_history import AIMessage, BaseChatMessageHistory from paita.ai.enums import Role diff --git a/src/paita/tui/app.py b/src/paita/tui/app.py index 3a4dc3a..cb0a945 100644 --- a/src/paita/tui/app.py +++ b/src/paita/tui/app.py @@ -111,10 +111,7 @@ def exit_settings(self, changed: bool = False): # noqa: FBT001, FBT002 self.init_chat() async def on_mount(self) -> None: - # TODO: If history is loaded here then scroll to end works - # however input area text doesn't work properly - # when calling _mount_chat_history later then text input works but scroll not - # await self._mount_chat_history() + await self._mount_chat_history() try: await self.push_screen(WaitScreen(label.APP_LIST_AI_SERVICES_MODELS)) await self._list_models() @@ -130,7 +127,6 @@ async def on_mount(self) -> None: self.exit, ) return - await self._mount_chat_history() # Read existing settings or open settings screen try: self._settings: SettingsManager = await SettingsManager.load( diff --git a/tests/integration/ai/test_chat.py b/tests/integration/ai/test_chat.py index 61f0766..d625563 100644 --- a/tests/integration/ai/test_chat.py +++ b/tests/integration/ai/test_chat.py @@ -8,7 +8,7 @@ ai_service_models = { AIService.AWSBedRock.value: "anthropic.claude-v2", AIService.OpenAI.value: "gpt-3.5-turbo", - AIService.Ollama.value: "openchat", + AIService.Ollama.value: "llama3:latest", }