Skip to content

Commit ee890db

Browse files
committed
fixed chat reset
1 parent 9ed83da commit ee890db

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎src/addons/addons/ai-integration/userscript.js‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ document.AI_INTEGRATION = { //probably the dumbest way to possibly do this, it j
3333
AIModels: [],
3434
};
3535

36-
const originalState = JSON.parse(JSON.stringify(document.AI_INTEGRATION));
3736
Blockly.getMainWorkspace = function () { // I have to do this as the getmainworkspace gets linked to the getSVG parsing one
3837
return mainWorkspace;
3938
}
@@ -258,7 +257,13 @@ function popupFunctionality() {
258257
document.getElementById('chat_content').children[1].remove();
259258
}
260259
if(document.getElementById('attachedFile') != null) document.getElementById('attachedFile').remove();
261-
document.AI_INTEGRATION = { ...originalState };
260+
document.AI_INTEGRATION.AI_currently_blabbering = false;
261+
document.AI_INTEGRATION.currentInputHasAttachment = false;
262+
document.AI_INTEGRATION.CodeChunks = [];
263+
document.AI_INTEGRATION.AllCodeChunksEverAdded = [];
264+
document.AI_INTEGRATION.processedCodeChunks = [];
265+
document.AI_INTEGRATION.chatHistory = [];
266+
document.AI_INTEGRATION.errorsDetected = [];
262267
}
263268
});
264269
document.getElementById('submitChat').addEventListener('click', () => {
@@ -782,8 +787,6 @@ export default async function ({ addon, console }) {
782787
})
783788
.then(data => {
784789
document.AI_INTEGRATION.AIModels = data;
785-
originalState.AIModels = data;
786-
Object.freeze(originalState);
787790
helpers.updateAIModels(authToken.gemini, authToken.openrouter);
788791
})
789792
.catch(error => {

0 commit comments

Comments
 (0)