mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
save work
This commit is contained in:
parent
4758b7351d
commit
bcf6e91f48
@ -63,9 +63,7 @@ class ChatContent extends React.Component<{ chatWindowRef }, {}> {
|
||||
componentDidUpdate() {
|
||||
this.chatListKeyCount = 0;
|
||||
if (this.containerRef?.current && this.osInstance) {
|
||||
const { viewport, scrollOffsetElement } = this.osInstance.elements();
|
||||
const { scrollTop } = scrollOffsetElement;
|
||||
console.log("this.props.chatWindowRef.current.scrollTop", scrollTop);
|
||||
const { viewport } = this.osInstance.elements();
|
||||
viewport.scrollTo({
|
||||
behavior: "auto",
|
||||
top: this.props.chatWindowRef.current.scrollHeight,
|
||||
|
@ -86,9 +86,9 @@ class CmdInput extends React.Component<{}, {}> {
|
||||
e.stopPropagation();
|
||||
const inputModel = GlobalModel.inputModel;
|
||||
if (inputModel.getActiveAuxView() === appconst.InputAuxView_AIChat) {
|
||||
inputModel.closeAuxView();
|
||||
// inputModel.closeAuxView();
|
||||
} else {
|
||||
inputModel.openAIAssistantChat();
|
||||
// inputModel.openAIAssistantChat();
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,10 +191,10 @@ class CmdInput extends React.Component<{}, {}> {
|
||||
<div className="cmd-input-grow-spacer"></div>
|
||||
<HistoryInfo />
|
||||
</When>
|
||||
<When condition={openView === appconst.InputAuxView_AIChat}>
|
||||
{/* <When condition={openView === appconst.InputAuxView_AIChat}>
|
||||
<div className="cmd-input-grow-spacer"></div>
|
||||
<AIChat />
|
||||
</When>
|
||||
</When> */}
|
||||
<When condition={openView === appconst.InputAuxView_Info}>
|
||||
<InfoMsg key="infomsg" />
|
||||
</When>
|
||||
|
@ -578,10 +578,10 @@ class InputModel {
|
||||
let rtn = -1;
|
||||
// Why is codeSelectBlockRefArray being reset here? This causes a bug where multiple code blocks are highlighted
|
||||
// because multiple code blocks have the same index.
|
||||
if (uuid != this.codeSelectUuid) {
|
||||
// if (uuid != this.codeSelectUuid) {
|
||||
// this.codeSelectUuid = uuid;
|
||||
// this.codeSelectBlockRefArray = [];
|
||||
}
|
||||
// }
|
||||
rtn = this.codeSelectBlockRefArray.length;
|
||||
this.codeSelectBlockRefArray.push(blockRef);
|
||||
return rtn;
|
||||
@ -597,13 +597,29 @@ class InputModel {
|
||||
this.codeSelectSelectedIndex.set(blockIndex);
|
||||
const currentRef = this.codeSelectBlockRefArray[blockIndex].current;
|
||||
if (currentRef != null && this.aiChatWindowRef?.current != null) {
|
||||
const chatWindowTop = this.aiChatWindowRef.current.scrollTop;
|
||||
// const chatWindowTop = this.aiChatWindowRef.current.scrollTop;
|
||||
const { viewport, scrollOffsetElement } = this.chatOsInstance.elements();
|
||||
const chatWindowTop = scrollOffsetElement.scrollTop;
|
||||
|
||||
console.log("chatWindowTop", chatWindowTop);
|
||||
const chatWindowBottom = chatWindowTop + this.aiChatWindowRef.current.clientHeight - 100;
|
||||
console.log("chatWindowTop", chatWindowTop);
|
||||
console.log("this.aiChatWindowRef.current.clientHeight", this.aiChatWindowRef.current.clientHeight);
|
||||
const elemTop = currentRef.offsetTop;
|
||||
let elemBottom = elemTop - currentRef.offsetHeight;
|
||||
const elementIsInView = elemBottom < chatWindowBottom && elemTop > chatWindowTop;
|
||||
if (!elementIsInView) {
|
||||
this.aiChatWindowRef.current.scrollTop = elemBottom - this.aiChatWindowRef.current.clientHeight / 3;
|
||||
console.log("elemBottom", elemBottom);
|
||||
console.log(
|
||||
"this.aiChatWindowRef.current.clientHeight",
|
||||
this.aiChatWindowRef.current.clientHeight,
|
||||
this.aiChatWindowRef.current.clientHeight / 2
|
||||
);
|
||||
// this.aiChatWindowRef.current.scrollTop = elemBottom - this.aiChatWindowRef.current.clientHeight / 3;
|
||||
viewport.scrollTo({
|
||||
behavior: "auto",
|
||||
top: elemTop - 20,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user