@ddrinnova/agentsgt-widget 0.0.8 → 0.0.9
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 +56 -5
- package/dist/widget.es.js +3411 -3368
- package/dist/widget.umd.js +55 -55
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,11 +57,62 @@ Add a container to your HTML:
|
|
|
57
57
|
|
|
58
58
|
## Configuration Options
|
|
59
59
|
|
|
60
|
-
| Option | Type | Description
|
|
61
|
-
| ---------------- | ------ |
|
|
62
|
-
| `title` | string | The title displayed in the widget header
|
|
63
|
-
| `initialMessage` | string | The first message displayed in the chat
|
|
64
|
-
| `runtimeUrl` | string | URL to your backend API endpoint (required)
|
|
60
|
+
| Option | Type | Description |
|
|
61
|
+
| ---------------- | ------ | --------------------------------------------------------------|
|
|
62
|
+
| `title` | string | The title displayed in the widget header |
|
|
63
|
+
| `initialMessage` | string | The first message displayed in the chat |
|
|
64
|
+
| `runtimeUrl` | string | URL to your backend API endpoint (required) |
|
|
65
|
+
| `properties` | json | Additional configuration properties for the widget |
|
|
66
|
+
| `actions` | array | Available actions or functions that the assistant can perform |
|
|
67
|
+
|
|
68
|
+
### Examples
|
|
69
|
+
|
|
70
|
+
#### Properties Example
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
const properties = {
|
|
74
|
+
user: {
|
|
75
|
+
value: "John",
|
|
76
|
+
description: "name of the user"
|
|
77
|
+
},
|
|
78
|
+
pokemones: {
|
|
79
|
+
value: pokemonList, // Imagine an array of JSON objects, each representing a pokemon with properties like "name" and "url"
|
|
80
|
+
description: "available pokemon resources that the assistant can reference"
|
|
81
|
+
},
|
|
82
|
+
instructions: {
|
|
83
|
+
value: "You are an assistant that knows about pokemon and the user's name. Always refer to the user by their name.",
|
|
84
|
+
description: "instructions for the assistant behavior"
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
#### Actions Example
|
|
90
|
+
|
|
91
|
+
```javascript
|
|
92
|
+
const actions = [
|
|
93
|
+
{
|
|
94
|
+
name: "openUrl",
|
|
95
|
+
description: "Open a URL in a new tab",
|
|
96
|
+
parameters: [
|
|
97
|
+
{ name: "url", type: "string", description: "The URL to open" }
|
|
98
|
+
],
|
|
99
|
+
handler: ({ url }) => {
|
|
100
|
+
window.open(url, "_blank");
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "searchPokemon",
|
|
105
|
+
description: "Search for a specific pokemon",
|
|
106
|
+
parameters: [
|
|
107
|
+
{ name: "name", type: "string", description: "Pokemon name to search" }
|
|
108
|
+
],
|
|
109
|
+
handler: ({ name }) => {
|
|
110
|
+
// Custom logic to search pokemon
|
|
111
|
+
console.log(`Searching for pokemon: ${name}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
```
|
|
65
116
|
|
|
66
117
|
## License
|
|
67
118
|
|