Removes content from a vCon, or moves dialog bodies out to S3 or an HTTP endpoint.
Module: links.diet
| Option | Type | Default | Description |
|---|---|---|---|
remove_dialog_body |
bool | false |
Empties each dialog's body, after moving it if a target is set |
post_media_to_url |
string | "" |
URL that receives each body. Used when s3_bucket is empty |
remove_analysis |
bool | false |
Deletes the whole analysis array |
remove_attachment_types |
list | [] |
Removes attachments whose mime_type is in this list |
remove_system_prompts |
bool | false |
Deletes every system_prompt key, at any depth |
s3_bucket |
string | "" |
Bucket for dialog bodies. Takes priority over post_media_to_url |
s3_path |
string | "" |
Key prefix |
aws_access_key_id |
string | "" |
AWS access key ID |
aws_secret_access_key |
string | "" |
AWS secret key |
aws_region |
string | us-east-1 |
AWS region |
presigned_url_expiration |
number | None |
Lifetime of the stored URL in seconds. None means 3600 |
- Load the vCon. If it is missing, log an error and pass the uuid on.
- If
remove_dialog_bodyis true, handle each dialog that has abody:- With
s3_bucket, upload the body to[s3_path/]<vcon_uuid>/[<dialog_id>_]<random>.txtand store a presigned URL. - With
post_media_to_url, POST JSON withcontent,vcon_uuidanddialog_id. A 200 reply with aurlkey sets that URL. - With neither, set
bodyto"".
- With
- Delete
analysisifremove_analysisis true. - Filter attachments if
remove_attachment_typesis set. - Delete
system_promptkeys ifremove_system_promptsis true. - Save the vCon.
- A failed upload or POST sets
bodyto"". The content is gone from the vCon and the link continues. Only the POST path countsconserver.link.diet.media_post_failures. - A presigned URL stops working when it expires, and the link keeps no other reference to the object.
remove_analysisdeletes the key itself. A later link that adds analysis then raisesKeyError, so placedietafter them.remove_attachment_typescompares the literal fieldmime_type. Attachments that usemediatype, as spec-current vCons do, never match.- The attachment filter has no exception for
lawful_basis. An attachment with a listedmime_typeis removed whatever its purpose. - The link does not read
only_iforsampling_rate.
Returns the uuid, also when the vCon is missing.
The link only removes or replaces content. A moved dialog has its body set to the URL and gains body_type: "url", and its encoding stays as it was.
links:
slim_down:
module: links.diet
options:
remove_dialog_body: true
s3_bucket: vcon-media
s3_path: dialogs
aws_access_key_id: your-access-key-id
aws_secret_access_key: your-secret-key
aws_region: us-east-1
presigned_url_expiration: 86400
remove_system_prompts: trueconserver.link.diet.media_post_failures. See Metrics.