save work

This commit is contained in:
Red Adaya 2024-05-04 09:14:43 +08:00
parent cc61b16cec
commit 918ff98ea1
3 changed files with 4 additions and 24 deletions

View File

@ -294,7 +294,7 @@ class AIChat extends React.Component<{}, {}> {
}
render() {
const chatMessageItems = GlobalModel.inputModel.AICmdInfoChatItems.slice();
const chatMessageItems = GlobalModel.aichatModel.aiCmdInfoChatItems.slice();
return (
<div className="sidebar-aichat">
<AIChatKeybindings AIChatObject={this}></AIChatKeybindings>

View File

@ -8,34 +8,20 @@ import { GlobalCommandRunner } from "./global";
class AIChatModel {
globalModel: Model;
activeAuxView: OV<InputAuxViewType> = mobx.observable.box(null);
auxViewFocus: OV<boolean> = mobx.observable.box(false);
cmdInputHeight: OV<number> = mobx.observable.box(0);
aiChatTextAreaRef: React.RefObject<HTMLTextAreaElement>;
aiChatWindowRef: React.RefObject<HTMLDivElement>;
codeSelectBlockRefArray: Array<React.RefObject<HTMLElement>>;
codeSelectSelectedIndex: OV<number> = mobx.observable.box(-1);
codeSelectUuid: string;
AICmdInfoChatItems: mobx.IObservableArray<OpenAICmdInfoChatMessageType> = mobx.observable.array([], {
aiCmdInfoChatItems: mobx.IObservableArray<OpenAICmdInfoChatMessageType> = mobx.observable.array([], {
name: "aicmdinfo-chat",
});
readonly codeSelectTop: number = -2;
readonly codeSelectBottom: number = -1;
infoMsg: OV<InfoType> = mobx.observable.box(null);
infoTimeoutId: any = null;
inputExpanded: OV<boolean> = mobx.observable.box(false, {
name: "inputExpanded",
});
// focus
inputFocused: OV<boolean> = mobx.observable.box(false);
lineFocused: OV<boolean> = mobx.observable.box(false);
physicalInputFocused: OV<boolean> = mobx.observable.box(false);
forceInputFocus: boolean = false;
lastCurLine: string = "";
constructor(globalModel: Model) {
this.globalModel = globalModel;
@ -84,7 +70,7 @@ class AIChatModel {
@mobx.action
setOpenAICmdInfoChat(chat: OpenAICmdInfoChatMessageType[]): void {
this.AICmdInfoChatItems.replace(chat);
this.aiCmdInfoChatItems.replace(chat);
this.codeSelectBlockRefArray = [];
}
@ -222,13 +208,6 @@ class AIChatModel {
console.log("submit chat command error: ", error);
});
}
_clearInfoTimeout(): void {
if (this.infoTimeoutId != null) {
clearTimeout(this.infoTimeoutId);
this.infoTimeoutId = null;
}
}
}
export { AIChatModel };

View File

@ -1044,6 +1044,7 @@ class Model {
} else if (update.cmdline != null) {
this.inputModel.updateCmdLine(update.cmdline);
} else if (update.openaicmdinfochat != null) {
this.aichatModel.setOpenAICmdInfoChat(update.openaicmdinfochat);
this.inputModel.setOpenAICmdInfoChat(update.openaicmdinfochat);
} else if (update.screenstatusindicator != null) {
this.updateScreenStatusIndicators([update.screenstatusindicator]);