mito-ai 0.1.27__py3-none-any.whl → 0.1.28__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mito-ai might be problematic. Click here for more details.
- mito_ai/_version.py +1 -1
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/build_log.json +1 -1
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/package.json +2 -2
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/schemas/mito_ai/package.json.orig +1 -1
- mito_ai-0.1.27.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.43d516a828f1937a42bb.js → mito_ai-0.1.28.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.114d2b34bc18a45df338.js +121 -75
- mito_ai-0.1.28.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.114d2b34bc18a45df338.js.map +1 -0
- mito_ai-0.1.27.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.806d64f6e8a03c8a76c7.js → mito_ai-0.1.28.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.92c6411fdc4075df549b.js +3 -3
- mito_ai-0.1.27.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.806d64f6e8a03c8a76c7.js.map → mito_ai-0.1.28.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.92c6411fdc4075df549b.js.map +1 -1
- {mito_ai-0.1.27.dist-info → mito_ai-0.1.28.dist-info}/METADATA +1 -1
- {mito_ai-0.1.27.dist-info → mito_ai-0.1.28.dist-info}/RECORD +24 -24
- mito_ai-0.1.27.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.43d516a828f1937a42bb.js.map +0 -1
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/etc/jupyter/jupyter_server_config.d/mito_ai.json +0 -0
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/schemas/mito_ai/toolbar-buttons.json +0 -0
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/static/style.js +0 -0
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/static/style_index_js.06083e515de4862df010.js +0 -0
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/static/style_index_js.06083e515de4862df010.js.map +0 -0
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_html2canvas_dist_html2canvas_js.ea47e8c8c906197f8d19.js +0 -0
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_html2canvas_dist_html2canvas_js.ea47e8c8c906197f8d19.js.map +0 -0
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_semver_index_js.9795f79265ddb416864b.js +0 -0
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_semver_index_js.9795f79265ddb416864b.js.map +0 -0
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_vscode-diff_dist_index_js.ea55f1f9346638aafbcf.js +0 -0
- {mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_vscode-diff_dist_index_js.ea55f1f9346638aafbcf.js.map +0 -0
- {mito_ai-0.1.27.dist-info → mito_ai-0.1.28.dist-info}/WHEEL +0 -0
- {mito_ai-0.1.27.dist-info → mito_ai-0.1.28.dist-info}/entry_points.txt +0 -0
- {mito_ai-0.1.27.dist-info → mito_ai-0.1.28.dist-info}/licenses/LICENSE +0 -0
mito_ai/_version.py
CHANGED
{mito_ai-0.1.27.data → mito_ai-0.1.28.data}/data/share/jupyter/labextensions/mito_ai/package.json
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mito_ai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"description": "AI chat for JupyterLab",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"outputDir": "mito_ai/labextension",
|
|
139
139
|
"schemaDir": "schema",
|
|
140
140
|
"_build": {
|
|
141
|
-
"load": "static/remoteEntry.
|
|
141
|
+
"load": "static/remoteEntry.92c6411fdc4075df549b.js",
|
|
142
142
|
"extension": "./extension",
|
|
143
143
|
"style": "./style"
|
|
144
144
|
}
|
|
@@ -1470,33 +1470,34 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1470
1470
|
/* harmony import */ var _style_TextButton_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../style/TextButton.css */ "./style/TextButton.css");
|
|
1471
1471
|
/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @jupyterlab/ui-components */ "webpack/sharing/consume/default/@jupyterlab/ui-components");
|
|
1472
1472
|
/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6__);
|
|
1473
|
-
/* harmony import */ var
|
|
1474
|
-
/* harmony import */ var
|
|
1475
|
-
/* harmony import */ var
|
|
1476
|
-
/* harmony import */ var
|
|
1477
|
-
/* harmony import */ var
|
|
1473
|
+
/* harmony import */ var _icons__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../../icons */ "./lib/icons/index.js");
|
|
1474
|
+
/* harmony import */ var _icons_MitoLogo__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../../icons/MitoLogo */ "./lib/icons/MitoLogo.js");
|
|
1475
|
+
/* harmony import */ var _ChatMessage_ChatInput__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./ChatMessage/ChatInput */ "./lib/Extensions/AiChat/ChatMessage/ChatInput.js");
|
|
1476
|
+
/* harmony import */ var _ChatMessage_ChatMessage__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./ChatMessage/ChatMessage */ "./lib/Extensions/AiChat/ChatMessage/ChatMessage.js");
|
|
1477
|
+
/* harmony import */ var _ChatMessage_ScrollableSuggestions__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./ChatMessage/ScrollableSuggestions */ "./lib/Extensions/AiChat/ChatMessage/ScrollableSuggestions.js");
|
|
1478
1478
|
/* harmony import */ var _ChatHistoryManager__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ChatHistoryManager */ "./lib/Extensions/AiChat/ChatHistoryManager.js");
|
|
1479
|
-
/* harmony import */ var
|
|
1480
|
-
/* harmony import */ var
|
|
1481
|
-
/* harmony import */ var
|
|
1482
|
-
/* harmony import */ var
|
|
1483
|
-
/* harmony import */ var
|
|
1484
|
-
/* harmony import */ var
|
|
1485
|
-
/* harmony import */ var
|
|
1486
|
-
/* harmony import */ var
|
|
1487
|
-
/* harmony import */ var
|
|
1488
|
-
/* harmony import */ var
|
|
1489
|
-
/* harmony import */ var
|
|
1479
|
+
/* harmony import */ var _CodeDiffDisplay__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./CodeDiffDisplay */ "./lib/Extensions/AiChat/CodeDiffDisplay.js");
|
|
1480
|
+
/* harmony import */ var _components_ToggleButton__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ../../components/ToggleButton */ "./lib/components/ToggleButton.js");
|
|
1481
|
+
/* harmony import */ var _components_IconButton__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../../components/IconButton */ "./lib/components/IconButton.js");
|
|
1482
|
+
/* harmony import */ var _components_LoadingDots__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ../../components/LoadingDots */ "./lib/components/LoadingDots.js");
|
|
1483
|
+
/* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../commands */ "./lib/commands.js");
|
|
1484
|
+
/* harmony import */ var _utils_codeDiff__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../utils/codeDiff */ "./lib/utils/codeDiff.js");
|
|
1485
|
+
/* harmony import */ var _utils_notebook__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../utils/notebook */ "./lib/utils/notebook.js");
|
|
1486
|
+
/* harmony import */ var _utils_strings__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../utils/strings */ "./lib/utils/strings.js");
|
|
1487
|
+
/* harmony import */ var _utils_agentActions__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../utils/agentActions */ "./lib/utils/agentActions.js");
|
|
1488
|
+
/* harmony import */ var _utils_scroll__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../utils/scroll */ "./lib/utils/scroll.js");
|
|
1489
|
+
/* harmony import */ var _components_LoadingCircle__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ../../components/LoadingCircle */ "./lib/components/LoadingCircle.js");
|
|
1490
1490
|
/* harmony import */ var _components_ModelSelector__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../components/ModelSelector */ "./lib/components/ModelSelector.js");
|
|
1491
|
-
/* harmony import */ var
|
|
1492
|
-
/* harmony import */ var
|
|
1493
|
-
/* harmony import */ var
|
|
1491
|
+
/* harmony import */ var _utils_blacklistedWords__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../utils/blacklistedWords */ "./lib/utils/blacklistedWords.js");
|
|
1492
|
+
/* harmony import */ var _components_DropdownMenu__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../components/DropdownMenu */ "./lib/components/DropdownMenu.js");
|
|
1493
|
+
/* harmony import */ var _SettingsManager_SettingsManagerPlugin__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../SettingsManager/SettingsManagerPlugin */ "./lib/Extensions/SettingsManager/SettingsManagerPlugin.js");
|
|
1494
1494
|
/* harmony import */ var _FirstMessage__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./FirstMessage */ "./lib/Extensions/AiChat/FirstMessage.js");
|
|
1495
|
-
/* harmony import */ var
|
|
1496
|
-
/* harmony import */ var
|
|
1497
|
-
/* harmony import */ var
|
|
1498
|
-
/* harmony import */ var
|
|
1499
|
-
/* harmony import */ var
|
|
1495
|
+
/* harmony import */ var _CTACarousel__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./CTACarousel */ "./lib/Extensions/AiChat/CTACarousel.js");
|
|
1496
|
+
/* harmony import */ var _components_NextStepsPills__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ../../components/NextStepsPills */ "./lib/components/NextStepsPills.js");
|
|
1497
|
+
/* harmony import */ var _icons_UndoIcon__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ../../icons/UndoIcon */ "./lib/icons/UndoIcon.js");
|
|
1498
|
+
/* harmony import */ var _components_TextAndIconButton__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../../components/TextAndIconButton */ "./lib/components/TextAndIconButton.js");
|
|
1499
|
+
/* harmony import */ var _utils_checkpoint__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../utils/checkpoint */ "./lib/utils/checkpoint.js");
|
|
1500
|
+
/* harmony import */ var _utils_waitForNotebookReady__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../utils/waitForNotebookReady */ "./lib/utils/waitForNotebookReady.js");
|
|
1500
1501
|
/*
|
|
1501
1502
|
* Copyright (c) Saga Inc.
|
|
1502
1503
|
* Distributed under the terms of the GNU Affero General Public License v3.0 License.
|
|
@@ -1534,6 +1535,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1534
1535
|
|
|
1535
1536
|
|
|
1536
1537
|
|
|
1538
|
+
|
|
1537
1539
|
|
|
1538
1540
|
|
|
1539
1541
|
const AGENT_EXECUTION_DEPTH_LIMIT = 20;
|
|
@@ -1765,6 +1767,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
1765
1767
|
}
|
|
1766
1768
|
const firstMessage = (0,_FirstMessage__WEBPACK_IMPORTED_MODULE_9__.getFirstMessageFromCookie)();
|
|
1767
1769
|
if (firstMessage) {
|
|
1770
|
+
await (0,_utils_waitForNotebookReady__WEBPACK_IMPORTED_MODULE_10__.waitForNotebookReady)(notebookTracker);
|
|
1768
1771
|
await startAgentExecution(firstMessage);
|
|
1769
1772
|
}
|
|
1770
1773
|
}
|
|
@@ -1802,7 +1805,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
1802
1805
|
// Scroll to bottom whenever chat history updates, but only if in follow mode
|
|
1803
1806
|
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => {
|
|
1804
1807
|
if (autoScrollFollowMode) {
|
|
1805
|
-
(0,
|
|
1808
|
+
(0,_utils_scroll__WEBPACK_IMPORTED_MODULE_11__.scrollToDiv)(chatMessagesRef);
|
|
1806
1809
|
}
|
|
1807
1810
|
}, [chatHistoryManager.getDisplayOptimizedHistory().length, chatHistoryManager, autoScrollFollowMode]);
|
|
1808
1811
|
// Add scroll event handler to detect manual scrolling
|
|
@@ -1911,7 +1914,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
1911
1914
|
agentExecutionMetadata.index = messageIndex;
|
|
1912
1915
|
}
|
|
1913
1916
|
if (sendActiveCellOutput) {
|
|
1914
|
-
const activeCellOutput = await (0,
|
|
1917
|
+
const activeCellOutput = await (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.getActiveCellOutput)(notebookTracker);
|
|
1915
1918
|
if (activeCellOutput !== undefined) {
|
|
1916
1919
|
agentExecutionMetadata.base64EncodedActiveCellOutput = activeCellOutput;
|
|
1917
1920
|
}
|
|
@@ -1951,7 +1954,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
1951
1954
|
// Add the active cell output to the metadata afterwards setting the chatHistoryManager so that
|
|
1952
1955
|
// we don't have to wait on turning the output into a base64 image before we can add the user's message
|
|
1953
1956
|
// to the chat.
|
|
1954
|
-
const activeCellOutput = await (0,
|
|
1957
|
+
const activeCellOutput = await (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.getActiveCellOutput)(notebookTracker);
|
|
1955
1958
|
if (activeCellOutput !== undefined) {
|
|
1956
1959
|
chatMessageMetadata.base64EncodedActiveCellOutput = activeCellOutput;
|
|
1957
1960
|
}
|
|
@@ -2110,7 +2113,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2110
2113
|
setAgentExecutionStatus('idle');
|
|
2111
2114
|
};
|
|
2112
2115
|
const startAgentExecution = async (input, messageIndex, selectedRules) => {
|
|
2113
|
-
await (0,
|
|
2116
|
+
await (0,_utils_checkpoint__WEBPACK_IMPORTED_MODULE_13__.createCheckpoint)(app, setHasCheckpoint);
|
|
2114
2117
|
setAgentExecutionStatus('working');
|
|
2115
2118
|
// Enable follow mode when user starts agent execution
|
|
2116
2119
|
setAutoScrollFollowMode(true);
|
|
@@ -2142,9 +2145,9 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2142
2145
|
const aiDisplayOptimizedChatItem = chatHistoryManagerRef.current.getLastAIDisplayOptimizedChatItem();
|
|
2143
2146
|
// # TODO: Make this is a helper function so we can also use it in the auto error fixup!
|
|
2144
2147
|
if (aiDisplayOptimizedChatItem) {
|
|
2145
|
-
const aiGeneratedCode = (0,
|
|
2148
|
+
const aiGeneratedCode = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_14__.getCodeBlockFromMessage)(aiDisplayOptimizedChatItem.message);
|
|
2146
2149
|
if (aiGeneratedCode) {
|
|
2147
|
-
const securityCheck = (0,
|
|
2150
|
+
const securityCheck = (0,_utils_blacklistedWords__WEBPACK_IMPORTED_MODULE_15__.checkForBlacklistedWords)(aiGeneratedCode);
|
|
2148
2151
|
if (!securityCheck.safe) {
|
|
2149
2152
|
console.error('Security Warning:', securityCheck.reason);
|
|
2150
2153
|
addAIMessageFromResponseAndUpdateState(`I cannot execute this code without your approval because this code did not pass my security checks. ${securityCheck.reason}. For your safety, I am stopping execution of this plan.`, 'agent:execution', chatHistoryManager);
|
|
@@ -2171,8 +2174,8 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2171
2174
|
}
|
|
2172
2175
|
if (agentResponse.type === 'cell_update' && agentResponse.cell_update) {
|
|
2173
2176
|
// Run the code and handle any errors
|
|
2174
|
-
await (0,
|
|
2175
|
-
const status = await (0,
|
|
2177
|
+
await (0,_utils_agentActions__WEBPACK_IMPORTED_MODULE_16__.acceptAndRunCellUpdate)(agentResponse.cell_update, notebookTracker, app, previewAICodeToActiveCell, acceptAICode);
|
|
2178
|
+
const status = await (0,_utils_agentActions__WEBPACK_IMPORTED_MODULE_16__.retryIfExecutionError)(notebookTracker, app, getDuplicateChatHistoryManager, addAIMessageFromResponseAndUpdateState, sendAgentSmartDebugMessage, previewAICodeToActiveCell, acceptAICode, shouldContinueAgentExecution, finalizeAgentStop, chatHistoryManagerRef);
|
|
2176
2179
|
if (status === 'interupted') {
|
|
2177
2180
|
break;
|
|
2178
2181
|
}
|
|
@@ -2201,33 +2204,33 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2201
2204
|
if (!aiMessage) {
|
|
2202
2205
|
return;
|
|
2203
2206
|
}
|
|
2204
|
-
const updateCellCode = (0,
|
|
2207
|
+
const updateCellCode = (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.getCellCodeByID)(notebookTracker, updateCellID);
|
|
2205
2208
|
if (updateCellID === undefined || updateCellCode === undefined) {
|
|
2206
2209
|
return;
|
|
2207
2210
|
}
|
|
2208
2211
|
// Extract the code from the AI's message and then calculate the code diffs
|
|
2209
|
-
const aiGeneratedCode = (0,
|
|
2210
|
-
const aiGeneratedCodeCleaned = (0,
|
|
2211
|
-
const { unifiedCodeString, unifiedDiffs } = (0,
|
|
2212
|
+
const aiGeneratedCode = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_14__.getCodeBlockFromMessage)(aiMessage);
|
|
2213
|
+
const aiGeneratedCodeCleaned = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_14__.removeMarkdownCodeFormatting)(aiGeneratedCode || '');
|
|
2214
|
+
const { unifiedCodeString, unifiedDiffs } = (0,_utils_codeDiff__WEBPACK_IMPORTED_MODULE_17__.getCodeDiffsAndUnifiedCodeString)(updateCellCode, aiGeneratedCodeCleaned);
|
|
2212
2215
|
// Store the code cell ID where we write the code diffs so that we can
|
|
2213
2216
|
// accept or reject the code diffs to the correct cell
|
|
2214
2217
|
cellStateBeforeDiff.current = { codeCellID: updateCellID, code: updateCellCode };
|
|
2215
2218
|
// Temporarily write the unified code string to the active cell so we can display
|
|
2216
2219
|
// the code diffs to the user
|
|
2217
|
-
(0,
|
|
2220
|
+
(0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.writeCodeToCellByID)(notebookTracker, unifiedCodeString, updateCellID);
|
|
2218
2221
|
updateCodeCellsExtensions(unifiedDiffs);
|
|
2219
2222
|
// Briefly highlight the code cell to draw the user's attention to it
|
|
2220
|
-
(0,
|
|
2223
|
+
(0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.highlightCodeCell)(notebookTracker, updateCellID);
|
|
2221
2224
|
};
|
|
2222
2225
|
const displayOptimizedChatHistory = chatHistoryManager.getDisplayOptimizedHistory();
|
|
2223
2226
|
const previewAICodeToActiveCell = () => {
|
|
2224
2227
|
setCodeReviewStatus('codeCellPreview');
|
|
2225
|
-
const activeCellID = (0,
|
|
2228
|
+
const activeCellID = (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.getActiveCellID)(notebookTracker);
|
|
2226
2229
|
const lastAIDisplayMessage = chatHistoryManagerRef.current.getLastAIDisplayOptimizedChatItem();
|
|
2227
2230
|
if (activeCellID === undefined || lastAIDisplayMessage === undefined) {
|
|
2228
2231
|
return;
|
|
2229
2232
|
}
|
|
2230
|
-
(0,
|
|
2233
|
+
(0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.scrollToCell)(notebookTracker, activeCellID, undefined, 'end');
|
|
2231
2234
|
updateCodeDiffStripes(lastAIDisplayMessage.message, activeCellID);
|
|
2232
2235
|
updateCellToolbarButtons();
|
|
2233
2236
|
};
|
|
@@ -2237,7 +2240,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2237
2240
|
if (!lastAIMessage || !cellStateBeforeDiff.current) {
|
|
2238
2241
|
return;
|
|
2239
2242
|
}
|
|
2240
|
-
const aiGeneratedCode = (0,
|
|
2243
|
+
const aiGeneratedCode = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_14__.getCodeBlockFromMessage)(lastAIMessage.message);
|
|
2241
2244
|
if (!aiGeneratedCode) {
|
|
2242
2245
|
return;
|
|
2243
2246
|
}
|
|
@@ -2246,10 +2249,10 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2246
2249
|
// Write to the cell that has the code diffs
|
|
2247
2250
|
writeCodeToCellAndTurnOffDiffs(aiGeneratedCode, targetCellID);
|
|
2248
2251
|
// Focus on the active cell after the code is written
|
|
2249
|
-
const targetCell = (0,
|
|
2252
|
+
const targetCell = (0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.getCellByID)(notebookTracker, targetCellID);
|
|
2250
2253
|
if (targetCell) {
|
|
2251
2254
|
// Make the target cell the active cell
|
|
2252
|
-
(0,
|
|
2255
|
+
(0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.setActiveCellByID)(notebookTracker, targetCellID);
|
|
2253
2256
|
// Focus on the active cell
|
|
2254
2257
|
targetCell.activate();
|
|
2255
2258
|
}
|
|
@@ -2274,7 +2277,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2274
2277
|
updateCodeCellsExtensions(undefined);
|
|
2275
2278
|
cellStateBeforeDiff.current = undefined;
|
|
2276
2279
|
if (codeCellID !== undefined) {
|
|
2277
|
-
(0,
|
|
2280
|
+
(0,_utils_notebook__WEBPACK_IMPORTED_MODULE_12__.writeCodeToCellByID)(notebookTracker, code, codeCellID);
|
|
2278
2281
|
updateCellToolbarButtons();
|
|
2279
2282
|
}
|
|
2280
2283
|
};
|
|
@@ -2285,17 +2288,17 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2285
2288
|
the first time we create the chat. Registering the command when it is already created causes
|
|
2286
2289
|
errors.
|
|
2287
2290
|
*/
|
|
2288
|
-
app.commands.addCommand(
|
|
2291
|
+
app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_PREVIEW_LATEST_CODE, {
|
|
2289
2292
|
execute: () => {
|
|
2290
2293
|
previewAICodeToActiveCell();
|
|
2291
2294
|
}
|
|
2292
2295
|
});
|
|
2293
|
-
app.commands.addCommand(
|
|
2296
|
+
app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_APPLY_LATEST_CODE, {
|
|
2294
2297
|
execute: () => {
|
|
2295
2298
|
acceptAICode();
|
|
2296
2299
|
}
|
|
2297
2300
|
});
|
|
2298
|
-
app.commands.addCommand(
|
|
2301
|
+
app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_REJECT_LATEST_CODE, {
|
|
2299
2302
|
execute: () => {
|
|
2300
2303
|
rejectAICode();
|
|
2301
2304
|
}
|
|
@@ -2304,19 +2307,19 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2304
2307
|
Add a new command to the JupyterLab command registry that sends the current chat message.
|
|
2305
2308
|
We use this to automatically send the message when the user adds an error to the chat.
|
|
2306
2309
|
*/
|
|
2307
|
-
app.commands.addCommand(
|
|
2310
|
+
app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_SEND_DEBUG_ERROR_MESSAGE, {
|
|
2308
2311
|
execute: async (args) => {
|
|
2309
2312
|
if (args === null || args === void 0 ? void 0 : args.input) {
|
|
2310
2313
|
await sendSmartDebugMessage(args.input.toString());
|
|
2311
2314
|
}
|
|
2312
2315
|
}
|
|
2313
2316
|
});
|
|
2314
|
-
app.commands.addCommand(
|
|
2317
|
+
app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_SEND_EXPLAIN_CODE_MESSAGE, {
|
|
2315
2318
|
execute: async () => {
|
|
2316
2319
|
await sendExplainCodeMessage();
|
|
2317
2320
|
}
|
|
2318
2321
|
});
|
|
2319
|
-
app.commands.addCommand(
|
|
2322
|
+
app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_SEND_AGENT_MESSAGE, {
|
|
2320
2323
|
execute: async (args) => {
|
|
2321
2324
|
if (args === null || args === void 0 ? void 0 : args.input) {
|
|
2322
2325
|
// Make sure we're in agent mode
|
|
@@ -2335,7 +2338,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2335
2338
|
/*
|
|
2336
2339
|
Register the code cell toolbar buttons for accepting and rejecting code.
|
|
2337
2340
|
*/
|
|
2338
|
-
app.commands.addCommand(
|
|
2341
|
+
app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_CELL_TOOLBAR_ACCEPT_CODE, {
|
|
2339
2342
|
label: `Accept ${operatingSystem === 'mac' ? '⌘Y' : 'Ctrl+Y'}`,
|
|
2340
2343
|
className: 'text-button-mito-ai button-base button-green',
|
|
2341
2344
|
caption: 'Accept Code',
|
|
@@ -2353,7 +2356,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2353
2356
|
}
|
|
2354
2357
|
}
|
|
2355
2358
|
});
|
|
2356
|
-
app.commands.addCommand(
|
|
2359
|
+
app.commands.addCommand(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_CELL_TOOLBAR_REJECT_CODE, {
|
|
2357
2360
|
label: `Reject ${operatingSystem === 'mac' ? '⌘U' : 'Ctrl+U'}`,
|
|
2358
2361
|
className: 'text-button-mito-ai button-base button-red',
|
|
2359
2362
|
caption: 'Reject Code',
|
|
@@ -2374,13 +2377,13 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2374
2377
|
// Register keyboard shortcuts
|
|
2375
2378
|
const accelYDisposable = app.commands.addKeyBinding({
|
|
2376
2379
|
command: codeReviewStatus === 'chatPreview' ?
|
|
2377
|
-
|
|
2378
|
-
|
|
2380
|
+
_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_PREVIEW_LATEST_CODE :
|
|
2381
|
+
_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_APPLY_LATEST_CODE,
|
|
2379
2382
|
keys: ['Accel Y'],
|
|
2380
2383
|
selector: 'body',
|
|
2381
2384
|
});
|
|
2382
2385
|
const accelDDisposable = app.commands.addKeyBinding({
|
|
2383
|
-
command:
|
|
2386
|
+
command: _commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_REJECT_LATEST_CODE,
|
|
2384
2387
|
keys: ['Accel U'],
|
|
2385
2388
|
selector: 'body',
|
|
2386
2389
|
preventDefault: true,
|
|
@@ -2397,8 +2400,8 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2397
2400
|
// Without this, the user needs to take some action, like switching to a different cell
|
|
2398
2401
|
// and then switching back in order for the Jupyter to re-evaluate if it should
|
|
2399
2402
|
// show the toolbar buttons.
|
|
2400
|
-
app.commands.notifyCommandChanged(
|
|
2401
|
-
app.commands.notifyCommandChanged(
|
|
2403
|
+
app.commands.notifyCommandChanged(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_CELL_TOOLBAR_ACCEPT_CODE);
|
|
2404
|
+
app.commands.notifyCommandChanged(_commands__WEBPACK_IMPORTED_MODULE_18__.COMMAND_MITO_AI_CELL_TOOLBAR_REJECT_CODE);
|
|
2402
2405
|
};
|
|
2403
2406
|
// Create a WeakMap to store compartments per code cell
|
|
2404
2407
|
const codeDiffStripesCompartments = react__WEBPACK_IMPORTED_MODULE_2___default().useRef(new WeakMap());
|
|
@@ -2413,6 +2416,8 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2413
2416
|
notebook.widgets.forEach((cell, index) => {
|
|
2414
2417
|
if (cell.model.type === 'code') {
|
|
2415
2418
|
const isActiveCodeCell = activeCellIndex === index;
|
|
2419
|
+
// TODO: Instead of casting, we should rely on the type system to make
|
|
2420
|
+
// sure we're using the correct types!
|
|
2416
2421
|
const codeCell = cell;
|
|
2417
2422
|
const cmEditor = codeCell.editor;
|
|
2418
2423
|
const editorView = cmEditor === null || cmEditor === void 0 ? void 0 : cmEditor.editor;
|
|
@@ -2424,13 +2429,13 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2424
2429
|
codeDiffStripesCompartments.current.set(codeCell, compartment);
|
|
2425
2430
|
// Apply the initial configuration
|
|
2426
2431
|
editorView.dispatch({
|
|
2427
|
-
effects: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.appendConfig.of(compartment.of(unifiedDiffLines !== undefined && isActiveCodeCell ? (0,
|
|
2432
|
+
effects: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.appendConfig.of(compartment.of(unifiedDiffLines !== undefined && isActiveCodeCell ? (0,_CodeDiffDisplay__WEBPACK_IMPORTED_MODULE_19__.codeDiffStripesExtension)({ unifiedDiffLines: unifiedDiffLines }) : [])),
|
|
2428
2433
|
});
|
|
2429
2434
|
}
|
|
2430
2435
|
else {
|
|
2431
2436
|
// Reconfigure the compartment
|
|
2432
2437
|
editorView.dispatch({
|
|
2433
|
-
effects: compartment.reconfigure(unifiedDiffLines !== undefined && isActiveCodeCell ? (0,
|
|
2438
|
+
effects: compartment.reconfigure(unifiedDiffLines !== undefined && isActiveCodeCell ? (0,_CodeDiffDisplay__WEBPACK_IMPORTED_MODULE_19__.codeDiffStripesExtension)({ unifiedDiffLines: unifiedDiffLines }) : []),
|
|
2434
2439
|
});
|
|
2435
2440
|
}
|
|
2436
2441
|
}
|
|
@@ -2444,16 +2449,16 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2444
2449
|
return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-taskpane" },
|
|
2445
2450
|
react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-taskpane-header" },
|
|
2446
2451
|
react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-taskpane-header-left" },
|
|
2447
|
-
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(
|
|
2448
|
-
void app.commands.execute(
|
|
2452
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_20__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6__.settingsIcon.react, null), title: "Mito AI Settings", onClick: () => {
|
|
2453
|
+
void app.commands.execute(_SettingsManager_SettingsManagerPlugin__WEBPACK_IMPORTED_MODULE_21__.COMMAND_MITO_AI_SETTINGS);
|
|
2449
2454
|
} })),
|
|
2450
2455
|
react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-taskpane-header-right" },
|
|
2451
|
-
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(
|
|
2452
|
-
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(
|
|
2456
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_IconButton__WEBPACK_IMPORTED_MODULE_20__["default"], { icon: react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6__.addIcon.react, null), title: "Start New Chat", onClick: async () => { await startNewChat(); } }),
|
|
2457
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_DropdownMenu__WEBPACK_IMPORTED_MODULE_22__["default"], { trigger: react__WEBPACK_IMPORTED_MODULE_2___default().createElement("button", { className: "icon-button", title: "Chat Threads", onClick: fetchChatThreads },
|
|
2453
2458
|
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_6__.historyIcon.react, null)), items: chatThreads.length > 0
|
|
2454
2459
|
? chatThreads.map(thread => ({
|
|
2455
2460
|
label: thread.name,
|
|
2456
|
-
primaryIcon: activeThreadIdRef.current === thread.thread_id ?
|
|
2461
|
+
primaryIcon: activeThreadIdRef.current === thread.thread_id ? _icons__WEBPACK_IMPORTED_MODULE_23__.OpenIndicatorLabIcon.react : undefined,
|
|
2457
2462
|
onClick: () => fetchChatHistoryAndSetActiveThread(thread.thread_id),
|
|
2458
2463
|
secondaryActions: [
|
|
2459
2464
|
{
|
|
@@ -2472,24 +2477,24 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2472
2477
|
displayOptimizedChatHistory.length === 0 &&
|
|
2473
2478
|
react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-empty-message" },
|
|
2474
2479
|
react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { style: { margin: '0 auto 8px', display: 'block', textAlign: 'center' } },
|
|
2475
|
-
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(
|
|
2480
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_icons_MitoLogo__WEBPACK_IMPORTED_MODULE_24__["default"], { width: "60", height: "30" })),
|
|
2476
2481
|
react__WEBPACK_IMPORTED_MODULE_2___default().createElement("span", { style: { display: 'block', textAlign: 'center', fontWeight: 'bold', fontSize: '20px', marginBottom: '15px' } }, "Data Copilot"),
|
|
2477
|
-
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(
|
|
2482
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_CTACarousel__WEBPACK_IMPORTED_MODULE_25__["default"], { app: app })),
|
|
2478
2483
|
displayOptimizedChatHistory.map((displayOptimizedChat, index) => {
|
|
2479
|
-
return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(
|
|
2484
|
+
return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_ChatMessage_ChatMessage__WEBPACK_IMPORTED_MODULE_26__["default"], { key: index, message: displayOptimizedChat.message, promptType: displayOptimizedChat.promptType, messageType: displayOptimizedChat.type, agentResponse: displayOptimizedChat.agentResponse, codeCellID: displayOptimizedChat.codeCellID, mitoAIConnectionError: displayOptimizedChat.type === 'connection error', mitoAIConnectionErrorType: displayOptimizedChat.mitoAIConnectionErrorType || null, messageIndex: index, notebookTracker: notebookTracker, renderMimeRegistry: renderMimeRegistry, app: app, isLastAiMessage: index === lastAIMessagesIndex, isLastMessage: index === displayOptimizedChatHistory.length - 1, operatingSystem: operatingSystem, previewAICode: previewAICodeToActiveCell, acceptAICode: acceptAICode, rejectAICode: rejectAICode, onUpdateMessage: handleUpdateMessage, contextManager: contextManager, codeReviewStatus: codeReviewStatus, setNextSteps: setNextSteps }));
|
|
2480
2485
|
}).filter(message => message !== null),
|
|
2481
2486
|
loadingAIResponse &&
|
|
2482
2487
|
react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-loading-message" },
|
|
2483
2488
|
"Thinking ",
|
|
2484
|
-
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(
|
|
2489
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_LoadingDots__WEBPACK_IMPORTED_MODULE_27__["default"], null)),
|
|
2485
2490
|
hasCheckpoint &&
|
|
2486
2491
|
agentModeEnabled &&
|
|
2487
2492
|
agentExecutionStatus === 'idle' &&
|
|
2488
2493
|
displayOptimizedChatHistory.length > 0 && (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: 'message message-assistant-chat' },
|
|
2489
|
-
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(
|
|
2494
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_TextAndIconButton__WEBPACK_IMPORTED_MODULE_28__["default"], { text: "Revert changes", icon: _icons_UndoIcon__WEBPACK_IMPORTED_MODULE_29__["default"], title: "Revert changes", onClick: () => (0,_utils_checkpoint__WEBPACK_IMPORTED_MODULE_13__.restoreCheckpoint)(app, notebookTracker, setHasCheckpoint, getDuplicateChatHistoryManager, setChatHistoryManager), variant: "gray", width: "fit-contents", iconPosition: "left" }),
|
|
2490
2495
|
react__WEBPACK_IMPORTED_MODULE_2___default().createElement("p", { className: "text-muted text-sm" }, "Undo the most recent changes made by the agent")))),
|
|
2491
2496
|
displayOptimizedChatHistory.length === 0 && (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "suggestions-container" },
|
|
2492
|
-
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(
|
|
2497
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_ChatMessage_ScrollableSuggestions__WEBPACK_IMPORTED_MODULE_30__["default"], { onSelectSuggestion: (prompt) => {
|
|
2493
2498
|
if (agentModeEnabled) {
|
|
2494
2499
|
void startAgentExecution(prompt);
|
|
2495
2500
|
}
|
|
@@ -2498,15 +2503,15 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2498
2503
|
}
|
|
2499
2504
|
} }))),
|
|
2500
2505
|
react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: `connected-input-container ${nextSteps.length > 0 ? 'has-next-steps' : ''}` },
|
|
2501
|
-
nextSteps.length > 0 && (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(
|
|
2502
|
-
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(
|
|
2506
|
+
nextSteps.length > 0 && (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_NextStepsPills__WEBPACK_IMPORTED_MODULE_31__["default"], { nextSteps: nextSteps, onSelectNextStep: agentModeEnabled ? startAgentExecution : sendChatInputMessage, displayedNextStepsIfAvailable: displayedNextStepsIfAvailable, setDisplayedNextStepsIfAvailable: setDisplayedNextStepsIfAvailable })),
|
|
2507
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_ChatMessage_ChatInput__WEBPACK_IMPORTED_MODULE_32__["default"], { initialContent: '', placeholder: agentExecutionStatus === 'working' ? 'Agent is working...' :
|
|
2503
2508
|
agentExecutionStatus === 'stopping' ? 'Agent is stopping...' :
|
|
2504
2509
|
agentModeEnabled ? 'Ask agent to do anything' :
|
|
2505
2510
|
displayOptimizedChatHistory.length < 2 ? `Ask question (${operatingSystem === 'mac' ? '⌘' : 'Ctrl'}E), @ to mention`
|
|
2506
2511
|
: `Ask followup (${operatingSystem === 'mac' ? '⌘' : 'Ctrl'}E), @ to mention`, onSave: agentModeEnabled ? startAgentExecution : sendChatInputMessage, onCancel: undefined, isEditing: false, contextManager: contextManager, notebookTracker: notebookTracker, renderMimeRegistry: renderMimeRegistry, agentModeEnabled: agentModeEnabled })),
|
|
2507
2512
|
agentExecutionStatus !== 'working' && agentExecutionStatus !== 'stopping' && (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-controls" },
|
|
2508
2513
|
react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "chat-controls-left" },
|
|
2509
|
-
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(
|
|
2514
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_ToggleButton__WEBPACK_IMPORTED_MODULE_33__["default"], { leftText: "Chat", leftTooltip: "Chat mode suggests an edit to the active cell and let's you decide to accept or reject it.", rightText: "Agent", rightTooltip: "Agent mode writes and executes code until it's finished your request.", isLeftSelected: !agentModeEnabled, onChange: async (isLeftSelected) => {
|
|
2510
2515
|
await startNewChat(); // TODO: delete thread instead of starting new chat
|
|
2511
2516
|
setAgentModeEnabled(!isLeftSelected);
|
|
2512
2517
|
// Clear agent checkpoint when switching modes
|
|
@@ -2541,7 +2546,7 @@ const ChatTaskpane = ({ notebookTracker, renderMimeRegistry, contextManager, app
|
|
|
2541
2546
|
" \u23CE"))),
|
|
2542
2547
|
(agentExecutionStatus === 'working' || agentExecutionStatus === 'stopping') && (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("button", { className: "button-base button-red stop-agent-button", onClick: markAgentForStopping, disabled: agentExecutionStatus === 'stopping', "data-testid": "stop-agent-button" }, agentExecutionStatus === 'stopping' ? (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "stop-agent-button-content" },
|
|
2543
2548
|
"Stopping",
|
|
2544
|
-
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(
|
|
2549
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_LoadingCircle__WEBPACK_IMPORTED_MODULE_34__["default"], null),
|
|
2545
2550
|
" ")) : ('Stop Agent')))));
|
|
2546
2551
|
};
|
|
2547
2552
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ChatTaskpane);
|
|
@@ -8615,6 +8620,47 @@ async function checkForUpdates(serverSettings) {
|
|
|
8615
8620
|
}
|
|
8616
8621
|
|
|
8617
8622
|
|
|
8623
|
+
/***/ }),
|
|
8624
|
+
|
|
8625
|
+
/***/ "./lib/utils/waitForNotebookReady.js":
|
|
8626
|
+
/*!*******************************************!*\
|
|
8627
|
+
!*** ./lib/utils/waitForNotebookReady.js ***!
|
|
8628
|
+
\*******************************************/
|
|
8629
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8630
|
+
|
|
8631
|
+
__webpack_require__.r(__webpack_exports__);
|
|
8632
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8633
|
+
/* harmony export */ waitForNotebookReady: () => (/* binding */ waitForNotebookReady)
|
|
8634
|
+
/* harmony export */ });
|
|
8635
|
+
/*
|
|
8636
|
+
Wait for the notebook to be ready and attached.
|
|
8637
|
+
This is used to wait for the notebook to be ready before sending the first message.
|
|
8638
|
+
*/
|
|
8639
|
+
const waitForNotebookReady = async (notebookTracker) => {
|
|
8640
|
+
const notebook = notebookTracker.currentWidget;
|
|
8641
|
+
if (!notebook) {
|
|
8642
|
+
console.warn('No active notebook found');
|
|
8643
|
+
return;
|
|
8644
|
+
}
|
|
8645
|
+
// Wait for notebook to be ready and attached
|
|
8646
|
+
await notebook.context.ready;
|
|
8647
|
+
// Wait a bit more for cells to be fully initialized
|
|
8648
|
+
if (!notebook.content.isAttached) {
|
|
8649
|
+
await new Promise(resolve => {
|
|
8650
|
+
const checkAttached = () => {
|
|
8651
|
+
if (notebook.content.isAttached) {
|
|
8652
|
+
resolve();
|
|
8653
|
+
}
|
|
8654
|
+
else {
|
|
8655
|
+
setTimeout(checkAttached, 100);
|
|
8656
|
+
}
|
|
8657
|
+
};
|
|
8658
|
+
checkAttached();
|
|
8659
|
+
});
|
|
8660
|
+
}
|
|
8661
|
+
};
|
|
8662
|
+
|
|
8663
|
+
|
|
8618
8664
|
/***/ }),
|
|
8619
8665
|
|
|
8620
8666
|
/***/ "./lib/websockets/BaseWebsocketClient.js":
|
|
@@ -13845,4 +13891,4 @@ var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js
|
|
|
13845
13891
|
/***/ })
|
|
13846
13892
|
|
|
13847
13893
|
}]);
|
|
13848
|
-
//# sourceMappingURL=lib_index_js.
|
|
13894
|
+
//# sourceMappingURL=lib_index_js.114d2b34bc18a45df338.js.map
|