forked from jupyterlab/jupyter-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chat help message on load (jupyterlab#277)
* Shortens text box placeholder * Adds help command * Adds link to docs * Simplifies help handler * Initial help message on load * Reverts changes to default.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Copy edit: send -> ask * Update packages/jupyter-ai/jupyter_ai/chat_handlers/help.py Co-authored-by: Piyush Jain <[email protected]> * Simplifies reply logic * Tightens spacing for bulleted lists in markdown * Slash commands, mentions magic commands * Plural notebooks * Update packages/jupyter-ai/jupyter_ai/chat_handlers/help.py Co-authored-by: Andrii Ieroshenko <[email protected]> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Piyush Jain <[email protected]> Co-authored-by: Andrii Ieroshenko <[email protected]>
- Loading branch information
1 parent
28da96c
commit 354bdb8
Showing
6 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import time | ||
from typing import List | ||
from uuid import uuid4 | ||
|
||
from jupyter_ai.models import AgentChatMessage, HumanChatMessage | ||
|
||
from .base import BaseChatHandler | ||
|
||
HELP_MESSAGE = """Hi there! I'm Jupyternaut, your programming assistant. | ||
You can ask me a question using the text box below. You can also use these commands: | ||
* `/learn` — Teach Jupyternaut about files on your system | ||
* `/ask` — Ask a question about your learned data | ||
* `/generate` — Generate a Jupyter notebook from a text prompt | ||
* `/clear` — Clear the chat window | ||
* `/help` — Display this help message | ||
Jupyter AI includes [magic commands](https://jupyter-ai.readthedocs.io/en/latest/users/index.html#the-ai-and-ai-magic-commands) that you can use in your notebooks. | ||
For more information, see the [documentation](https://jupyter-ai.readthedocs.io). | ||
""" | ||
|
||
|
||
def HelpMessage(): | ||
return AgentChatMessage( | ||
id=uuid4().hex, | ||
time=time.time(), | ||
body=HELP_MESSAGE, | ||
reply_to="", | ||
) | ||
|
||
|
||
class HelpChatHandler(BaseChatHandler): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
|
||
async def _process_message(self, message: HumanChatMessage): | ||
self.reply(HELP_MESSAGE, message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters