Skip to content

Commit

Permalink
mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeier committed Jan 3, 2024
1 parent 6922014 commit 0106d34
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions ragna/deploy/_ui/central_view.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Callable, Literal, Optional
from typing import Callable, Literal, Optional, cast

import panel as pn
import param
Expand Down Expand Up @@ -169,8 +169,8 @@ def avatar_lookup(self, user: str) -> str:
return "https://upload.wikimedia.org/wikipedia/commons/a/a4/GPT-4.png"
elif organization == "Anthropic":
return "https://upload.wikimedia.org/wikipedia/commons/1/14/Anthropic.png"
else:
return model[0].upper()

return model[0].upper()

def _render(self, content: str) -> pn.pane.Markdown:
return pn.pane.Markdown(
Expand Down Expand Up @@ -352,9 +352,9 @@ def get_user_from_role(self, role: Literal["system", "user", "assistant"]) -> st
if role == "system":
return "Ragna"
elif role == "user":
return self.user
return cast(str, self.user)
elif role == "assistant":
return self.current_chat["metadata"]["assistant"]
return cast(str, self.current_chat["metadata"]["assistant"])
else:
raise RuntimeError

Expand Down Expand Up @@ -554,20 +554,9 @@ def set_loading(self, is_loading):
self.main_column.loading = is_loading

def __panel__(self):
"""
The ChatInterface.view_latest option doesn't seem to work.
So to scroll to the latest message, we use some JS trick.
There might be a more elegant solution than running this after a timeout of 200ms,
but without it, the $$$ function isn't available yet.
And even if I add the $$$ here, the fix itself doesn't work and the chat doesn't scroll
to the bottom.
"""

self.main_column = pn.Column(
self.header,
self.chat_interface,
# self.scroll_to_latest_fix,
sizing_mode="stretch_width",
stylesheets=[
""" :host {
Expand Down

0 comments on commit 0106d34

Please sign in to comment.