@sanity/assist 1.0.11 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +283 -78
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +283 -78
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/assistDocument/hooks/useInstructionToaster.tsx +1 -1
- package/src/assistInspector/AssistInspector.tsx +7 -4
- package/src/assistInspector/InstructionTaskHistoryButton.tsx +1 -1
- package/src/components/FadeInContent.tsx +18 -11
- package/src/components/ImageContext.tsx +39 -0
- package/src/fieldActions/assistFieldActions.tsx +18 -11
- package/src/fieldActions/generateCaptionActions.tsx +58 -0
- package/src/helpers/typeUtils.ts +16 -1
- package/src/plugin.tsx +18 -0
- package/src/schemas/typeDefExtensions.ts +1 -0
- package/src/types.ts +1 -0
- package/src/useApiClient.ts +53 -0
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ In your Studio project folder, install the following plugin dependency:
|
|
|
40
40
|
npm install @sanity/assist sanity@latest
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
This plugin requires `sanity` version `3.
|
|
43
|
+
This plugin requires `sanity` version `3.14.5` or greater.
|
|
44
44
|
|
|
45
45
|
## Setup
|
|
46
46
|
|
|
@@ -200,6 +200,33 @@ but some common caveats to the field that you may run into using AI Assist are:
|
|
|
200
200
|
* Timeouts: To be able to write structured content, we're using the largest language models - long-running results may time out or intermittently fail
|
|
201
201
|
* Limited capacity: The underlying LLM APIs used by AI Assist are resource constrained
|
|
202
202
|
|
|
203
|
+
## Other features
|
|
204
|
+
|
|
205
|
+
### Caption generation
|
|
206
|
+
AI Assist can optionally generate captions for images. This has to be enabled on an image-type/field,
|
|
207
|
+
by setting the `options.captionField` on the image type, where `captionField` is the field name of a
|
|
208
|
+
custom string-field on the image object:
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
defineField({
|
|
212
|
+
type: 'image',
|
|
213
|
+
name: 'inlineImage',
|
|
214
|
+
title: 'Image',
|
|
215
|
+
fields: [
|
|
216
|
+
defineField({
|
|
217
|
+
type: 'string',
|
|
218
|
+
name: 'caption',
|
|
219
|
+
title: 'Caption',
|
|
220
|
+
}),
|
|
221
|
+
],
|
|
222
|
+
options: {
|
|
223
|
+
captionField: 'caption',
|
|
224
|
+
},
|
|
225
|
+
}),
|
|
226
|
+
```
|
|
227
|
+
This will add a "Generate caption" action to the configured field.
|
|
228
|
+
"Generate caption" action will automatically run whenever the image changes.
|
|
229
|
+
|
|
203
230
|
## License
|
|
204
231
|
|
|
205
232
|
[MIT](LICENSE) © Sanity
|
package/dist/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ declare module 'sanity' {
|
|
|
40
40
|
interface GeopointOptions extends AssistOptions {}
|
|
41
41
|
interface ImageOptions extends AssistOptions {
|
|
42
42
|
imagePromptField?: string
|
|
43
|
+
captionField?: string
|
|
43
44
|
}
|
|
44
45
|
interface NumberOptions extends AssistOptions {}
|
|
45
46
|
interface ObjectOptions extends AssistOptions {}
|