Skip to content

Commit 2d08037

Browse files
authored
Fixed open ai renderer not scrolling correctly (#165)
* added scrolling to open ai renderer css * fixed max width * small fixes - added max width - added padding - fixed flex issue
1 parent 2266997 commit 2d08037

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

src/plugins/openai/openai.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
color: @term-bright-green;
1111
font-weight: bold;
1212
width: 100px;
13+
flex-shrink: 0;
1314
}
1415

1516
.openai-role.openai-role-assistant {
@@ -33,4 +34,6 @@
3334
color: @term-bright-red;
3435
}
3536
}
37+
38+
overflow-y: auto;
3639
}

src/plugins/openai/openai.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ class OpenAIRenderer extends React.Component<{ model: OpenAIRendererModel }> {
196196
}
197197
let message = output.message;
198198
let opts = model.opts;
199-
let maxWidth = opts.maxSize.width;
200199
let minWidth = opts.maxSize.width;
201200
if (minWidth > 1000) {
202201
minWidth = 1000;
@@ -206,12 +205,9 @@ class OpenAIRenderer extends React.Component<{ model: OpenAIRendererModel }> {
206205
<div className="openai-role openai-role-assistant">[assistant]</div>
207206
<div className="openai-content-assistant">
208207
<div
209-
className="scroller"
210208
style={{
211209
maxHeight: opts.maxSize.height,
212-
minWidth: minWidth,
213-
width: "min-content",
214-
maxWidth: maxWidth,
210+
paddingRight: 5
215211
}}
216212
>
217213
<Markdown text={message} style={{ maxHeight: opts.maxSize.height }} />
@@ -240,7 +236,19 @@ class OpenAIRenderer extends React.Component<{ model: OpenAIRendererModel }> {
240236
let cmd = model.rawCmd;
241237
let styleVal: Record<string, any> = null;
242238
if (model.loading.get() && model.savedHeight >= 0 && model.isDone) {
243-
styleVal = { height: model.savedHeight };
239+
styleVal = {
240+
height: model.savedHeight,
241+
maxHeight: model.opts.maxSize.height
242+
};
243+
} else {
244+
let maxWidth = model.opts.maxSize.width
245+
if(maxWidth > 1000) {
246+
maxWidth = 1000
247+
}
248+
styleVal = {
249+
maxWidth: maxWidth,
250+
maxHeight: model.opts.maxSize.height
251+
};
244252
}
245253
let version = model.version.get();
246254
let loadError = model.loadError.get();

0 commit comments

Comments
 (0)