mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-17 01:55:57 +08:00
feat: update schema handling logic based on current tab in JSON schema config modal
This commit is contained in:
parent
b093bed081
commit
41232259e1
@ -100,13 +100,19 @@ const JsonSchemaConfig: FC<JsonSchemaConfigProps> = ({
|
||||
}, [currentTab, jsonSchema, json, advancedEditing, isAddingNewField, t])
|
||||
|
||||
const handleApplySchema = useCallback((schema: SchemaRoot) => {
|
||||
setJsonSchema(schema)
|
||||
}, [])
|
||||
if (currentTab === SchemaView.VisualEditor)
|
||||
setJsonSchema(schema)
|
||||
else if (currentTab === SchemaView.JsonSchema)
|
||||
setJson(JSON.stringify(schema, null, 2))
|
||||
}, [currentTab])
|
||||
|
||||
const handleSubmit = useCallback((schema: string) => {
|
||||
const jsonSchema = jsonToSchema(schema) as SchemaRoot
|
||||
setJsonSchema(jsonSchema)
|
||||
}, [])
|
||||
if (currentTab === SchemaView.VisualEditor)
|
||||
setJsonSchema(jsonSchema)
|
||||
else if (currentTab === SchemaView.JsonSchema)
|
||||
setJson(JSON.stringify(jsonSchema, null, 2))
|
||||
}, [currentTab])
|
||||
|
||||
const handleVisualEditorUpdate = useCallback((schema: SchemaRoot) => {
|
||||
setJsonSchema(schema)
|
||||
|
Loading…
x
Reference in New Issue
Block a user