Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HoloViz logos as ChatMessage avatars #6348

Merged
merged 8 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions panel/chat/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import param

from ..io.resources import CDN_DIST
from ..io.resources import CDN_DIST, get_dist_path
from ..io.state import state
from ..layout import Column, Row
from ..pane.base import PaneBase, ReplacementPane, panel as _panel
Expand Down Expand Up @@ -50,9 +50,13 @@
SYSTEM_LOGO = "⚙️"
ERROR_LOGO = "❌"
HELP_LOGO = "❓"
GPT_3_LOGO = "https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/ChatGPT_logo.svg/1024px-ChatGPT_logo.svg.png?20230318122128"
GPT_4_LOGO = "https://upload.wikimedia.org/wikipedia/commons/a/a4/GPT-4.png"
WOLFRAM_LOGO = "https://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/WolframCorporateLogo.svg/1920px-WolframCorporateLogo.svg.png"
GPT_3_LOGO = "{dist_path}assets/logo/gpt-3.svg"
GPT_4_LOGO = "{dist_path}assets/logo/gpt-4.svg"
WOLFRAM_LOGO = "{dist_path}assets/logo/wolfram.svg"
LUMEN_LOGO = "{dist_path}assets/logo/lumen.svg"
HOLOVIEWS_LOGO = "{dist_path}assets/logo/holoviews.svg"
HVPLOT_LOGO = "{dist_path}assets/logo/hvplot.svg"
PANEL_LOGO = "{dist_path}images/icon-vector.svg"

DEFAULT_AVATARS = {
# User
Expand Down Expand Up @@ -100,6 +104,12 @@
# Llama
"llama": "🦙",
"llama2": "🐪",
# Plotting
"plot": "📊",
"lumen": LUMEN_LOGO,
"holoviews": HOLOVIEWS_LOGO,
"hvplot": HVPLOT_LOGO,
"panel": PANEL_LOGO,
}


Expand Down Expand Up @@ -221,6 +231,10 @@ class ChatMessage(PaneBase):

def __init__(self, object=None, **params):
self._exit_stack = ExitStack()
self._dist_path = get_dist_path()
ahuang11 marked this conversation as resolved.
Show resolved Hide resolved
self.chat_copy_icon = ChatCopyIcon(
visible=False, width=15, height=15, css_classes=["copy-icon"]
)
if params.get("timestamp") is None:
tz = params.get("timestamp_tz")
if tz is not None:
Expand Down Expand Up @@ -422,7 +436,9 @@ def _avatar_lookup(self, user: str) -> Avatar:
self._to_alpha_numeric(key): value for key, value in updated_avatars.items()
}
# now lookup the avatar
return updated_avatars.get(alpha_numeric_key, self.avatar)
return updated_avatars.get(alpha_numeric_key, self.avatar).format(
dist_path=self._dist_path
)

def _select_renderer(
self,
Expand Down
10 changes: 10 additions & 0 deletions panel/dist/assets/logo/gpt-3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions panel/dist/assets/logo/gpt-4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions panel/dist/assets/logo/holoviews.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions panel/dist/assets/logo/hvplot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading