Skip to content

Commit 8a89ff4

Browse files
committed
docs: update docs for the bulk-ai-flow plugin
1 parent ac49402 commit 8a89ff4

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

adminforth/documentation/docs/tutorial/07-Plugins/17-bulk-ai-flow.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,3 +332,53 @@ If you want to compare a generated image with an image stored in your storage, y
332332
After generation, you’ll see a button labeled "old image". Clicking it will open a pop-up where you can compare the generated image with the stored one:
333333
334334
![alt text](Bulk-vision-4.png)
335+
336+
## Extra data fields
337+
338+
When creating default prompts, you can use Handlebars to pass data from the record into the prompt:
339+
340+
```ts
341+
...
342+
fillPlainFields: {
343+
description: 'Create a description based on the apartment name: {{title}}.'
344+
},
345+
...
346+
```
347+
348+
Each record will receive a unique prompt based on its own title.
349+
350+
If you want to add extra data fields for use in your prompt, implement the `provideAdditionalContextForRecord` callback:
351+
352+
```ts
353+
provideAdditionalContextForRecord({ record, adminUser, resource }) {
354+
const extraData: any = {};
355+
if (record.country === 'Spain') {
356+
// Your logic
357+
// e.g. extraData.discount = '10%';
358+
} else {
359+
// Your logic
360+
}
361+
return extraData;
362+
},
363+
fillPlainFields: {
364+
description: 'Create a description based on the apartment name: {{title}}. Also include the fact that the apartment has a discount of {{extraData.discount}}.'
365+
},
366+
```
367+
368+
## Allow users to edit generation prompts
369+
370+
If you want to let users adjust generation prompts for their unique cases, add this to the plugin setup:
371+
372+
```ts
373+
...
374+
//diff-add
375+
askConfirmationBeforeGenerating: true,
376+
...
377+
```
378+
379+
The user will now see a popup with a "Start generation" button and an "Edit prompts" button, allowing them to modify the prompt before running it.
380+
381+
![alt text](Bulk-vision-5.png)
382+
![alt text](Bulk-vision-6.png)
383+
384+
> ☝️ Updated prompts are stored in the user's local storage. Changes are local to that browser and do not affect other users or devices.
66.9 KB
Loading
133 KB
Loading

0 commit comments

Comments
 (0)