From 2659a2e3902fb731cd5267114c238b29b8fa33be Mon Sep 17 00:00:00 2001 From: "David L. Qiu" Date: Fri, 5 May 2023 16:47:02 +0000 Subject: [PATCH] introduce Jupyternaut --- .../jupyter-ai/jupyter_ai/actors/default.py | 2 +- .../jupyter-ai/jupyter_ai/actors/learn.py | 2 +- packages/jupyter-ai/schema/plugin.json | 2 +- .../src/components/chat-messages.tsx | 24 ++++++++++++++----- packages/jupyter-ai/src/icons.ts | 16 +++++++------ .../jupyter-ai/style/icons/jupyternaut.svg | 15 ++++++++++++ .../jupyter-ai/style/icons/psychology.svg | 4 ---- 7 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 packages/jupyter-ai/style/icons/jupyternaut.svg delete mode 100644 packages/jupyter-ai/style/icons/psychology.svg diff --git a/packages/jupyter-ai/jupyter_ai/actors/default.py b/packages/jupyter-ai/jupyter_ai/actors/default.py index 7914daad3..c6685263a 100644 --- a/packages/jupyter-ai/jupyter_ai/actors/default.py +++ b/packages/jupyter-ai/jupyter_ai/actors/default.py @@ -18,7 +18,7 @@ from jupyter_ai_magics.providers import BaseProvider SYSTEM_PROMPT = """ -You are Jupyter AI, a conversational assistant living in JupyterLab to help users. +You are Jupyternaut, a conversational assistant living in JupyterLab to help users. You are not a language model, but rather an application built on a foundation model from {provider_name} called {local_model_id}. You are talkative and provides lots of specific details from its context. You may use Markdown to format your response. diff --git a/packages/jupyter-ai/jupyter_ai/actors/learn.py b/packages/jupyter-ai/jupyter_ai/actors/learn.py index d65002238..1754cb9da 100644 --- a/packages/jupyter-ai/jupyter_ai/actors/learn.py +++ b/packages/jupyter-ai/jupyter_ai/actors/learn.py @@ -165,7 +165,7 @@ def create(self): embeddings = self.get_embeddings() if not embeddings: return - self.index = FAISS.from_texts(["Jupyter AI knows about your filesystem, to ask questions first use the /learn command."], embeddings) + self.index = FAISS.from_texts(["Jupyternaut knows about your filesystem, to ask questions first use the /learn command."], embeddings) self.save() def save(self): diff --git a/packages/jupyter-ai/schema/plugin.json b/packages/jupyter-ai/schema/plugin.json index 51ec369b2..d7a59ce56 100644 --- a/packages/jupyter-ai/schema/plugin.json +++ b/packages/jupyter-ai/schema/plugin.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/draft-07/schema", "title": "Generative AI", "description": "JupyterLab generative artificial intelligence integration.", - "jupyter.lab.setting-icon": "jupyter-ai::psychology", + "jupyter.lab.setting-icon": "jupyter-ai::chat", "jupyter.lab.setting-icon-label": "Jupyter AI Chat", "jupyter.lab.toolbars": { "Cell": [ diff --git a/packages/jupyter-ai/src/components/chat-messages.tsx b/packages/jupyter-ai/src/components/chat-messages.tsx index fc2a4ea10..8f25e67c6 100644 --- a/packages/jupyter-ai/src/components/chat-messages.tsx +++ b/packages/jupyter-ai/src/components/chat-messages.tsx @@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react'; import { Avatar, Box, Typography } from '@mui/material'; import type { SxProps, Theme } from '@mui/material'; -import PsychologyIcon from '@mui/icons-material/Psychology'; import { formatDistanceToNowStrict, fromUnixTime } from 'date-fns'; import ReactMarkdown from 'react-markdown'; import remarkMath from 'remark-math'; @@ -12,6 +11,7 @@ import 'katex/dist/katex.min.css'; import { ChatCodeView } from './chat-code-view'; import { AiService } from '../handler'; import { useCollaboratorsContext } from '../contexts/collaborators-context'; +import { Jupyternaut } from '../icons'; type ChatMessagesProps = { messages: AiService.ChatMessage[]; @@ -54,7 +54,7 @@ export function ChatMessageHeader(props: ChatMessageHeaderProps) { } else { avatar = ( - + ); } @@ -62,7 +62,7 @@ export function ChatMessageHeader(props: ChatMessageHeaderProps) { const name = props.message.type === 'human' ? props.message.client.display_name - : 'Jupyter AI'; + : 'Jupyternaut'; return ( - {name} - + + {name} + + {props.timestamp} @@ -120,7 +128,11 @@ export function ChatMessages(props: ChatMessagesProps) { return ( :not(:last-child)': { borderBottom: '1px solid var(--jp-border-color2)' } }} + sx={{ + '& > :not(:last-child)': { + borderBottom: '1px solid var(--jp-border-color2)' + } + }} > {props.messages.map((message, i) => ( // extra div needed to ensure each bubble is on a new line diff --git a/packages/jupyter-ai/src/icons.ts b/packages/jupyter-ai/src/icons.ts index 512412b68..a510c17a7 100644 --- a/packages/jupyter-ai/src/icons.ts +++ b/packages/jupyter-ai/src/icons.ts @@ -2,15 +2,17 @@ import { LabIcon } from '@jupyterlab/ui-components'; -import psychologySvgStr from '../style/icons/psychology.svg'; import chatSvgStr from '../style/icons/chat.svg'; - -export const psychologyIcon = new LabIcon({ - name: 'jupyter-ai::psychology', - svgstr: psychologySvgStr -}); +import jupyternautSvg from '../style/icons/jupyternaut.svg'; export const chatIcon = new LabIcon({ name: 'jupyter-ai::chat', svgstr: chatSvgStr -}); \ No newline at end of file +}); + +export const jupyternautIcon = new LabIcon({ + name: 'jupyter-ai::jupyternaut', + svgstr: jupyternautSvg +}); + +export const Jupyternaut = jupyternautIcon.react; diff --git a/packages/jupyter-ai/style/icons/jupyternaut.svg b/packages/jupyter-ai/style/icons/jupyternaut.svg new file mode 100644 index 000000000..20f02087b --- /dev/null +++ b/packages/jupyter-ai/style/icons/jupyternaut.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/jupyter-ai/style/icons/psychology.svg b/packages/jupyter-ai/style/icons/psychology.svg deleted file mode 100644 index 0bb55c03c..000000000 --- a/packages/jupyter-ai/style/icons/psychology.svg +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file