StoredFileWithContext
Defined in: src/lib/db/chat/types.ts:171
File metadata with conversation context for file browsing. Extends FileMetadata with information about where the file was used.
Extends
Properties
conversationId
conversationId:
string
Defined in: src/lib/db/chat/types.ts:173
ID of the conversation where this file was attached
createdAt
createdAt:
Date
Defined in: src/lib/db/chat/types.ts:175
Timestamp when the file was stored (from the message)
id
id:
string
Defined in: src/lib/db/chat/types.ts:48
Unique identifier for the file (used as OPFS key for cached files)
Inherited from
messageRole
messageRole:
ChatRole
Defined in: src/lib/db/chat/types.ts:177
Role of the message that contains this file
name
name:
string
Defined in: src/lib/db/chat/types.ts:50
Display name of the file
Inherited from
size
size:
number
Defined in: src/lib/db/chat/types.ts:54
File size in bytes
Inherited from
sourceUrl?
optionalsourceUrl:string
Defined in: src/lib/db/chat/types.ts:70
Original external URL for files downloaded and cached locally (e.g., from MCP R2). Used purely for URL→OPFS mapping to enable fallback when the source returns 404.
This is metadata for local lookup only - it is NOT sent to the AI or rendered directly.
The file content is served from OPFS using the id field.
Inherited from
type
type:
string
Defined in: src/lib/db/chat/types.ts:52
MIME type (e.g., “image/png”)
Inherited from
url?
optionalurl:string
Defined in: src/lib/db/chat/types.ts:62
Content URL to include when sending this message to the AI.
When present, this URL is added as an image_url content part.
Typically used for user-uploaded files (data URIs) that should be sent with the message.
NOT used for MCP-cached files - those use sourceUrl for lookup and render from OPFS.
Inherited from