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() { render() {
const chatMessageItems = GlobalModel.inputModel.AICmdInfoChatItems.slice(); const chatMessageItems = GlobalModel.aichatModel.aiCmdInfoChatItems.slice();
return ( return (
<div className="sidebar-aichat"> <div className="sidebar-aichat">
<AIChatKeybindings AIChatObject={this}></AIChatKeybindings> <AIChatKeybindings AIChatObject={this}></AIChatKeybindings>

View File

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

View File

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