guideai-app 0.3.4 → 0.4.1
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/GuideAI.js +1 -1
- package/GuideAI.js.map +1 -1
- package/README.md +129 -0
- package/dist/GuideAI.d.ts +1 -2
- package/dist/GuideAI.js +1 -1
- package/dist/GuideAI.js.map +1 -1
- package/dist/components/Onboarding.d.ts +2 -2
- package/dist/components/TranscriptBox.d.ts +6 -3
- package/dist/components/WelcomeBubble.d.ts +2 -2
- package/dist/metric/event-listner.d.ts +12 -3
- package/dist/metric/metadata-tracker.d.ts +7 -0
- package/dist/styles/GuideAI.styles.d.ts +1 -1
- package/dist/types/GuideAI.types.d.ts +9 -5
- package/dist/utils/api.d.ts +13 -2
- package/dist/utils/constants.d.ts +2 -1
- package/dist/utils/highlightAndClick.d.ts +3 -0
- package/dist/utils/hoverAndClick.d.ts +4 -0
- package/package.json +2 -1
- package/structure.md +1 -1
- package/webpack.config.js +4 -15
- package/workflow-trigger-usage.md +398 -0
- package/dist/utils/highlight.d.ts +0 -2
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ yarn add guideai-app
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
+
### Basic Usage
|
|
16
|
+
|
|
15
17
|
```jsx
|
|
16
18
|
import GuideAI from 'guideai-app';
|
|
17
19
|
|
|
@@ -28,11 +30,31 @@ function App() {
|
|
|
28
30
|
}
|
|
29
31
|
```
|
|
30
32
|
|
|
33
|
+
### With Workflow Triggers
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
import GuideAI from 'guideai-app';
|
|
37
|
+
|
|
38
|
+
function App() {
|
|
39
|
+
return (
|
|
40
|
+
<div>
|
|
41
|
+
<GuideAI
|
|
42
|
+
organizationKey="your-organization-key"
|
|
43
|
+
workflowKey="customer-support"
|
|
44
|
+
position={{ bottom: '2rem', right: '2rem' }}
|
|
45
|
+
onError={(error) => console.error(error)}
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
31
52
|
## Props
|
|
32
53
|
|
|
33
54
|
| Prop | Type | Required | Description |
|
|
34
55
|
|------|------|----------|-------------|
|
|
35
56
|
| `organizationKey` | `string` | Yes | Your organization key for workflows |
|
|
57
|
+
| `workflowKey` | `string` | No | Workflow key for trigger-based workflows |
|
|
36
58
|
| `position` | `object` | No | Positioning configuration for the component |
|
|
37
59
|
| `onError` | `function` | No | Error handler callback |
|
|
38
60
|
| `transcript` | `object` | No | Transcript feature configuration |
|
|
@@ -192,6 +214,63 @@ The transcript uses modern CSS features including:
|
|
|
192
214
|
- Responsive design that adapts to different screen sizes
|
|
193
215
|
- Custom scrollbar styling for a polished look
|
|
194
216
|
|
|
217
|
+
## Element Interaction Features
|
|
218
|
+
|
|
219
|
+
GuideAI includes powerful element interaction capabilities that allow the AI to guide users by highlighting, hovering over, and clicking elements on the page.
|
|
220
|
+
|
|
221
|
+
### Features
|
|
222
|
+
|
|
223
|
+
- **Element Highlighting**: AI can highlight and click on specific page elements
|
|
224
|
+
- **Hover Interactions**: AI can hover over elements with visual feedback
|
|
225
|
+
- **Position Tracking**: Cursor follows elements that move or expand during interactions
|
|
226
|
+
- **Multiple Selector Support**: Supports CSS selectors, XPath, and text-based selectors
|
|
227
|
+
- **Extended Visual Feedback**: 3-second highlighting with enhanced animations
|
|
228
|
+
|
|
229
|
+
### Supported Selector Types
|
|
230
|
+
|
|
231
|
+
| Selector Type | Format | Example |
|
|
232
|
+
|---------------|--------|---------|
|
|
233
|
+
| **ID** | `#elementId` | `#sidebarMenu-button-goals` |
|
|
234
|
+
| **Class** | `.className` | `.submit-button` |
|
|
235
|
+
| **Attribute** | `[attribute="value"]` | `[data-testid="submit"]` |
|
|
236
|
+
| **Complex CSS** | Any valid CSS | `button.primary[aria-label="Save"]` |
|
|
237
|
+
| **Text-based** | `text:cssSelector:textContent` | `text:.MuiListItemText-root:Goal Sets` |
|
|
238
|
+
| **XPath** | `//xpath` | `//button[contains(text(), 'Submit')]` |
|
|
239
|
+
|
|
240
|
+
### Available Tools
|
|
241
|
+
|
|
242
|
+
#### `highlight` Tool
|
|
243
|
+
- **Purpose**: Moves cursor to elements and clicks them
|
|
244
|
+
- **Use Case**: Guiding users through workflows by clicking interactive elements
|
|
245
|
+
- **Visual Effect**: Blue cursor with click animations and visual feedback
|
|
246
|
+
|
|
247
|
+
#### `hoverThenHighlight` Tool
|
|
248
|
+
- **Purpose**: Moves cursor to elements and hovers over them
|
|
249
|
+
- **Use Case**: Demonstrating or highlighting elements without triggering clicks
|
|
250
|
+
- **Visual Effect**: Orange hover effects with position tracking for dynamic elements
|
|
251
|
+
|
|
252
|
+
### How It Works
|
|
253
|
+
|
|
254
|
+
1. **AI Detection**: The AI analyzes user requests and determines which elements to interact with
|
|
255
|
+
2. **Element Finding**: Uses advanced selector logic to locate elements on the page
|
|
256
|
+
3. **Visual Animation**: Animated cursor moves from viewport center to target elements
|
|
257
|
+
4. **Interaction**: Performs click or hover action with appropriate visual feedback
|
|
258
|
+
5. **Position Tracking**: For hover actions, tracks element position changes for 3 seconds
|
|
259
|
+
|
|
260
|
+
### Example Usage
|
|
261
|
+
|
|
262
|
+
The AI can respond to user requests like:
|
|
263
|
+
- "Click the save button" → Uses `highlight` tool to click elements
|
|
264
|
+
- "Show me the navigation menu" → Uses `hoverThenHighlight` tool to highlight elements
|
|
265
|
+
- "Test hover on the goals section" → Triggers predefined test sequence
|
|
266
|
+
|
|
267
|
+
### Technical Implementation
|
|
268
|
+
|
|
269
|
+
- **Files**: `selectElementAndClick.ts` (clicking) and `hoverAndHighlight.ts` (hovering)
|
|
270
|
+
- **State Management**: Separate state tracking for click and hover operations
|
|
271
|
+
- **Error Handling**: Graceful fallback when elements are not found
|
|
272
|
+
- **Performance**: Optimized with 50ms position tracking intervals
|
|
273
|
+
|
|
195
274
|
## Migration from Voice-Only Versions
|
|
196
275
|
|
|
197
276
|
If you're upgrading from a voice-only version:
|
|
@@ -200,3 +279,53 @@ If you're upgrading from a voice-only version:
|
|
|
200
279
|
- **Text Input Enabled**: Text input is now available by default
|
|
201
280
|
- **Disable if Needed**: Set `input={{ enableTextInput: false }}` to disable text input
|
|
202
281
|
- **Voice Still Default**: Voice mode remains the default interaction method
|
|
282
|
+
|
|
283
|
+
## Workflow Trigger Feature
|
|
284
|
+
|
|
285
|
+
GuideAI now supports workflow triggers based on trigger words detected in user messages. This feature allows you to create dynamic workflows that are activated when specific keywords or phrases are mentioned by users.
|
|
286
|
+
|
|
287
|
+
### Features
|
|
288
|
+
|
|
289
|
+
- **Trigger Word Detection**: Automatically detect trigger words in user messages
|
|
290
|
+
- **Workflow Integration**: Seamlessly integrate with your backend workflow system
|
|
291
|
+
- **Dynamic Prompts**: Workflow-specific prompts from the initialize-session API
|
|
292
|
+
- **Tool-based Triggers**: AI can call workflow triggers through function calls
|
|
293
|
+
- **Configurable**: Support for multiple workflow keys and trigger patterns
|
|
294
|
+
|
|
295
|
+
### How It Works
|
|
296
|
+
|
|
297
|
+
1. **Session Initialization**: When a conversation starts, the system calls `/initialize-session` with the `workflowKey` and receives a workflow-specific prompt
|
|
298
|
+
2. **Trigger Word Detection**: The AI automatically analyzes user messages for trigger words and calls the `trigger_workflow` function when triggers are found
|
|
299
|
+
3. **Workflow Execution**: Your backend receives the trigger request and executes workflow-specific actions
|
|
300
|
+
|
|
301
|
+
### Example Workflows
|
|
302
|
+
|
|
303
|
+
**Customer Support**: Trigger words like "help", "support", "issue", "problem"
|
|
304
|
+
**Sales Inquiry**: Trigger words like "pricing", "cost", "buy", "purchase"
|
|
305
|
+
**Technical Support**: Trigger words like "error", "bug", "crash", "not working"
|
|
306
|
+
|
|
307
|
+
### Backend Requirements
|
|
308
|
+
|
|
309
|
+
You only need to implement the `initialize-session` endpoint, which returns workflows along with the prompt:
|
|
310
|
+
|
|
311
|
+
```json
|
|
312
|
+
{
|
|
313
|
+
"id": "conversation-uuid",
|
|
314
|
+
"ephemeralToken": "openai-realtime-token",
|
|
315
|
+
"prompt": "organization-prompt",
|
|
316
|
+
"workflows": [
|
|
317
|
+
{
|
|
318
|
+
"id": "workflow-uuid",
|
|
319
|
+
"name": "Customer Support Workflow",
|
|
320
|
+
"triggers": ["help", "support", "customer service"],
|
|
321
|
+
"organizationKey": "org-key-123",
|
|
322
|
+
"prompt": "You are a helpful customer support agent...",
|
|
323
|
+
"archived": false,
|
|
324
|
+
"createdAt": "2024-01-01T00:00:00.000Z",
|
|
325
|
+
"updatedAt": "2024-01-01T00:00:00.000Z"
|
|
326
|
+
}
|
|
327
|
+
]
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
For detailed implementation guide, see [workflow-trigger-usage.md](./workflow-trigger-usage.md).
|
package/dist/GuideAI.d.ts
CHANGED