mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
added openai bug fix
This commit is contained in:
parent
052645e0df
commit
24bba1305b
@ -113,19 +113,21 @@ class AIChat extends React.Component<{}, {}> {
|
|||||||
mobx.action(() => {
|
mobx.action(() => {
|
||||||
this.isFocused.set(true);
|
this.isFocused.set(true);
|
||||||
})();
|
})();
|
||||||
|
GlobalModel.inputModel.codeSelectDeselectAndClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
onTextAreaBlur(e: any) {
|
onTextAreaBlur(e: any) {
|
||||||
mobx.action(() => {
|
mobx.action(() => {
|
||||||
this.isFocused.set(false);
|
this.isFocused.set(false);
|
||||||
})();
|
})();
|
||||||
|
GlobalModel.inputModel.codeSelectDeselectAndClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
onTextAreaChange(e: any) {
|
onTextAreaChange(e: any) {
|
||||||
// set height of textarea based on number of newlines
|
// set height of textarea based on number of newlines
|
||||||
mobx.action(() => {
|
mobx.action(() => {
|
||||||
this.textAreaNumLines.set(e.target.value.split(/\n/).length);
|
this.textAreaNumLines.set(e.target.value.split(/\n/).length);
|
||||||
GlobalModel.inputModel.codeSelectDeselectAll();
|
GlobalModel.inputModel.codeSelectDeselectAndClear();
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +152,7 @@ class AIChat extends React.Component<{}, {}> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentRef.setRangeText("\n", currentRef.selectionStart, currentRef.selectionEnd, "end");
|
currentRef.setRangeText("\n", currentRef.selectionStart, currentRef.selectionEnd, "end");
|
||||||
GlobalModel.inputModel.codeSelectDeselectAll();
|
GlobalModel.inputModel.codeSelectDeselectAndClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
onArrowUpPressed(): boolean {
|
onArrowUpPressed(): boolean {
|
||||||
@ -160,7 +162,7 @@ class AIChat extends React.Component<{}, {}> {
|
|||||||
}
|
}
|
||||||
if (this.getLinePos(currentRef).linePos > 1) {
|
if (this.getLinePos(currentRef).linePos > 1) {
|
||||||
// normal up arrow
|
// normal up arrow
|
||||||
GlobalModel.inputModel.codeSelectDeselectAll();
|
GlobalModel.inputModel.codeSelectDeselectAndClear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
GlobalModel.inputModel.codeSelectSelectNextOldestCodeBlock();
|
GlobalModel.inputModel.codeSelectSelectNextOldestCodeBlock();
|
||||||
|
@ -582,7 +582,7 @@ class InputModel {
|
|||||||
}
|
}
|
||||||
let incBlockIndex = this.codeSelectSelectedIndex.get() + 1;
|
let incBlockIndex = this.codeSelectSelectedIndex.get() + 1;
|
||||||
if (this.codeSelectSelectedIndex.get() == this.codeSelectBlockRefArray.length - 1) {
|
if (this.codeSelectSelectedIndex.get() == this.codeSelectBlockRefArray.length - 1) {
|
||||||
this.codeSelectDeselectAll();
|
this.codeSelectDeselectAndClear();
|
||||||
if (this.aiChatWindowRef?.current != null) {
|
if (this.aiChatWindowRef?.current != null) {
|
||||||
this.aiChatWindowRef.current.scrollTop = this.aiChatWindowRef.current.scrollHeight;
|
this.aiChatWindowRef.current.scrollTop = this.aiChatWindowRef.current.scrollHeight;
|
||||||
}
|
}
|
||||||
@ -606,7 +606,7 @@ class InputModel {
|
|||||||
}
|
}
|
||||||
let decBlockIndex = this.codeSelectSelectedIndex.get() - 1;
|
let decBlockIndex = this.codeSelectSelectedIndex.get() - 1;
|
||||||
if (decBlockIndex < 0) {
|
if (decBlockIndex < 0) {
|
||||||
this.codeSelectDeselectAll(this.codeSelectTop);
|
this.codeSelectDeselectAndClear(this.codeSelectTop);
|
||||||
if (this.aiChatWindowRef?.current != null) {
|
if (this.aiChatWindowRef?.current != null) {
|
||||||
this.aiChatWindowRef.current.scrollTop = 0;
|
this.aiChatWindowRef.current.scrollTop = 0;
|
||||||
}
|
}
|
||||||
@ -629,16 +629,19 @@ class InputModel {
|
|||||||
return blockIndex == this.codeSelectSelectedIndex.get();
|
return blockIndex == this.codeSelectSelectedIndex.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
codeSelectDeselectAll(direction: number = this.codeSelectBottom) {
|
codeSelectDeselectAndClear(direction: number = this.codeSelectBottom) {
|
||||||
if (this.codeSelectSelectedIndex.get() == direction) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mobx.action(() => {
|
mobx.action(() => {
|
||||||
this.codeSelectSelectedIndex.set(direction);
|
this.codeSelectSelectedIndex.set(direction);
|
||||||
this.codeSelectBlockRefArray = [];
|
this.codeSelectBlockRefArray = [];
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
codeSelectDeselectAll(direction: number = this.codeSelectBottom) {
|
||||||
|
mobx.action(() => {
|
||||||
|
this.codeSelectSelectedIndex.set(direction);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
openAIAssistantChat(): void {
|
openAIAssistantChat(): void {
|
||||||
mobx.action(() => {
|
mobx.action(() => {
|
||||||
this.aIChatShow.set(true);
|
this.aIChatShow.set(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user