ggozad / oterm

a text-based terminal client for Ollama
MIT License
853 stars 43 forks source link

windows: strange crash when I select a model. #73

Closed amonpaike closed 2 months ago

amonpaike commented 3 months ago

Windows: strange crash when I select a model. Then once restarted oterm everything works correctly, including the window with the selected LLM is already ready to work.

image

`╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮ │ C:\Users\noki\AppData\Local\Programs\Python\Python311\Lib\site-packages\oterm\app\oterm.py:89 in on_tab_activated │ │ │ │ 86 │ @on(TabbedContent.TabActivated) │ │ 87 │ async def on_tab_activated(self, event: TabbedContent.TabActivated) -> None: │ │ 88 │ │ container = event.pane.query_one(ChatContainer) │ │ ❱ 89 │ │ await container.load_messages() │ │ 90 │ │ │ 91 │ def compose(self) -> ComposeResult: │ │ 92 │ │ yield Header() │ │ │ │ ╭───────────────────────── locals ─────────────────────────╮ │ │ │ container = ChatContainer() │ │ │ │ event = TabActivated( │ │ │ │ │ TabbedContent(id='tabs'), │ │ │ │ │ ContentTab(id='--content-tab-chat-53'), │ │ │ │ │ TabPane(id='chat-53') │ │ │ │ ) │ │ │ │ self = OTerm(title='oTerm', classes={'-dark-mode'}) │ │ │ ╰──────────────────────────────────────────────────────────╯ │ │ │ │ C:\Users\noki\AppData\Local\Programs\Python\Python311\Lib\site-packages\oterm\app\widgets\chat.py:87 in │ │ load_messages │ │ │ │ 84 │ async def load_messages(self) -> None: │ │ 85 │ │ if self.loaded: │ │ 86 │ │ │ return │ │ ❱ 87 │ │ message_container = self.query_one("#messageContainer") │ │ 88 │ │ for author, message in self.messages: │ │ 89 │ │ │ chat_item = ChatItem() │ │ 90 │ │ │ chat_item.text = message │ │ │ │ ╭──────── locals ────────╮ │ │ │ self = ChatContainer() │ │ │ ╰────────────────────────╯ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ NoMatches: No nodes match on ChatContainer()

NOTE: 1 of 2 errors shown. Run with textual run --dev to see all errors.`

ggozad commented 2 months ago

Sorry for the delay I had completely forgotten about this :( I cannot reproduce on my machine and my guess is this is a timing issue. So we have to make some guesses and I will need your help to test. Could you please try out installing from the branch 73-windows-strange-crash-when-i-select-a-model and let me know if the problem is fixed?