> = ({
const [collapsed, setCollapsed] = React.useState(false)
const pipelineId = useStore(s => s.pipelineId)
const setShowInputFieldPanel = useStore(s => s.setShowInputFieldPanel)
+ const { getMatchedSchemaType } = useMatchSchemaType()
if (isLoading) {
return
@@ -122,7 +124,7 @@ const Panel: FC> = ({
{outputItem.value?.type === 'object' ? (
+ payload={wrapStructuredVarItem(outputItem, getMatchedSchemaType(outputItem.value))} />
) : (
) => {
if (variable?.general_chunks)
return CHUNK_TYPE_MAP.general_chunks
@@ -60,16 +61,16 @@ export const getOutputVariableAlias = (variable: Record) => {
if (variable?.file_type)
return 'file'
}
-export const wrapStructuredVarItem = (outputItem: any): StructuredOutput => {
+
+export const wrapStructuredVarItem = (outputItem: any, matchedSchemaType: string): StructuredOutput => {
const dataType = Type.object
- // console.log(outputItem)
return {
schema: {
type: dataType,
properties: {
[outputItem.name]: {
...outputItem.value,
- alias: getOutputVariableAlias(outputItem.value?.properties),
+ schemaType: matchedSchemaType,
},
},
additionalProperties: false,
diff --git a/web/service/use-common.ts b/web/service/use-common.ts
index ae9300ef57..8fdd0b6c77 100644
--- a/web/service/use-common.ts
+++ b/web/service/use-common.ts
@@ -60,3 +60,17 @@ export const useFilePreview = (fileID: string) => {
enabled: !!fileID,
})
}
+
+type SchemaTypeDefinition = {
+ name: string
+ schema: {
+ properties: Record
+ }
+}
+
+export const useSchemaTypeDefinitions = () => {
+ return useQuery({
+ queryKey: [NAME_SPACE, 'schema-type-definitions'],
+ queryFn: () => get('/spec/schema-definitions'),
+ })
+}