diff --git a/src/app/sidebar/aichat.tsx b/src/app/sidebar/aichat.tsx
index 7edc7866..6d64cb64 100644
--- a/src/app/sidebar/aichat.tsx
+++ b/src/app/sidebar/aichat.tsx
@@ -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,
diff --git a/src/app/workspace/cmdinput/cmdinput.tsx b/src/app/workspace/cmdinput/cmdinput.tsx
index cdf40387..87d81cb2 100644
--- a/src/app/workspace/cmdinput/cmdinput.tsx
+++ b/src/app/workspace/cmdinput/cmdinput.tsx
@@ -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<{}, {}> {
-
+ {/*
-
+ */}
diff --git a/src/models/input.ts b/src/models/input.ts
index 1480921b..c87fe94b 100644
--- a/src/models/input.ts
+++ b/src/models/input.ts
@@ -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) {
- // this.codeSelectUuid = uuid;
- // this.codeSelectBlockRefArray = [];
- }
+ // 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,
+ });
}
}
}