({request})
| 3 | import {Pipe} from '@baseai/core'; |
| 4 | |
| 5 | export const action: ActionFunction = async ({request}) => { |
| 6 | const runOptions = await request.json(); |
| 7 | console.log('runOptions:', runOptions); |
| 8 | |
| 9 | // 1. Initiate the Pipe. |
| 10 | const pipe = new Pipe(getPipeWithMemory()); |
| 11 | |
| 12 | // 2. Run the pipe with user messages and other run options. |
| 13 | const {stream} = await pipe.run(runOptions); |
| 14 | |
| 15 | // 3. Return the ReadableStream directly. |
| 16 | return new Response(stream, { |
| 17 | status: 200, |
| 18 | }); |
| 19 | }; |