Skip to content

Commit 4ebd714

Browse files
committed
frontend/jupyter/llm: adjust layout and labeling of llm dialog
1 parent 3605fcb commit 4ebd714

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

src/packages/frontend/jupyter/llm/cell-tool.tsx

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
Alert,
99
Button,
1010
Collapse,
11-
Divider,
1211
Dropdown,
1312
Flex,
1413
Input,
@@ -1149,41 +1148,45 @@ export function LLMCellTool({
11491148

11501149
// Create marks dynamically
11511150
const marks: SliderSingleProps["marks"] = {
1152-
0: "this cell",
1151+
0: "0",
11531152
};
11541153

1155-
// Add marks for boundaries
1154+
// Only add boundary marks if they don't conflict with -2/+2
11561155
if (minValue < 0) {
1157-
marks[minValue] = "first";
1156+
marks[minValue] = minValue === -2 ? "-2" : "first";
11581157
}
11591158
if (maxValue > 0) {
1160-
marks[maxValue] = "last";
1159+
marks[maxValue] = maxValue === 2 ? "+2" : "last";
11611160
}
11621161

1163-
// Add -2 and +2 marks if they're within range
1164-
if (minValue <= -2) {
1162+
// Add -2 and +2 marks only if they're not at the boundaries
1163+
if (minValue < -2) {
11651164
marks[-2] = "-2";
11661165
}
1167-
if (maxValue >= 2) {
1166+
if (maxValue > 2) {
11681167
marks[2] = "+2";
11691168
}
11701169

11711170
return (
11721171
<>
1173-
<Divider orientation="left">
1174-
<Text>Context Selection</Text>
1175-
</Divider>
11761172
<Paragraph>
1177-
<Slider
1178-
range
1179-
marks={marks}
1180-
min={minValue}
1181-
max={maxValue}
1182-
step={1}
1183-
value={adjustedRange}
1184-
onChange={(value) => setContextRange(value as [number, number])}
1185-
style={{ margin: "20px 10px" }}
1186-
/>
1173+
<Flex align="center" gap="10px">
1174+
<Text>Context:</Text>
1175+
<Slider
1176+
range
1177+
marks={marks}
1178+
min={minValue}
1179+
max={maxValue}
1180+
step={1}
1181+
value={adjustedRange}
1182+
onChange={(value) => setContextRange(value as [number, number])}
1183+
style={{ flex: 1, margin: "0 20px" }}
1184+
/>
1185+
</Flex>
1186+
</Paragraph>
1187+
<Paragraph type="secondary">
1188+
Selected: {Math.abs(adjustedRange[0])} cells above + current cell +{" "}
1189+
{adjustedRange[1]} cells below
11871190
</Paragraph>
11881191
<Paragraph>
11891192
<Flex align="center" gap="10px">
@@ -1202,12 +1205,6 @@ export function LLMCellTool({
12021205
</Flex>
12031206
</Flex>
12041207
</Paragraph>
1205-
<Paragraph>
1206-
<Text type="secondary">
1207-
Selected: {Math.abs(adjustedRange[0])} cells above + current cell +{" "}
1208-
{adjustedRange[1]} cells below
1209-
</Text>
1210-
</Paragraph>
12111208
</>
12121209
);
12131210
}

0 commit comments

Comments
 (0)