mirror of
https://github.com/langgenius/dify.git
synced 2026-05-11 14:58:23 +08:00
Agent-Logs-Url: https://github.com/langgenius/dify/sessions/489dd945-dfff-462a-9c76-d29fdaa55de2 Co-authored-by: FFXN <31929997+FFXN@users.noreply.github.com>
17 lines
502 B
Python
17 lines
502 B
Python
from flask_restx import fields
|
|
from graphon.file import File
|
|
|
|
|
|
class FilesContainedField(fields.Raw):
|
|
def format(self, value):
|
|
return self._format_file_object(value)
|
|
|
|
def _format_file_object(self, v):
|
|
if isinstance(v, File):
|
|
return v.model_dump()
|
|
if isinstance(v, dict):
|
|
return {k: self._format_file_object(vv) for k, vv in v.items()}
|
|
if isinstance(v, list):
|
|
return [self._format_file_object(vv) for vv in v]
|
|
return v
|