1- import { Checkbox } from "vscrui "
1+ import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react "
22import { useEffect , useState } from "react"
33
44interface TemperatureControlProps {
@@ -16,57 +16,53 @@ export const TemperatureControl = ({ value, onChange, maxValue = 1 }: Temperatur
1616 } , [ value ] )
1717
1818 return (
19- < div style = { { display : "flex" , alignItems : "center" , gap : "8px" } } >
20- < Checkbox
19+ < div
20+ style = { {
21+ marginTop : 10 ,
22+ marginBottom : 15 ,
23+ paddingLeft : 10 ,
24+ borderLeft : "2px solid var(--vscode-button-background)" ,
25+ } } >
26+ < VSCodeCheckbox
2127 checked = { isCustomTemperature }
22- onChange = { ( checked : boolean ) => {
23- setIsCustomTemperature ( checked )
24- if ( ! checked ) {
28+ onChange = { ( e : any ) => {
29+ setIsCustomTemperature ( e . target . checked )
30+ if ( ! e . target . checked ) {
2531 onChange ( undefined ) // Reset to provider default
2632 } else {
2733 onChange ( 0 ) // Set initial value when enabling
2834 }
2935 } } >
30- < span style = { { fontWeight : 500 } } > Use custom temperature</ span >
31- </ Checkbox >
36+ < span style = { { fontWeight : "500" } } > Use custom temperature</ span >
37+ </ VSCodeCheckbox >
38+
39+ < p style = { { fontSize : "12px" , marginTop : "5px" , color : "var(--vscode-descriptionForeground)" } } >
40+ Controls randomness in the model's responses. Higher values make output more random, lower values make
41+ it more deterministic.
42+ </ p >
3243
3344 { isCustomTemperature && (
34- < >
35- < i
36- className = "codicon codicon-info"
37- title = { `Controls randomness in the model's responses. Higher values (e.g. 0.8) make output more random, lower values (e.g. 0.2) make it more deterministic. Range: 0-${ maxValue } ` }
38- style = { {
39- fontSize : "12px" ,
40- color : "var(--vscode-descriptionForeground)" ,
41- cursor : "help" ,
42- } }
43- />
44- < input
45- type = "range"
46- min = "0"
47- max = { maxValue }
48- step = "0.05"
49- value = { value }
50- onChange = { ( e ) => {
51- const newValue = parseFloat ( e . target . value )
52- onChange ( isNaN ( newValue ) ? undefined : newValue )
53- } }
54- style = { {
55- flexGrow : 1 ,
56- accentColor : "var(--vscode-button-background)" ,
57- height : "2px" ,
58- } }
59- />
60- < span
61- style = { {
62- fontSize : "12px" ,
63- color : "var(--vscode-descriptionForeground)" ,
64- minWidth : "36px" ,
65- textAlign : "right" ,
66- } } >
67- { value ?. toFixed ( 2 ) }
68- </ span >
69- </ >
45+ < div >
46+ < div style = { { display : "flex" , alignItems : "center" , gap : "5px" } } >
47+ < input
48+ type = "range"
49+ min = "0"
50+ max = { maxValue }
51+ step = "0.05"
52+ value = { value }
53+ onChange = { ( e ) => {
54+ const newValue = parseFloat ( e . target . value )
55+ onChange ( isNaN ( newValue ) ? undefined : newValue )
56+ } }
57+ style = { {
58+ flexGrow : 1 ,
59+ accentColor : "var(--vscode-button-background)" ,
60+ height : "2px" ,
61+ } }
62+ />
63+ < span style = { { minWidth : "45px" , textAlign : "left" } } > { value ?. toFixed ( 2 ) } </ span >
64+ </ div >
65+ </ div >
7066 ) }
7167 </ div >
7268 )
0 commit comments