mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
AI Clear Button (#1274)
Adds a button and Cmd:l keybinding to clear the ai message history in the current block
This commit is contained in:
parent
4d57b5842b
commit
31d0aa114d
@ -252,6 +252,14 @@ export class WaveAiModel implements ViewModel {
|
||||
});
|
||||
return viewTextChildren;
|
||||
});
|
||||
this.endIconButtons = atom((get) => {
|
||||
let clearButton: IconButtonDecl = {
|
||||
elemtype: "iconbutton",
|
||||
icon: "delete-left",
|
||||
click: this.clearMessages.bind(this),
|
||||
};
|
||||
return [clearButton];
|
||||
});
|
||||
}
|
||||
|
||||
dispose() {
|
||||
@ -387,6 +395,19 @@ export class WaveAiModel implements ViewModel {
|
||||
sendMessage: this.sendMessage.bind(this),
|
||||
};
|
||||
}
|
||||
|
||||
async clearMessages() {
|
||||
await BlockService.SaveWaveAiData(this.blockId, []);
|
||||
globalStore.set(this.messagesAtom, []);
|
||||
}
|
||||
|
||||
keyDownHandler(waveEvent: WaveKeyboardEvent): boolean {
|
||||
if (checkKeyPressed(waveEvent, "Cmd:l")) {
|
||||
this.clearMessages();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function makeWaveAiViewModel(blockId): WaveAiModel {
|
||||
|
Loading…
Reference in New Issue
Block a user