-
Notifications
You must be signed in to change notification settings - Fork 5
/
typeDefExtensions.ts
115 lines (111 loc) · 3.64 KB
/
typeDefExtensions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* eslint-disable no-unused-vars */
export interface AssistOptions {
aiAssist?: {
/** Set to true to disable assistance for this field or type */
exclude?: boolean
/**
* Set to true to add translation field-action to the field.
* Only has an effect in document types configured for document or field level translations.
*/
translateAction?: boolean
}
}
declare module 'sanity' {
interface ArrayOptions extends AssistOptions {}
interface BlockOptions extends AssistOptions {}
interface BooleanOptions extends AssistOptions {}
interface CrossDatasetReferenceOptions extends AssistOptions {}
interface DateOptions extends AssistOptions {}
interface DatetimeOptions extends AssistOptions {}
interface DocumentOptions extends AssistOptions {}
interface FileOptions extends AssistOptions {}
interface GeopointOptions extends AssistOptions {}
interface ImageOptions {
aiAssist?: AssistOptions['aiAssist'] & {
/**
* When set, an image will be created whenever the `imageInstructionField` is written to by
* an AI Assist instruction.
*
* The value output by AI Assist will be use as an image prompt for an generative image AI.
*
* This means that instructions directly for the field or instructions that visit the field when running,
* will result in the image being changed.
*
* `imageInstructionField` must be a child-path relative to the image field, ie:
* * field
* * path.to.field
*
* ### Example
* ```ts
* defineType({
* type: 'image',
* name: 'articleImage',
* fields: [
* defineField({
* type: 'text',
* name: 'imagePrompt',
* title: 'Image prompt',
* rows: 2,
* }),
* ],
* options: {
* aiAssist: {
* imageInstructionField: 'imagePrompt',
* }
* },
* })
* ```
*/
imageInstructionField?: string
/**
* When set, an image description will be automatically created for the image.
*
* `imageDescriptionField` must be a child-path relative to the image field, ie:
* * field
* * path.to.field
*
* Whenever the image asset for the field is changed in the Studio,
* an image description is generated and set into the `imageDescriptionField`.
*
* ### Example
* ```ts
* defineType({
* type: 'image',
* name: 'articleImage',
* fields: [
* defineField({
* type: 'string',
* name: 'altText',
* title: 'Alt text',
* }),
* ],
* options: {
* aiAssist: {
* imageDescriptionField: 'altText',
* }
* },
* })
* ```
*/
imageDescriptionField?: string
}
}
interface NumberOptions extends AssistOptions {}
interface ObjectOptions extends AssistOptions {}
interface ReferenceBaseOptions {
aiAssist?: {
/** Set to true to disable assistance for this field or type */
exclude?: boolean
/**
* When set, the reference field will allow instructions to be added to it.
* Should be the name of the embeddings-index where assist will look for contextually relevant documents
* */
embeddingsIndex?: string
}
}
interface SlugOptions extends AssistOptions {}
interface StringOptions extends AssistOptions {}
interface TextOptions extends AssistOptions {}
interface UrlOptions extends AssistOptions {}
interface EmailOptions extends AssistOptions {}
}