@nice2dev/ui-ai 1.0.2
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/CHANGELOG.md +64 -0
- package/README.md +56 -0
- package/dist/NiceAIHintBubble.d.ts +4 -0
- package/dist/NiceAIHintBubble.d.ts.map +1 -0
- package/dist/NiceAIProvider.d.ts +29 -0
- package/dist/NiceAIProvider.d.ts.map +1 -0
- package/dist/index.cjs +10 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +1078 -0
- package/dist/integrations.d.ts +287 -0
- package/dist/integrations.d.ts.map +1 -0
- package/dist/rateLimiter.d.ts +23 -0
- package/dist/rateLimiter.d.ts.map +1 -0
- package/dist/streaming.d.ts +25 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +133 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/useNiceAIHint.d.ts +10 -0
- package/dist/useNiceAIHint.d.ts.map +1 -0
- package/dist/wrappers.d.ts +66 -0
- package/dist/wrappers.d.ts.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { AIHintContext } from './types';
|
|
2
|
+
import { UseNiceAIHintOptions } from './useNiceAIHint';
|
|
3
|
+
|
|
4
|
+
/** Build AIHintContext for a text input/textarea. */
|
|
5
|
+
export declare function buildTextInputContext(label: string, value?: string, opts?: {
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
maxLength?: number;
|
|
8
|
+
pattern?: string;
|
|
9
|
+
}): AIHintContext;
|
|
10
|
+
/** Build AIHintContext for a number input/slider. */
|
|
11
|
+
export declare function buildNumberInputContext(label: string, value?: number, opts?: {
|
|
12
|
+
min?: number;
|
|
13
|
+
max?: number;
|
|
14
|
+
step?: number;
|
|
15
|
+
unit?: string;
|
|
16
|
+
}): AIHintContext;
|
|
17
|
+
/** Build AIHintContext for a select/autocomplete/lookup. */
|
|
18
|
+
export declare function buildSelectContext(label: string, value?: unknown, opts?: {
|
|
19
|
+
options?: Array<{
|
|
20
|
+
label: string;
|
|
21
|
+
value: unknown;
|
|
22
|
+
}>;
|
|
23
|
+
multiple?: boolean;
|
|
24
|
+
}): AIHintContext;
|
|
25
|
+
/** Build AIHintContext for a date picker/calendar. */
|
|
26
|
+
export declare function buildDatePickerContext(label: string, value?: string | Date, opts?: {
|
|
27
|
+
min?: string;
|
|
28
|
+
max?: string;
|
|
29
|
+
disableWeekends?: boolean;
|
|
30
|
+
}): AIHintContext;
|
|
31
|
+
/** Build AIHintContext for a color picker. */
|
|
32
|
+
export declare function buildColorPickerContext(label: string, value?: string, opts?: {
|
|
33
|
+
palette?: string[];
|
|
34
|
+
industry?: string;
|
|
35
|
+
}): AIHintContext;
|
|
36
|
+
/** Build AIHintContext for a data grid. */
|
|
37
|
+
export declare function buildDataGridContext(label: string, opts?: {
|
|
38
|
+
columns?: string[];
|
|
39
|
+
rowCount?: number;
|
|
40
|
+
currentFilters?: Record<string, unknown>;
|
|
41
|
+
currentSorts?: string[];
|
|
42
|
+
}): AIHintContext;
|
|
43
|
+
/** Build AIHintContext for a chart. */
|
|
44
|
+
export declare function buildChartContext(label: string, opts?: {
|
|
45
|
+
currentType?: string;
|
|
46
|
+
seriesCount?: number;
|
|
47
|
+
pointCount?: number;
|
|
48
|
+
dataDescription?: string;
|
|
49
|
+
}): AIHintContext;
|
|
50
|
+
/** Build AIHintContext for form-level AI fill. */
|
|
51
|
+
export declare function buildFormFillContext(description: string, fields: Array<{
|
|
52
|
+
label: string;
|
|
53
|
+
type: string;
|
|
54
|
+
required?: boolean;
|
|
55
|
+
}>): AIHintContext;
|
|
56
|
+
/** Build AIHintContext for AI-powered validation messages. */
|
|
57
|
+
export declare function buildValidationContext(fieldLabel: string, fieldType: string, value: unknown, error: string, opts?: {
|
|
58
|
+
rules?: Record<string, unknown>;
|
|
59
|
+
}): AIHintContext;
|
|
60
|
+
/** AI hint hook for text inputs — suggests content, corrects grammar. */
|
|
61
|
+
export declare function useAITextHint(label: string, value?: string, opts?: {
|
|
62
|
+
placeholder?: string;
|
|
63
|
+
maxLength?: number;
|
|
64
|
+
pattern?: string;
|
|
65
|
+
} & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
66
|
+
/** AI hint hook for number inputs — suggests reasonable values/ranges. */
|
|
67
|
+
export declare function useAINumberHint(label: string, value?: number, opts?: {
|
|
68
|
+
min?: number;
|
|
69
|
+
max?: number;
|
|
70
|
+
step?: number;
|
|
71
|
+
unit?: string;
|
|
72
|
+
} & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
73
|
+
/** AI hint hook for select/autocomplete — suggests best option. */
|
|
74
|
+
export declare function useAISelectHint(label: string, value?: unknown, opts?: {
|
|
75
|
+
options?: Array<{
|
|
76
|
+
label: string;
|
|
77
|
+
value: unknown;
|
|
78
|
+
}>;
|
|
79
|
+
multiple?: boolean;
|
|
80
|
+
} & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
81
|
+
/** AI hint hook for date pickers — suggests relevant dates. */
|
|
82
|
+
export declare function useAIDateHint(label: string, value?: string | Date, opts?: {
|
|
83
|
+
min?: string;
|
|
84
|
+
max?: string;
|
|
85
|
+
disableWeekends?: boolean;
|
|
86
|
+
} & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
87
|
+
/** AI hint hook for color pickers — suggests palettes. */
|
|
88
|
+
export declare function useAIColorHint(label: string, value?: string, opts?: {
|
|
89
|
+
palette?: string[];
|
|
90
|
+
industry?: string;
|
|
91
|
+
} & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
92
|
+
/** AI-powered validation messages — turns generic errors into friendly explanations. */
|
|
93
|
+
export declare function useAIValidation(fieldLabel: string, fieldType: string, value: unknown, error: string | null, opts?: {
|
|
94
|
+
rules?: Record<string, unknown>;
|
|
95
|
+
} & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
96
|
+
/** AI form-fill — parses a text description into form field values. */
|
|
97
|
+
export declare function useAIFormFill(description: string, fields: Array<{
|
|
98
|
+
label: string;
|
|
99
|
+
type: string;
|
|
100
|
+
required?: boolean;
|
|
101
|
+
}>, opts?: UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
102
|
+
/** Build AIHintContext for a code editor (Monaco/CodeMirror).
|
|
103
|
+
* Returns inline completion suggestions or code review hints. */
|
|
104
|
+
export declare function buildCodeEditorContext(language: string, value?: string, opts?: {
|
|
105
|
+
cursorLine?: number;
|
|
106
|
+
cursorCol?: number;
|
|
107
|
+
maxSuggestLines?: number;
|
|
108
|
+
framework?: string;
|
|
109
|
+
}): AIHintContext;
|
|
110
|
+
/** Build AIHintContext for HTML / rich-text editors.
|
|
111
|
+
* Modes: seo | accessibility | grammar | cleanup */
|
|
112
|
+
export declare function buildHtmlEditorContext(label: string, html?: string, opts?: {
|
|
113
|
+
mode?: 'seo' | 'accessibility' | 'grammar' | 'cleanup';
|
|
114
|
+
targetKeywords?: string[];
|
|
115
|
+
locale?: string;
|
|
116
|
+
}): AIHintContext;
|
|
117
|
+
/** Build AIHintContext for audio editors.
|
|
118
|
+
* Modes: tag | bpm | mix | transcribe */
|
|
119
|
+
export declare function buildAudioContext(fileName: string, opts?: {
|
|
120
|
+
bpm?: number;
|
|
121
|
+
key?: string;
|
|
122
|
+
duration?: number;
|
|
123
|
+
genre?: string;
|
|
124
|
+
mode?: 'tag' | 'bpm' | 'mix' | 'transcribe';
|
|
125
|
+
}): AIHintContext;
|
|
126
|
+
/** Build AIHintContext for 3D scene editors.
|
|
127
|
+
* Modes: material | optimize | lighting | animation */
|
|
128
|
+
export declare function build3DSceneContext(sceneName: string, opts?: {
|
|
129
|
+
meshCount?: number;
|
|
130
|
+
triangleCount?: number;
|
|
131
|
+
materials?: string[];
|
|
132
|
+
targetDevice?: 'web' | 'mobile' | 'desktop' | 'vr';
|
|
133
|
+
mode?: 'material' | 'optimize' | 'lighting' | 'animation';
|
|
134
|
+
}): AIHintContext;
|
|
135
|
+
/** Build AIHintContext for graphics / pixel-art editors.
|
|
136
|
+
* Modes: filter | palette | upscale | style-transfer */
|
|
137
|
+
export declare function buildGraphicsContext(imageName: string, opts?: {
|
|
138
|
+
width?: number;
|
|
139
|
+
height?: number;
|
|
140
|
+
mode?: 'filter' | 'palette' | 'upscale' | 'style-transfer';
|
|
141
|
+
targetStyle?: string;
|
|
142
|
+
}): AIHintContext;
|
|
143
|
+
/** Build AIHintContext for icon picker — semantic search over an icon set. */
|
|
144
|
+
export declare function buildIconSearchContext(query: string, opts?: {
|
|
145
|
+
availableIcons?: string[];
|
|
146
|
+
limit?: number;
|
|
147
|
+
style?: 'outline' | 'solid' | 'duotone';
|
|
148
|
+
}): AIHintContext;
|
|
149
|
+
/** AI code completion hook for Monaco/CodeMirror editors. */
|
|
150
|
+
export declare function useAICodeHint(language: string, value?: string, opts?: {
|
|
151
|
+
cursorLine?: number;
|
|
152
|
+
cursorCol?: number;
|
|
153
|
+
maxSuggestLines?: number;
|
|
154
|
+
framework?: string;
|
|
155
|
+
} & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
156
|
+
/** AI hint hook for HTML/rich-text editors — SEO, accessibility, grammar, cleanup. */
|
|
157
|
+
export declare function useAIHtmlHint(label: string, html?: string, opts?: {
|
|
158
|
+
mode?: 'seo' | 'accessibility' | 'grammar' | 'cleanup';
|
|
159
|
+
targetKeywords?: string[];
|
|
160
|
+
locale?: string;
|
|
161
|
+
} & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
162
|
+
/** AI hint hook for audio editors — tagging, BPM detection, mix advice, transcription. */
|
|
163
|
+
export declare function useAIAudioHint(fileName: string, opts?: {
|
|
164
|
+
bpm?: number;
|
|
165
|
+
key?: string;
|
|
166
|
+
duration?: number;
|
|
167
|
+
genre?: string;
|
|
168
|
+
mode?: 'tag' | 'bpm' | 'mix' | 'transcribe';
|
|
169
|
+
} & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
170
|
+
/** AI hint hook for 3D scene editors — material suggestions, optimization, lighting, animation. */
|
|
171
|
+
export declare function useAI3DHint(sceneName: string, opts?: {
|
|
172
|
+
meshCount?: number;
|
|
173
|
+
triangleCount?: number;
|
|
174
|
+
materials?: string[];
|
|
175
|
+
targetDevice?: 'web' | 'mobile' | 'desktop' | 'vr';
|
|
176
|
+
mode?: 'material' | 'optimize' | 'lighting' | 'animation';
|
|
177
|
+
} & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
178
|
+
/** AI hint hook for graphics/pixel-art editors — filter params, palette, upscale, style-transfer. */
|
|
179
|
+
export declare function useAIGraphicsHint(imageName: string, opts?: {
|
|
180
|
+
width?: number;
|
|
181
|
+
height?: number;
|
|
182
|
+
mode?: 'filter' | 'palette' | 'upscale' | 'style-transfer';
|
|
183
|
+
targetStyle?: string;
|
|
184
|
+
} & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
185
|
+
/** AI icon search hook — returns semantically relevant icon names for a text query. */
|
|
186
|
+
export declare function useAIIconSearch(query: string, opts?: {
|
|
187
|
+
availableIcons?: string[];
|
|
188
|
+
limit?: number;
|
|
189
|
+
style?: 'outline' | 'solid' | 'duotone';
|
|
190
|
+
} & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
191
|
+
export interface GameEngineAIContext {
|
|
192
|
+
/** Name or ID of the NPC / entity */
|
|
193
|
+
npcName: string;
|
|
194
|
+
/** Current game state relevant to the NPC (position, health, nearby entities, etc.) */
|
|
195
|
+
gameState?: Record<string, unknown>;
|
|
196
|
+
/** Current behaviour tree status (node names + statuses) */
|
|
197
|
+
btStatus?: Array<{
|
|
198
|
+
node: string;
|
|
199
|
+
status: 'success' | 'failure' | 'running';
|
|
200
|
+
}>;
|
|
201
|
+
/** Mode: choose the AI task */
|
|
202
|
+
mode?: 'npc-decision' | 'dialogue' | 'procedural-level' | 'quest-description' | 'item-description';
|
|
203
|
+
/** Genre / setting: fantasy, sci-fi, horror, western, etc. */
|
|
204
|
+
genre?: string;
|
|
205
|
+
/** Max output tokens override */
|
|
206
|
+
maxTokens?: number;
|
|
207
|
+
}
|
|
208
|
+
export declare function buildGameEngineContext(npcName: string, opts?: Omit<GameEngineAIContext, 'npcName'>): AIHintContext;
|
|
209
|
+
/** Game Engine AI hook — NPC decisions, dialogue, procedural content, quest & item descriptions. */
|
|
210
|
+
export declare function useAINpcHint(npcName: string, opts?: Omit<GameEngineAIContext, 'npcName'> & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
211
|
+
export interface DiagramAIContext {
|
|
212
|
+
/** Node data with positions and connections */
|
|
213
|
+
nodes: Array<{
|
|
214
|
+
id: string;
|
|
215
|
+
type?: string;
|
|
216
|
+
label?: string;
|
|
217
|
+
x: number;
|
|
218
|
+
y: number;
|
|
219
|
+
width?: number;
|
|
220
|
+
height?: number;
|
|
221
|
+
}>;
|
|
222
|
+
/** Edge data showing connections */
|
|
223
|
+
edges: Array<{
|
|
224
|
+
id: string;
|
|
225
|
+
source: string;
|
|
226
|
+
target: string;
|
|
227
|
+
type?: string;
|
|
228
|
+
}>;
|
|
229
|
+
/** Diagram type: flowchart, org-chart, bpmn, network, etc. */
|
|
230
|
+
diagramType?: string;
|
|
231
|
+
/** Mode for AI suggestions */
|
|
232
|
+
mode?: 'layout' | 'structure' | 'simplify' | 'group';
|
|
233
|
+
/** Container dimensions */
|
|
234
|
+
containerSize?: {
|
|
235
|
+
width: number;
|
|
236
|
+
height: number;
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/** Build AIHintContext for diagram layout suggestions. */
|
|
240
|
+
export declare function buildDiagramLayoutContext(nodes: DiagramAIContext['nodes'], edges: DiagramAIContext['edges'], opts?: Omit<DiagramAIContext, 'nodes' | 'edges'>): AIHintContext;
|
|
241
|
+
/** AI hook for diagram layout suggestions.
|
|
242
|
+
* Returns suggested node positions and structural improvements. */
|
|
243
|
+
export declare function useAIDiagramLayout(nodes: DiagramAIContext['nodes'], edges: DiagramAIContext['edges'], opts?: Omit<DiagramAIContext, 'nodes' | 'edges'> & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
244
|
+
export interface PresentationAIContext {
|
|
245
|
+
/** User's prompt or description for the presentation */
|
|
246
|
+
prompt: string;
|
|
247
|
+
/** Presentation type: business, educational, pitch, report, etc. */
|
|
248
|
+
presentationType?: string;
|
|
249
|
+
/** Target audience */
|
|
250
|
+
audience?: string;
|
|
251
|
+
/** Estimated duration in minutes */
|
|
252
|
+
duration?: number;
|
|
253
|
+
/** Available data context (charts, tables, etc.) */
|
|
254
|
+
dataContext?: Record<string, unknown>;
|
|
255
|
+
/** Mode for AI generation */
|
|
256
|
+
mode?: 'generate' | 'summarize' | 'expand' | 'improve';
|
|
257
|
+
}
|
|
258
|
+
/** Build AIHintContext for AI presentation generation. */
|
|
259
|
+
export declare function buildPresentationGenerateContext(prompt: string, opts?: Omit<PresentationAIContext, 'prompt'>): AIHintContext;
|
|
260
|
+
/** AI hook for presentation generation.
|
|
261
|
+
* Returns slide outline from text description. */
|
|
262
|
+
export declare function useAIPresentationGenerate(prompt: string, opts?: Omit<PresentationAIContext, 'prompt'> & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
263
|
+
export interface SlideDesignAIContext {
|
|
264
|
+
/** Current slide content */
|
|
265
|
+
slide: {
|
|
266
|
+
title?: string;
|
|
267
|
+
content?: string;
|
|
268
|
+
layout?: string;
|
|
269
|
+
elements?: Array<{
|
|
270
|
+
type: string;
|
|
271
|
+
x: number;
|
|
272
|
+
y: number;
|
|
273
|
+
width: number;
|
|
274
|
+
height: number;
|
|
275
|
+
}>;
|
|
276
|
+
};
|
|
277
|
+
/** Theme/brand colors */
|
|
278
|
+
brandColors?: string[];
|
|
279
|
+
/** Mode for design suggestions */
|
|
280
|
+
mode?: 'alignment' | 'contrast' | 'spacing' | 'typography' | 'all';
|
|
281
|
+
}
|
|
282
|
+
/** Build AIHintContext for slide design suggestions. */
|
|
283
|
+
export declare function buildSlideDesignContext(slide: SlideDesignAIContext['slide'], opts?: Omit<SlideDesignAIContext, 'slide'>): AIHintContext;
|
|
284
|
+
/** AI hook for slide design suggestions.
|
|
285
|
+
* Returns alignment, contrast, spacing, and typography improvements. */
|
|
286
|
+
export declare function useAISlideDesign(slide: SlideDesignAIContext['slide'], opts?: Omit<SlideDesignAIContext, 'slide'> & UseNiceAIHintOptions): import('./types').AIHintResult;
|
|
287
|
+
//# sourceMappingURL=integrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAI3E,qDAAqD;AACrD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACpE,aAAa,CAaf;AAED,qDAAqD;AACrD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAClE,aAAa,CAcf;AAED,4DAA4D;AAC5D,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,OAAO,EACf,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,OAA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,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACzF,CAAC;IACF,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,kCAAkC;IAClC,IAAI,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,KAAK,CAAC;CACpE;AAED,wDAAwD;AACxD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,oBAAoB,CAAC,OAAO,CAAC,EACpC,IAAI,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,GACzC,aAAa,CAkCf;AAED;yEACyE;AACzE,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,oBAAoB,CAAC,OAAO,CAAC,EACpC,IAAI,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,GAAG,oBAAoB,kCAQlE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RateLimitConfig, RateLimitStatus } from './types';
|
|
2
|
+
|
|
3
|
+
export declare class RateLimiter {
|
|
4
|
+
private timestamps;
|
|
5
|
+
private tokenCount;
|
|
6
|
+
private readonly config;
|
|
7
|
+
private onWarning?;
|
|
8
|
+
private warningEmitted;
|
|
9
|
+
constructor(config?: RateLimitConfig, onWarning?: () => void);
|
|
10
|
+
/** Check whether a new request is allowed. */
|
|
11
|
+
canRequest(): boolean;
|
|
12
|
+
/** Record a new request. Returns false if rate-limited. */
|
|
13
|
+
recordRequest(): boolean;
|
|
14
|
+
/** Record token usage from a completed/streaming response. */
|
|
15
|
+
recordTokens(count: number): void;
|
|
16
|
+
/** Get current rate limit status. */
|
|
17
|
+
getStatus(): RateLimitStatus;
|
|
18
|
+
/** Reset all counters. */
|
|
19
|
+
reset(): void;
|
|
20
|
+
private pruneOldTimestamps;
|
|
21
|
+
private checkWarning;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=rateLimiter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rateLimiter.d.ts","sourceRoot":"","sources":["../src/rateLimiter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAMhE,qBAAa,WAAW;IACtB,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IACnD,OAAO,CAAC,SAAS,CAAC,CAAa;IAC/B,OAAO,CAAC,cAAc,CAAS;gBAEnB,MAAM,GAAE,eAAoB,EAAE,SAAS,CAAC,EAAE,MAAM,IAAI;IAShE,8CAA8C;IAC9C,UAAU,IAAI,OAAO;IAOrB,2DAA2D;IAC3D,aAAa,IAAI,OAAO;IAMxB,8DAA8D;IAC9D,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKjC,qCAAqC;IACrC,SAAS,IAAI,eAAe;IAqB5B,0BAA0B;IAC1B,KAAK,IAAI,IAAI;IAMb,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,YAAY;CAQrB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StreamChunk } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parse an SSE (Server-Sent Events) stream from a fetch Response.
|
|
5
|
+
* Yields text tokens as they arrive.
|
|
6
|
+
*
|
|
7
|
+
* Supports:
|
|
8
|
+
* - OpenAI streaming format (`data: {"choices":[{"delta":{"content":"..."}}]}`)
|
|
9
|
+
* - Plain text streaming (each line is a token)
|
|
10
|
+
* - NDJSON streaming (each line is a JSON object with a `text` or `content` field)
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseSSEStream(response: Response, signal?: AbortSignal): AsyncGenerator<{
|
|
13
|
+
token: string;
|
|
14
|
+
done: boolean;
|
|
15
|
+
usage?: StreamChunk['usage'];
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Parse a non-streaming JSON response (single completion).
|
|
19
|
+
* Returns the full text content.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseJSONResponse(response: Response): Promise<{
|
|
22
|
+
text: string;
|
|
23
|
+
usage?: StreamChunk['usage'];
|
|
24
|
+
}>;
|
|
25
|
+
//# sourceMappingURL=streaming.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../src/streaming.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAO3C;;;;;;;;GAQG;AACH,wBAAuB,cAAc,CACnC,QAAQ,EAAE,QAAQ,EAClB,MAAM,CAAC,EAAE,WAAW,GACnB,cAAc,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC,CA8EhF;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC,CA4BzD"}
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--ntd-ai-bg: #1e1e2e;--ntd-ai-fg: #cdd6f4;--ntd-ai-border: #45475a;--ntd-ai-trigger-color: #a78bfa;--ntd-ai-error: #f38ba8}.ntd-ai-trigger:hover{opacity:1!important;transform:scale(1.15)}.ntd-ai-trigger:focus-visible{outline:2px solid var(--ntd-ai-trigger-color);outline-offset:2px}.ntd-ai-popover{animation:ntd-ai-fade-in .15s ease-out}.ntd-ai-action:hover{background-color:var(--ntd-ai-border)!important}@keyframes ntd-ai-spin{to{transform:rotate(360deg)}}@keyframes ntd-ai-blink{0%,to{opacity:1}50%{opacity:0}}@keyframes ntd-ai-fade-in{0%{opacity:0;transform:translate(-50%) translateY(4px)}to{opacity:1;transform:translate(-50%) translateY(0)}}@media (prefers-color-scheme: light){:root{--ntd-ai-bg: #ffffff;--ntd-ai-fg: #1e1e2e;--ntd-ai-border: #dce0e8;--ntd-ai-trigger-color: #7c3aed;--ntd-ai-error: #dc2626}}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/** Configuration for the AI endpoint connection. */
|
|
2
|
+
export interface NiceAIConfig {
|
|
3
|
+
/** Full URL of the chat completions endpoint (e.g. https://api.openai.com/v1/chat/completions). */
|
|
4
|
+
endpoint: string;
|
|
5
|
+
/** API key / bearer token. Sent as Authorization header. */
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
/** Model identifier (e.g. "gpt-4o", "gpt-3.5-turbo", "llama3"). */
|
|
8
|
+
model?: string;
|
|
9
|
+
/** System prompt prepended to every AI request. */
|
|
10
|
+
systemPrompt?: string;
|
|
11
|
+
/** Sampling temperature (0-2). @default 0.7 */
|
|
12
|
+
temperature?: number;
|
|
13
|
+
/** Maximum tokens in the response. @default 256 */
|
|
14
|
+
maxTokens?: number;
|
|
15
|
+
/** Additional headers sent with every request. */
|
|
16
|
+
headers?: Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Privacy mode — when enabled, field values are NOT sent to the AI endpoint.
|
|
19
|
+
* Only metadata (label, type, validation rules) is included.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
privacyMode?: boolean;
|
|
23
|
+
/** Enable streaming responses (SSE). @default true */
|
|
24
|
+
stream?: boolean;
|
|
25
|
+
/** Rate limiting settings. */
|
|
26
|
+
rateLimit?: RateLimitConfig | {
|
|
27
|
+
maxRequestsPerMinute?: number;
|
|
28
|
+
maxTokensPerMinute?: number;
|
|
29
|
+
cooldownMs?: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** Rate limiting configuration. */
|
|
33
|
+
export interface RateLimitConfig {
|
|
34
|
+
/** Maximum requests per minute. @default 30 */
|
|
35
|
+
maxRequestsPerMinute?: number;
|
|
36
|
+
/** Maximum tokens per session (cost guard). @default 10000 */
|
|
37
|
+
maxTokensPerSession?: number;
|
|
38
|
+
/** Percentage threshold to show a warning. @default 80 */
|
|
39
|
+
warnThresholdPercent?: number;
|
|
40
|
+
}
|
|
41
|
+
/** Context passed to the AI for generating a hint. */
|
|
42
|
+
export interface AIHintContext {
|
|
43
|
+
/** Human-readable label of the field. */
|
|
44
|
+
fieldLabel?: string;
|
|
45
|
+
/** Field type (e.g. "text", "number", "date", "select"). */
|
|
46
|
+
fieldType?: string;
|
|
47
|
+
/** Current field value (omitted in privacy mode). */
|
|
48
|
+
fieldValue?: unknown;
|
|
49
|
+
/** Validation rules applied to the field. */
|
|
50
|
+
validationRules?: Record<string, unknown>;
|
|
51
|
+
/** Key-value pairs of other form fields as context. */
|
|
52
|
+
formContext?: Record<string, unknown>;
|
|
53
|
+
/** Schema / data model description. */
|
|
54
|
+
schema?: Record<string, unknown>;
|
|
55
|
+
/** Custom user-provided prompt fragment appended to the AI request. */
|
|
56
|
+
customPrompt?: string;
|
|
57
|
+
/** Short textual hint describing field expectations. */
|
|
58
|
+
hint?: string;
|
|
59
|
+
/** Business context description for the AI. */
|
|
60
|
+
businessContext?: string;
|
|
61
|
+
}
|
|
62
|
+
/** Result returned by the useNiceAIHint hook. */
|
|
63
|
+
export interface AIHintResult {
|
|
64
|
+
/** The AI-generated hint text (incrementally updated during streaming). */
|
|
65
|
+
text: string;
|
|
66
|
+
/** Whether a request is in-flight. */
|
|
67
|
+
loading: boolean;
|
|
68
|
+
/** Error message if the request failed. */
|
|
69
|
+
error: string | null;
|
|
70
|
+
/** Whether tokens are currently streaming in. */
|
|
71
|
+
streaming: boolean;
|
|
72
|
+
/** Abort the current request. */
|
|
73
|
+
abort: () => void;
|
|
74
|
+
/** Trigger a new request (discards cache). */
|
|
75
|
+
refresh: () => void;
|
|
76
|
+
/** Structured hint result with content and suggestions. */
|
|
77
|
+
hint?: {
|
|
78
|
+
content?: string;
|
|
79
|
+
suggestions?: string[];
|
|
80
|
+
} | null;
|
|
81
|
+
/** Fetch a hint for the given context. */
|
|
82
|
+
fetchHint: (context?: AIHintContext) => Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
/** Rate limiter status exposed via context. */
|
|
85
|
+
export interface RateLimitStatus {
|
|
86
|
+
requestsThisMinute: number;
|
|
87
|
+
tokensThisSession: number;
|
|
88
|
+
isLimited: boolean;
|
|
89
|
+
isWarning: boolean;
|
|
90
|
+
}
|
|
91
|
+
/** Bubble/popover position relative to the trigger icon. */
|
|
92
|
+
export type AIHintPosition = 'top' | 'bottom' | 'left' | 'right' | 'auto';
|
|
93
|
+
/** Props for the NiceAIHintBubble component. */
|
|
94
|
+
export interface NiceAIHintBubbleProps {
|
|
95
|
+
/** Context describing the field for the AI. */
|
|
96
|
+
context: AIHintContext;
|
|
97
|
+
/** Popover position. @default 'auto' */
|
|
98
|
+
position?: AIHintPosition;
|
|
99
|
+
/** Debounce delay in ms before triggering the AI request. @default 500 */
|
|
100
|
+
debounceMs?: number;
|
|
101
|
+
/** Show hint on hover instead of click. @default false */
|
|
102
|
+
showOnHover?: boolean;
|
|
103
|
+
/** Custom trigger icon (defaults to ✨ sparkle). */
|
|
104
|
+
triggerIcon?: React.ReactNode;
|
|
105
|
+
/** Additional class name on the trigger button. */
|
|
106
|
+
className?: string;
|
|
107
|
+
/** Additional styles on the trigger button. */
|
|
108
|
+
style?: React.CSSProperties;
|
|
109
|
+
/** When to show the hint bubble. @default 'click' */
|
|
110
|
+
triggerOn?: 'hover' | 'focus' | 'click';
|
|
111
|
+
}
|
|
112
|
+
/** Internal chat message format (OpenAI-compatible). */
|
|
113
|
+
export interface ChatMessage {
|
|
114
|
+
role: 'system' | 'user' | 'assistant';
|
|
115
|
+
content: string;
|
|
116
|
+
}
|
|
117
|
+
/** OpenAI-compatible streaming chunk. */
|
|
118
|
+
export interface StreamChunk {
|
|
119
|
+
id?: string;
|
|
120
|
+
choices?: Array<{
|
|
121
|
+
delta?: {
|
|
122
|
+
content?: string;
|
|
123
|
+
role?: string;
|
|
124
|
+
};
|
|
125
|
+
finish_reason?: string | null;
|
|
126
|
+
}>;
|
|
127
|
+
usage?: {
|
|
128
|
+
prompt_tokens?: number;
|
|
129
|
+
completion_tokens?: number;
|
|
130
|
+
total_tokens?: number;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,oDAAoD;AACpD,MAAM,WAAW,YAAY;IAC3B,mGAAmG;IACnG,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sDAAsD;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,eAAe,GAAG;QAAE,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACnH;AAED,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B,+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,CAAC;QAC5C,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B,CAAC,CAAC;IACH,KAAK,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACvF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AIHintContext, AIHintResult } from './types';
|
|
2
|
+
|
|
3
|
+
export interface UseNiceAIHintOptions {
|
|
4
|
+
/** Debounce delay in ms. @default 500 */
|
|
5
|
+
debounceMs?: number;
|
|
6
|
+
/** Disable the hook (useful for conditional enabling). @default false */
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function useNiceAIHint(context?: AIHintContext, options?: UseNiceAIHintOptions): AIHintResult;
|
|
10
|
+
//# sourceMappingURL=useNiceAIHint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNiceAIHint.d.ts","sourceRoot":"","sources":["../src/useNiceAIHint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAA6B,MAAM,SAAS,CAAC;AA8EtF,MAAM,WAAW,oBAAoB;IACnC,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,aAAa,CAC3B,OAAO,GAAE,aAAkB,EAC3B,OAAO,GAAE,oBAAyB,GACjC,YAAY,CA+Kd"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { AIHintContext, AIHintPosition } from './types';
|
|
3
|
+
|
|
4
|
+
export interface WithAIHintProps {
|
|
5
|
+
/** Enable AI hint bubble. @default true */
|
|
6
|
+
aiEnabled?: boolean;
|
|
7
|
+
/** Position of the AI hint bubble. @default 'right' */
|
|
8
|
+
aiPosition?: AIHintPosition;
|
|
9
|
+
/** Custom AI prompt for this field. */
|
|
10
|
+
aiPrompt?: string;
|
|
11
|
+
/** Debounce delay for AI requests in ms. @default 500 */
|
|
12
|
+
aiDebounceMs?: number;
|
|
13
|
+
/** Show AI hint on hover instead of click. @default false */
|
|
14
|
+
aiShowOnHover?: boolean;
|
|
15
|
+
/** Custom trigger icon for the AI hint. */
|
|
16
|
+
aiTriggerIcon?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Higher-order component that wraps any control with an AI hint bubble.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const AITextInput = withAIHint(NiceTextInput, (props) => ({
|
|
23
|
+
* fieldLabel: props.label,
|
|
24
|
+
* fieldType: 'text',
|
|
25
|
+
* fieldValue: props.value,
|
|
26
|
+
* }));
|
|
27
|
+
*/
|
|
28
|
+
export declare function withAIHint<P extends object>(WrappedComponent: ComponentType<P>, buildContext: (props: P) => AIHintContext, displayName?: string): ComponentType<P & WithAIHintProps>;
|
|
29
|
+
/** Context builder for text-like controls (TextInput, TextArea). */
|
|
30
|
+
export declare function textControlContext(props: {
|
|
31
|
+
label?: string;
|
|
32
|
+
value?: string;
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
maxLength?: number;
|
|
35
|
+
}): AIHintContext;
|
|
36
|
+
/** Context builder for number controls (NumberInput, Slider). */
|
|
37
|
+
export declare function numberControlContext(props: {
|
|
38
|
+
label?: string;
|
|
39
|
+
value?: number;
|
|
40
|
+
min?: number;
|
|
41
|
+
max?: number;
|
|
42
|
+
step?: number;
|
|
43
|
+
}): AIHintContext;
|
|
44
|
+
/** Context builder for select controls (Select, Autocomplete, Lookup). */
|
|
45
|
+
export declare function selectControlContext(props: {
|
|
46
|
+
label?: string;
|
|
47
|
+
value?: unknown;
|
|
48
|
+
options?: Array<{
|
|
49
|
+
label: string;
|
|
50
|
+
value: unknown;
|
|
51
|
+
}>;
|
|
52
|
+
multiple?: boolean;
|
|
53
|
+
}): AIHintContext;
|
|
54
|
+
/** Context builder for date controls (DatePicker, Calendar, DateRangeBox). */
|
|
55
|
+
export declare function dateControlContext(props: {
|
|
56
|
+
label?: string;
|
|
57
|
+
value?: string | Date;
|
|
58
|
+
min?: string;
|
|
59
|
+
max?: string;
|
|
60
|
+
}): AIHintContext;
|
|
61
|
+
/** Context builder for color controls (ColorPicker, ColorPalette, GradientPicker). */
|
|
62
|
+
export declare function colorControlContext(props: {
|
|
63
|
+
label?: string;
|
|
64
|
+
value?: string;
|
|
65
|
+
}): AIHintContext;
|
|
66
|
+
//# sourceMappingURL=wrappers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../src/wrappers.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAY7D,MAAM,WAAW,eAAe;IAC9B,2CAA2C;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uDAAuD;IACvD,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EACzC,gBAAgB,EAAE,aAAa,CAAC,CAAC,CAAC,EAClC,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,aAAa,EACzC,WAAW,CAAC,EAAE,MAAM,GACnB,aAAa,CAAC,CAAC,GAAG,eAAe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+
{
|
|
2
|
+
"name": "@nice2dev/ui-ai",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Nice2Dev AI Hints — LLM-powered contextual suggestions for UI controls (OpenAI, Azure OpenAI, Ollama, custom endpoints)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.mjs",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./style.css": "./dist/style.css"
|
|
16
|
+
},
|
|
17
|
+
"files": ["dist", "LICENSE", "CHANGELOG.md", "README.md"],
|
|
18
|
+
"sideEffects": ["*.css"],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build": "tsc -p tsconfig.build.json && vite build",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest",
|
|
24
|
+
"test:coverage": "vitest run --coverage",
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"prepublishOnly": "npm run build"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"react": ">=17.0.0",
|
|
30
|
+
"react-dom": ">=17.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
34
|
+
"@testing-library/react": "^14.0.0",
|
|
35
|
+
"@types/react": "^18.2.0",
|
|
36
|
+
"@types/react-dom": "^18.2.0",
|
|
37
|
+
"@vitejs/plugin-react": "^4.2.0",
|
|
38
|
+
"react": "^18.2.0",
|
|
39
|
+
"react-dom": "^18.2.0",
|
|
40
|
+
"typescript": "^5.3.0",
|
|
41
|
+
"vite": "^5.0.0",
|
|
42
|
+
"vite-plugin-dts": "^3.7.0",
|
|
43
|
+
"vitest": "^4.1.0"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"react", "ai", "llm", "hints", "suggestions", "openai", "azure-openai",
|
|
47
|
+
"ollama", "streaming", "sse", "smart-forms", "nice2dev"
|
|
48
|
+
],
|
|
49
|
+
"author": "NiceToDev",
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "https://github.com/nicetoDev/NiceToDev.UI",
|
|
54
|
+
"directory": "packages/ui-ai"
|
|
55
|
+
}
|
|
56
|
+
}
|