@@ -10,7 +10,7 @@ import FileSaver from 'file-saver'
10
10
import { render } from 'preact'
11
11
import FloatingToolbar from '../FloatingToolbar'
12
12
import { useClampWindowSize } from '../../hooks/use-clamp-window-size'
13
- import { defaultConfig , getUserConfig } from '../../config/index.mjs'
13
+ import { defaultConfig , getUserConfig , Models } from '../../config/index.mjs'
14
14
import { useTranslation } from 'react-i18next'
15
15
import DeleteButton from '../DeleteButton'
16
16
@@ -35,7 +35,7 @@ function ConversationCard(props) {
35
35
const [ isReady , setIsReady ] = useState ( ! props . question )
36
36
const [ port , setPort ] = useState ( ( ) => Browser . runtime . connect ( ) )
37
37
const [ session , setSession ] = useState ( props . session )
38
- const windowSize = useClampWindowSize ( [ 0 , Infinity ] , [ 250 , 1100 ] )
38
+ const windowSize = useClampWindowSize ( [ 750 , 1500 ] , [ 250 , 1100 ] )
39
39
const bodyRef = useRef ( null )
40
40
/**
41
41
* @type {[ConversationItemData[], (conversationItemData: ConversationItemData[]) => void] }
@@ -175,27 +175,46 @@ function ConversationCard(props) {
175
175
return (
176
176
< div className = "gpt-inner" >
177
177
< div className = "gpt-header" style = "margin: 15px;" >
178
- { props . closeable ? (
179
- < XLg
180
- className = "gpt-util-icon"
181
- title = { t ( 'Close the Window' ) }
182
- size = { 16 }
183
- onClick = { ( ) => {
184
- if ( props . onClose ) props . onClose ( )
185
- } }
186
- />
187
- ) : props . dockable ? (
188
- < Pin
189
- className = "gpt-util-icon"
190
- title = { t ( 'Pin the Window' ) }
191
- size = { 16 }
192
- onClick = { ( ) => {
193
- if ( props . onDock ) props . onDock ( )
178
+ < span className = "gpt-util-group" >
179
+ { props . closeable ? (
180
+ < XLg
181
+ className = "gpt-util-icon"
182
+ title = { t ( 'Close the Window' ) }
183
+ size = { 16 }
184
+ onClick = { ( ) => {
185
+ if ( props . onClose ) props . onClose ( )
186
+ } }
187
+ />
188
+ ) : props . dockable ? (
189
+ < Pin
190
+ className = "gpt-util-icon"
191
+ title = { t ( 'Pin the Window' ) }
192
+ size = { 16 }
193
+ onClick = { ( ) => {
194
+ if ( props . onDock ) props . onDock ( )
195
+ } }
196
+ />
197
+ ) : (
198
+ < img src = { logo } style = "user-select:none;width:20px;height:20px;" />
199
+ ) }
200
+ < select
201
+ style = { { width : windowSize [ 0 ] * 0.05 + 'px' } }
202
+ className = "normal-button"
203
+ required
204
+ onChange = { ( e ) => {
205
+ const modelName = e . target . value
206
+ setSession ( { ...session , modelName, aiName : t ( Models [ modelName ] . desc ) } )
194
207
} }
195
- />
196
- ) : (
197
- < img src = { logo } style = "user-select:none;width:20px;height:20px;" />
198
- ) }
208
+ >
209
+ { Object . entries ( Models ) . map ( ( [ key , model ] ) => {
210
+ return (
211
+ < option value = { key } key = { key } selected = { key === session . modelName } >
212
+ { t ( model . desc ) }
213
+ </ option >
214
+ )
215
+ } ) }
216
+ </ select >
217
+ </ span >
199
218
{ props . draggable ? (
200
219
< div className = "dragbar" />
201
220
) : (
0 commit comments