Skip to content

Commit

Permalink
Fix crash when starting the app an existing db.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggozad committed Sep 6, 2024
1 parent 5fe5b45 commit f089bf5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

0.5.2 - 2024-09-06
------------------

- Fix crash when starting the app an existing db.
[ggozad]

0.5.1 - 2024-09-06
------------------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "oterm"
version = "0.5.1"
version = "0.5.2"
description = "A text-based terminal client for Ollama."
authors = [{ name = "Yiorgis Gozadinos", email = "ggozadinos@gmail.com" }]
license = { text = "MIT" }
Expand Down
7 changes: 6 additions & 1 deletion src/oterm/app/oterm.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import json
from typing import Iterable

Expand Down Expand Up @@ -145,7 +146,12 @@ async def on_mount(self) -> None:
store = await Store.get_store()
self.dark = appConfig.get("theme") == "dark"
saved_chats = await store.get_chats()
await self.push_screen(SplashScreen())
await asyncio.sleep(1.0)
self.pop_screen()

if not saved_chats:
print("No saved chats, creating a new one.")
self.action_new_chat()
else:
tabs = self.query_one(TabbedContent)
Expand All @@ -163,7 +169,6 @@ async def on_mount(self) -> None:
)
pane = TabPane(name, container, id=f"chat-{id}")
tabs.add_pane(pane)
await self.push_screen(SplashScreen())

@on(TabbedContent.TabActivated)
async def on_tab_activated(self, event: TabbedContent.TabActivated) -> None:
Expand Down
8 changes: 0 additions & 8 deletions src/oterm/app/splash.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import asyncio

from textual.app import ComposeResult
from textual.containers import Container
from textual.screen import ModalScreen
Expand Down Expand Up @@ -39,12 +37,6 @@


class SplashScreen(ModalScreen):
async def remove_splash(self) -> None:
await asyncio.sleep(0.5)
self.app.pop_screen()

async def on_mount(self) -> None:
asyncio.create_task(self.remove_splash())

def compose(self) -> ComposeResult:
yield Header()
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f089bf5

Please sign in to comment.