mirror of
				https://github.com/langgenius/dify.git
				synced 2025-10-31 02:42:59 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			819 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			819 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { get, post } from './base'
 | |
| import type {
 | |
|   FileUploadConfigResponse,
 | |
|   StructuredOutputRulesRequestBody,
 | |
|   StructuredOutputRulesResponse,
 | |
| } from '@/models/common'
 | |
| import { useMutation, useQuery } from '@tanstack/react-query'
 | |
| 
 | |
| const NAME_SPACE = 'common'
 | |
| 
 | |
| export const useFileUploadConfig = () => {
 | |
|   return useQuery<FileUploadConfigResponse>({
 | |
|     queryKey: [NAME_SPACE, 'file-upload-config'],
 | |
|     queryFn: () => get<FileUploadConfigResponse>('/files/upload'),
 | |
|   })
 | |
| }
 | |
| 
 | |
| export const useGenerateStructuredOutputRules = () => {
 | |
|   return useMutation({
 | |
|     mutationKey: [NAME_SPACE, 'generate-structured-output-rules'],
 | |
|     mutationFn: (body: StructuredOutputRulesRequestBody) => {
 | |
|       return post<StructuredOutputRulesResponse>(
 | |
|         '/rule-structured-output-generate',
 | |
|         { body },
 | |
|       )
 | |
|     },
 | |
|   })
 | |
| }
 | 
