Use generateDefaultValue for object and array defaults
This commit is contained in:
@@ -6,6 +6,7 @@ import { Label } from "@/components/ui/label";
|
|||||||
import { TabsContent } from "@/components/ui/tabs";
|
import { TabsContent } from "@/components/ui/tabs";
|
||||||
import { Textarea } from "@/components/ui/textarea";
|
import { Textarea } from "@/components/ui/textarea";
|
||||||
import DynamicJsonForm, { JsonSchemaType, JsonValue } from "./DynamicJsonForm";
|
import DynamicJsonForm, { JsonSchemaType, JsonValue } from "./DynamicJsonForm";
|
||||||
|
import { generateDefaultValue } from "@/utils/schemaUtils";
|
||||||
import {
|
import {
|
||||||
ListToolsResult,
|
ListToolsResult,
|
||||||
Tool,
|
Tool,
|
||||||
@@ -215,8 +216,7 @@ const ToolsTab = ({
|
|||||||
items: prop.items,
|
items: prop.items,
|
||||||
}}
|
}}
|
||||||
value={
|
value={
|
||||||
(params[key] as JsonValue) ??
|
(params[key] as JsonValue) ?? generateDefaultValue(prop)
|
||||||
(prop.type === "array" ? [] : {})
|
|
||||||
}
|
}
|
||||||
onChange={(newValue: JsonValue) => {
|
onChange={(newValue: JsonValue) => {
|
||||||
setParams({
|
setParams({
|
||||||
|
|||||||
Reference in New Issue
Block a user