mirror of
https://github.com/langgenius/dify.git
synced 2026-09-24 23:22:26 +08:00
refactor(api): migrate web chat endpoints to BaseModel (#37962)
This commit is contained in:
@@ -173,7 +173,7 @@ class FileService:
|
||||
|
||||
return upload_file
|
||||
|
||||
def get_file_preview(self, file_id: str, tenant_id: str):
|
||||
def get_file_preview(self, file_id: str, tenant_id: str) -> str:
|
||||
"""
|
||||
Return a short text preview extracted from a document file.
|
||||
"""
|
||||
@@ -191,9 +191,7 @@ class FileService:
|
||||
raise UnsupportedFileTypeError()
|
||||
|
||||
text = ExtractProcessor.load_from_upload_file(upload_file, return_text=True)
|
||||
text = text[0:PREVIEW_WORDS_LIMIT] if text else ""
|
||||
|
||||
return text
|
||||
return text[0:PREVIEW_WORDS_LIMIT] if text else ""
|
||||
|
||||
def get_image_preview(self, file_id: str, timestamp: str, nonce: str, sign: str):
|
||||
result = file_helpers.verify_image_signature(
|
||||
|
||||
Reference in New Issue
Block a user