mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-17 14:55:23 +00:00
Merge pull request #18284 from Stoyan-Zlatev/feature/knowledge-response-file-hash
feat: Extend FileMetadataResponse to have hash field
This commit is contained in:
commit
7031708c87
1 changed files with 4 additions and 1 deletions
|
|
@ -82,6 +82,7 @@ class FileModelResponse(BaseModel):
|
||||||
|
|
||||||
class FileMetadataResponse(BaseModel):
|
class FileMetadataResponse(BaseModel):
|
||||||
id: str
|
id: str
|
||||||
|
hash: Optional[str] = None
|
||||||
meta: dict
|
meta: dict
|
||||||
created_at: int # timestamp in epoch
|
created_at: int # timestamp in epoch
|
||||||
updated_at: int # timestamp in epoch
|
updated_at: int # timestamp in epoch
|
||||||
|
|
@ -147,6 +148,7 @@ class FilesTable:
|
||||||
file = db.get(File, id)
|
file = db.get(File, id)
|
||||||
return FileMetadataResponse(
|
return FileMetadataResponse(
|
||||||
id=file.id,
|
id=file.id,
|
||||||
|
hash=file.hash,
|
||||||
meta=file.meta,
|
meta=file.meta,
|
||||||
created_at=file.created_at,
|
created_at=file.created_at,
|
||||||
updated_at=file.updated_at,
|
updated_at=file.updated_at,
|
||||||
|
|
@ -182,12 +184,13 @@ class FilesTable:
|
||||||
return [
|
return [
|
||||||
FileMetadataResponse(
|
FileMetadataResponse(
|
||||||
id=file.id,
|
id=file.id,
|
||||||
|
hash=file.hash,
|
||||||
meta=file.meta,
|
meta=file.meta,
|
||||||
created_at=file.created_at,
|
created_at=file.created_at,
|
||||||
updated_at=file.updated_at,
|
updated_at=file.updated_at,
|
||||||
)
|
)
|
||||||
for file in db.query(
|
for file in db.query(
|
||||||
File.id, File.meta, File.created_at, File.updated_at
|
File.id, File.hash, File.meta, File.created_at, File.updated_at
|
||||||
)
|
)
|
||||||
.filter(File.id.in_(ids))
|
.filter(File.id.in_(ids))
|
||||||
.order_by(File.updated_at.desc())
|
.order_by(File.updated_at.desc())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue