Skip to content

New file upload example - #237

Open
mattieruth wants to merge 6 commits into
mainfrom
new-file-upload-example
Open

New file upload example#237
mattieruth wants to merge 6 commits into
mainfrom
new-file-upload-example

Conversation

@mattieruth

Copy link
Copy Markdown
Contributor

No description provided.

New example showing how clients can upload local files or reference URLs
as visual context during a voice conversation. Uses RTVIProcessor with
uploads_folder on the server and client.sendFile via the RTVI protocol.
@mattieruth
mattieruth force-pushed the new-file-upload-example branch from 517490a to 362e8f3 Compare July 23, 2026 21:17
vipyne added 2 commits July 27, 2026 21:50
…/../../pipecat with a "remove before merge" TODO comment.

- bot.py: guards cli_args/uploads_folder access so it won't crash on Pipecat Cloud.
- app.js: URL format parsing uses new URL().pathname (handles query strings, rejects invalid URLs), the .catch().then() chains are reordered so success messages don't render after failures, and bot text is HTML-escaped
before the innerHTML insertions.
- README.md: added a note about Pipecat Cloud caveat that large-file upload needs a production /files endpoint.
Comment thread file-upload/README.md
conversation context. The LLM can then reason about the uploaded content and
respond with audio as it would for any other user turn.

Concepts this example is meant to demonstrate:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice overview

Comment thread file-upload/README.md Outdated
4. **Run the bot**:

```bash
uv run bot.py -u /tmp/uploads

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth having a default temp location if one is not specified? Simplifies usage.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't think that's a privacy/security issue? the runner will use this location to store and delete files. It felt a little presumptive to me to make a default.

@kompfner kompfner Jul 28, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant just for this example, which exists only to show file uploading. Not proposing baking anything into the runner itself.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Comment thread file-upload/README.md
# Edit .env.local if needed (defaults to localhost:7860)
```

> **Note:** Environment variables in Vite are bundled into the client and exposed in the browser. For production applications that require secret protection, consider implementing a backend proxy server to handle API requests and manage sensitive credentials securely.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread file-upload/server/bot.py Outdated
user_params=LLMUserAggregatorParams(vad_analyzer=SileroVADAnalyzer()),
)

rtvi = RTVIProcessor(uploads_folder=runner_args.cli_args.uploads_folder)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only configuration needed on the bot server side? That's pretty sweet.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing 🎉

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct. and even then it's only needed if you are supporting an endpoint for the client to upload files to. As @vipyne points out in her PR, PipecatCloud does not have an endpoint for this as of yet, so in that case, uploads_folder should be None and the client will only be able to upload either small files that can be sent wholesale over the transport message channel or urls.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have this (hopefully temporary) limitation today, we ought to mention it in the README, which presents Pipecat Cloud as a deployment option.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i believe it is already 🤔

Comment thread file-upload/server/bot.py

This bot uses a cascade pipeline: Speech-to-Text → LLM → Text-to-Speech

Generated by Pipecat CLI

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So there's also some new CLI affordances coming for configuring a bot to accept file uploads?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't have any cli changes planned but maybe i should? When I started this example, I generated it using the CLI which adds this line (and 98% of the lines in this file). Maybe I should remove this comment?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but maybe i should?

I'd have to refresh myself on the existing CLI options to see if something like "accept file uploads" would fit in...without going through them, I have no preference.

this line

I wonder if, if the intent of the CLI is to provide a starting point or scaffold that the user will then build on top of, this line should instead read "Bootstrapped by Pipecat CLI" or something. "Generated by" might lead the reader to believe this file is "managed" by a tool and shouldn't be edited. This is obviously an issue outside the scope of this PR. WDYT, @markbackman?

Comment thread file-upload/client/src/app.js
Comment thread file-upload/client/src/app.js
Comment thread file-upload/client/src/config.js Outdated
* This file is auto-generated by pipecat-cli
*/

export const AVAILABLE_TRANSPORTS = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add the websocket here ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Comment thread file-upload/client/package.json Outdated
Comment on lines +12 to +14
"@pipecat-ai/client-js": "file:../../../pipecat-client-web/client-js",
"@pipecat-ai/daily-transport": "file:../../../pipecat-client-web-transports/transports/daily",
"@pipecat-ai/small-webrtc-transport": "file:../../../pipecat-client-web-transports/transports/small-webrtc-transport"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Remember to fix this before merging. 🙂

option.textContent = 'SmallWebRTC';
} else if (transport === 'daily') {
option.textContent = 'Daily';
} else if (transport === 'websocket') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we're mentioning websocket, but we don't have it in either the dependencies or AVAILABLE_TRANSPORTS. I think we just need to decide whether we want to support it or remove it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, i don't think i meant to support it. though, i should test that...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually. i went ahead and added support :)

Comment thread file-upload/server/pyproject.toml Outdated
Comment on lines +22 to +23
[tool.uv.sources]
pipecat-ai = { path = "/Users/mattieruth/src/pipecat/pipecat", editable=true } No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Remember to fix this before merging. 🙂

Comment thread file-upload/AGENTS.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think any of the other examples have this. Are we planning to keep it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can remove it. like i said, I generated this example using the CLI and so some of the stuff was just basic scaffolding. though, in chatting with @markbackman, it seemed like maybe i should leave it? i have no preference/opinion.

Comment thread file-upload/CLAUDE.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. I don't think any of the other examples have this. Are we planning to keep it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same reply :)

Comment thread file-upload/server/bot.py Outdated
)

# cli_args is only populated when running via the development runner (not on
# Pipecat Cloud, where there is no uploads endpoint and large-file upload is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, so small-file upload is available even when uploads_folder is None?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes because those can fit in a basic message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants