mirror of
				https://github.com/langgenius/dify.git
				synced 2025-10-31 10:53:02 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			659 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			659 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import enum
 | |
| from typing import Any
 | |
| 
 | |
| from pydantic import BaseModel
 | |
| 
 | |
| 
 | |
| class PromptMessageFileType(enum.Enum):
 | |
|     IMAGE = 'image'
 | |
| 
 | |
|     @staticmethod
 | |
|     def value_of(value):
 | |
|         for member in PromptMessageFileType:
 | |
|             if member.value == value:
 | |
|                 return member
 | |
|         raise ValueError(f"No matching enum found for value '{value}'")
 | |
| 
 | |
| 
 | |
| class PromptMessageFile(BaseModel):
 | |
|     type: PromptMessageFileType
 | |
|     data: Any
 | |
| 
 | |
| 
 | |
| class ImagePromptMessageFile(PromptMessageFile):
 | |
|     class DETAIL(enum.Enum):
 | |
|         LOW = 'low'
 | |
|         HIGH = 'high'
 | |
| 
 | |
|     type: PromptMessageFileType = PromptMessageFileType.IMAGE
 | |
|     detail: DETAIL = DETAIL.LOW
 | 
