File tree Expand file tree Collapse file tree 1 file changed +41
-8
lines changed Expand file tree Collapse file tree 1 file changed +41
-8
lines changed Original file line number Diff line number Diff line change @@ -159,13 +159,15 @@ const ToolsTab = ({
159
159
{ key }
160
160
</ Label >
161
161
{
162
- /* @ts -expect-error value type is currently unknown */
162
+ // @ts -expect-error Tool schema types are not fully typed
163
163
value . type === "string" ? (
164
164
< Textarea
165
165
id = { key }
166
166
name = { key }
167
- // @ts -expect-error value type is currently unknown
168
- placeholder = { value . description }
167
+ placeholder = {
168
+ // @ts -expect-error Tool schema types are not fully typed
169
+ value . description
170
+ }
169
171
onChange = { ( e ) =>
170
172
setParams ( {
171
173
...params ,
@@ -174,19 +176,50 @@ const ToolsTab = ({
174
176
}
175
177
className = "mt-1"
176
178
/>
179
+ ) :
180
+ // @ts -expect-error Tool schema types are not fully typed
181
+ value . type === "object" ? (
182
+ < Textarea
183
+ id = { key }
184
+ name = { key }
185
+ placeholder = {
186
+ // @ts -expect-error Tool schema types are not fully typed
187
+ value . description
188
+ }
189
+ onChange = { ( e ) => {
190
+ try {
191
+ const parsed = JSON . parse ( e . target . value ) ;
192
+ setParams ( {
193
+ ...params ,
194
+ [ key ] : parsed ,
195
+ } ) ;
196
+ } catch ( err ) {
197
+ // If invalid JSON, store as string - will be validated on submit
198
+ setParams ( {
199
+ ...params ,
200
+ [ key ] : e . target . value ,
201
+ } ) ;
202
+ }
203
+ } }
204
+ className = "mt-1"
205
+ />
177
206
) : (
178
207
< Input
179
- // @ts -expect-error value type is currently unknown
180
- type = { value . type === "number" ? "number" : "text" }
208
+ type = {
209
+ // @ts -expect-error Tool schema types are not fully typed
210
+ value . type === "number" ? "number" : "text"
211
+ }
181
212
id = { key }
182
213
name = { key }
183
- // @ts -expect-error value type is currently unknown
184
- placeholder = { value . description }
214
+ placeholder = {
215
+ // @ts -expect-error Tool schema types are not fully typed
216
+ value . description
217
+ }
185
218
onChange = { ( e ) =>
186
219
setParams ( {
187
220
...params ,
188
221
[ key ] :
189
- // @ts -expect-error value type is currently unknown
222
+ // @ts -expect-error Tool schema types are not fully typed
190
223
value . type === "number"
191
224
? Number ( e . target . value )
192
225
: e . target . value ,
You can’t perform that action at this time.
0 commit comments