2
2
3
3
import React , { useState } from "react" ;
4
4
import GlobalConfig from "@/app/app.config"
5
+ import ModelSelector from "./ModelSelector" ;
5
6
6
7
export default function TextContainer ( ) {
7
8
const [ inputValue , setInputValue ] = useState ( "" ) ;
8
9
const [ isLoading , setIsLoading ] = useState ( false ) ;
9
10
const [ temperatureValue , setTemperatureValue ] = useState ( 0.8 ) ;
10
11
const [ maxTokensValue , setMaxTokensValue ] = useState ( 300 ) ;
11
12
13
+ const onModelChange = ( newModel ) => {
14
+ console . log ( 'Model changed to:' , newModel ) ;
15
+ }
16
+
12
17
const handleInputChange = ( e ) => {
13
18
setInputValue ( e . target . value ) ;
14
19
} ;
@@ -110,94 +115,97 @@ export default function TextContainer() {
110
115
}
111
116
} ;
112
117
113
- return < div className = "flex flex-col flex-auto h-full p-6" >
114
- < h3 className = "text-3xl font-medium text-gray-700" > Text Playground (Anthropic Claude V2)</ h3 >
115
- < div className = "flex flex-col flex-shrink-0 rounded-2xl bg-gray-100 p-4 mt-8" >
116
- < div className = "flex flex-col h-full overflow-x-auto mb-4" >
117
- < div className = "flex flex-col h-full" >
118
- < div className = "mb-4 w-full bg-gray-50 rounded-lg border border-gray-200" >
119
- < div className = "p-0 bg-white rounded-xl" >
120
- < textarea id = "input" rows = "20"
121
- disabled = { isLoading }
122
- value = { inputValue }
123
- onChange = { handleInputChange }
124
- className = "block p-4 w-full text-sm text-gray-800 bg-white"
125
- placeholder = "Write something..." required >
126
- </ textarea >
118
+ return (
119
+ < div className = "flex flex-col flex-auto h-full p-6" >
120
+ < ModelSelector onModelChange = { onModelChange } />
121
+ < h3 className = "text-3xl font-medium text-gray-700" > Text Playground (Anthropic Claude V2)</ h3 >
122
+ < div className = "flex flex-col flex-shrink-0 rounded-2xl bg-gray-100 p-4 mt-8" >
123
+ < div className = "flex flex-col h-full overflow-x-auto mb-4" >
124
+ < div className = "flex flex-col h-full" >
125
+ < div className = "mb-4 w-full bg-gray-50 rounded-lg border border-gray-200" >
126
+ < div className = "p-0 bg-white rounded-xl" >
127
+ < textarea id = "input" rows = "20"
128
+ disabled = { isLoading }
129
+ value = { inputValue }
130
+ onChange = { handleInputChange }
131
+ className = "block p-4 w-full text-sm text-gray-800 bg-white"
132
+ placeholder = "Write something..." required >
133
+ </ textarea >
134
+ </ div >
127
135
</ div >
128
136
</ div >
129
137
</ div >
130
- </ div >
131
- < div className = "flex flex-row items-center h-16 rounded-xl bg-white w-full px-4" >
132
138
< div className = "flex flex-row items-center h-16 rounded-xl bg-white w-full px-4" >
133
- < div className = "" >
134
- < div className = "relative w-full" >
135
- < label htmlFor = "temperature" >
136
- Temperature:
137
- </ label >
139
+ < div className = "flex flex-row items-center h-16 rounded-xl bg-white w-full px-4" >
140
+ < div className = "" >
141
+ < div className = "relative w-full" >
142
+ < label htmlFor = "temperature" >
143
+ Temperature:
144
+ </ label >
145
+ </ div >
138
146
</ div >
139
- </ div >
140
- < div className = "ml-4 " >
141
- < div className = "relative w-14" >
142
- < input
143
- placeholder = "0.8 "
144
- id = "temperature "
145
- type = "text"
146
- value = { temperatureValue }
147
- onChange = { handleTemperatureValueChange }
148
- onBlur = { handleTemperatureValueBlur }
149
- className = "flex w-full border rounded-xl focus:outline-none focus:border-indigo-300 pl-4 h-10"
150
- />
151
-
147
+ < div className = "ml-4" >
148
+ < div className = "relative w-14 " >
149
+ < input
150
+ placeholder = "0.8"
151
+ id = "temperature "
152
+ type = "text "
153
+ value = { temperatureValue }
154
+ onChange = { handleTemperatureValueChange }
155
+ onBlur = { handleTemperatureValueBlur }
156
+ className = "flex w-full border rounded-xl focus:outline-none focus:border-indigo-300 pl-4 h-10"
157
+ />
158
+
159
+ </ div >
152
160
</ div >
153
- </ div >
154
- < div className = "ml-8 " >
155
- < div className = "relative ">
156
- < label htmlFor = "tokens" >
157
- Max. length:
158
- </ label >
161
+ < div className = "ml-8" >
162
+ < div className = "relative " >
163
+ < label htmlFor = "tokens ">
164
+ Max. length:
165
+ </ label >
166
+ </ div >
159
167
</ div >
160
- </ div >
161
- < div className = "ml-4" >
162
- < div className = "relative w-20" >
163
- < input
164
- placeholder = "300"
165
- id = "tokens"
166
- type = "text"
167
- value = { maxTokensValue }
168
- onChange = { handleMaxTokensValueChange }
169
- onBlur = { handleMaxTokensValueBlur }
170
- className = "flex w-full border rounded-xl focus:outline-none focus:border-indigo-300 pl-4 h-10"
171
- />
172
-
168
+ < div className = "ml-4" >
169
+ < div className = "relative w-20" >
170
+ < input
171
+ placeholder = "300"
172
+ id = "tokens"
173
+ type = "text"
174
+ value = { maxTokensValue }
175
+ onChange = { handleMaxTokensValueChange }
176
+ onBlur = { handleMaxTokensValueBlur }
177
+ className = "flex w-full border rounded-xl focus:outline-none focus:border-indigo-300 pl-4 h-10"
178
+ />
179
+
180
+ </ div >
181
+ </ div >
182
+ < div className = "ml-4 ml-auto" >
183
+ < button
184
+ type = "button"
185
+ disabled = { isLoading }
186
+ onClick = { sendMessage }
187
+ className = { getButtonClass ( ) } >
188
+ < span > Send</ span >
189
+ < span className = "ml-2" >
190
+ < svg
191
+ className = "w-4 h-4 transform rotate-45 -mt-px"
192
+ fill = "none"
193
+ stroke = "currentColor"
194
+ viewBox = "0 0 24 24"
195
+ xmlns = "http://www.w3.org/2000/svg" >
196
+ < path
197
+ strokeLinecap = "round"
198
+ strokeLinejoin = "round"
199
+ strokeWidth = "2"
200
+ d = "M12 19l9 2-9-18-9 18 9-2zm0 0v-8" >
201
+ </ path >
202
+ </ svg >
203
+ </ span >
204
+ </ button >
173
205
</ div >
174
- </ div >
175
- < div className = "ml-4 ml-auto" >
176
- < button
177
- type = "button"
178
- disabled = { isLoading }
179
- onClick = { sendMessage }
180
- className = { getButtonClass ( ) } >
181
- < span > Send</ span >
182
- < span className = "ml-2" >
183
- < svg
184
- className = "w-4 h-4 transform rotate-45 -mt-px"
185
- fill = "none"
186
- stroke = "currentColor"
187
- viewBox = "0 0 24 24"
188
- xmlns = "http://www.w3.org/2000/svg" >
189
- < path
190
- strokeLinecap = "round"
191
- strokeLinejoin = "round"
192
- strokeWidth = "2"
193
- d = "M12 19l9 2-9-18-9 18 9-2zm0 0v-8" >
194
- </ path >
195
- </ svg >
196
- </ span >
197
- </ button >
198
206
</ div >
199
207
</ div >
200
208
</ div >
201
209
</ div >
202
- </ div >
210
+ )
203
211
} ;
0 commit comments