diff --git a/packages/jupyter-ai/jupyter_ai/handlers.py b/packages/jupyter-ai/jupyter_ai/handlers.py index a8b1da73e..a08a87df9 100644 --- a/packages/jupyter-ai/jupyter_ai/handlers.py +++ b/packages/jupyter-ai/jupyter_ai/handlers.py @@ -246,7 +246,7 @@ async def on_message(self, message): except ValidationError as e: self.log.error(e) return - + message_body = chat_request.prompt if chat_request.selection: message_body += f"\n\n```\n{chat_request.selection.source}\n```\n" diff --git a/packages/jupyter-ai/jupyter_ai/models.py b/packages/jupyter-ai/jupyter_ai/models.py index 4ea60cb3e..f2fa098bb 100644 --- a/packages/jupyter-ai/jupyter_ai/models.py +++ b/packages/jupyter-ai/jupyter_ai/models.py @@ -18,10 +18,12 @@ class TextSelection(BaseModel): type: Literal["text"] = "text" source: str + class CellSelection(BaseModel): type: Literal["cell"] = "cell" source: str + class CellWithErrorSelection(BaseModel): type: Literal["cell-with-error"] = "cell-with-error" source: str diff --git a/packages/jupyter-ai/style/icons/include-selection.svg b/packages/jupyter-ai/style/icons/include-selection.svg index 307aadc18..665ece235 100644 --- a/packages/jupyter-ai/style/icons/include-selection.svg +++ b/packages/jupyter-ai/style/icons/include-selection.svg @@ -3,4 +3,3 @@ d="M-0.0018417 1.33824L0.837379 0.499023L1.35717 1.01871C1.35741 1.01862 1.35764 1.01853 1.35787 1.01845L3.411 3.07158H3.41049L4.83909 4.49987L3.41011 5.92872H3.41075L1.35769 7.98178C1.35749 7.98171 1.35729 7.98164 1.35709 7.98156L0.837023 8.50158L-0.00219727 7.66236L3.1547 4.49987L-0.0018417 1.33824ZM2.6821 8.07158H16.143C16.932 8.07158 17.5716 7.43201 17.5716 6.64301V2.35729C17.5716 1.56832 16.932 0.928721 16.143 0.928721H2.68236L4.82522 3.07158H15.4287V5.92872H4.82496L2.6821 8.07158ZM1.74238 4.50002L0.428719 5.81655V3.18349L1.74238 4.50002Z" fill="#757575" /> - \ No newline at end of file