@nlxai/core 1.2.3 → 1.2.4-alpha.3
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 +155 -1
- package/docs/README.md +1922 -0
- package/lib/index.cjs +119 -82
- package/lib/index.d.ts +83 -2
- package/lib/index.esm.js +119 -82
- package/lib/index.umd.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -224,7 +224,6 @@ export default async function (req: Request): Promise<Response> {
|
|
|
224
224
|
# API reference
|
|
225
225
|
|
|
226
226
|
<!-- include docs/README.md -->
|
|
227
|
-
|
|
228
227
|
## Functions
|
|
229
228
|
|
|
230
229
|
### createConversation()
|
|
@@ -738,6 +737,36 @@ Send a combination of choice, slots, and intent in one request.
|
|
|
738
737
|
|
|
739
738
|
`void`
|
|
740
739
|
|
|
740
|
+
##### submitFeedback()
|
|
741
|
+
|
|
742
|
+
```ts
|
|
743
|
+
submitFeedback: (url, feedback) => Promise<void>;
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
Submit feedback about a response.
|
|
747
|
+
|
|
748
|
+
###### Parameters
|
|
749
|
+
|
|
750
|
+
###### url
|
|
751
|
+
|
|
752
|
+
`string`
|
|
753
|
+
|
|
754
|
+
The URL comming from the Application response `metadata.feedbackURL` field.
|
|
755
|
+
|
|
756
|
+
###### feedback
|
|
757
|
+
|
|
758
|
+
Either a numerical rating or a textual comment.
|
|
759
|
+
|
|
760
|
+
\{
|
|
761
|
+
`rating`: `number`;
|
|
762
|
+
\} | \{
|
|
763
|
+
`comment`: `string`;
|
|
764
|
+
\}
|
|
765
|
+
|
|
766
|
+
###### Returns
|
|
767
|
+
|
|
768
|
+
`Promise`\<`void`\>
|
|
769
|
+
|
|
741
770
|
##### subscribe()
|
|
742
771
|
|
|
743
772
|
```ts
|
|
@@ -1132,6 +1161,24 @@ optional sources: KnowledgeBaseResponseSource[];
|
|
|
1132
1161
|
|
|
1133
1162
|
Knowledge base sources
|
|
1134
1163
|
|
|
1164
|
+
##### feedbackUrl?
|
|
1165
|
+
|
|
1166
|
+
```ts
|
|
1167
|
+
optional feedbackUrl: string;
|
|
1168
|
+
```
|
|
1169
|
+
|
|
1170
|
+
URL to use for submitting feedback about this response. See `feedbackConfig` for what the expected feedback type is.
|
|
1171
|
+
|
|
1172
|
+
You can pass this as the first argument to `submitFeedback`.
|
|
1173
|
+
|
|
1174
|
+
##### feedbackConfig?
|
|
1175
|
+
|
|
1176
|
+
```ts
|
|
1177
|
+
optional feedbackConfig: FeedbackConfiguration;
|
|
1178
|
+
```
|
|
1179
|
+
|
|
1180
|
+
If present, the application would like to collect feedback from the user.
|
|
1181
|
+
|
|
1135
1182
|
---
|
|
1136
1183
|
|
|
1137
1184
|
### KnowledgeBaseResponseSource
|
|
@@ -1391,6 +1438,112 @@ When the failure occurred.
|
|
|
1391
1438
|
|
|
1392
1439
|
---
|
|
1393
1440
|
|
|
1441
|
+
### FeedbackConfiguration
|
|
1442
|
+
|
|
1443
|
+
Configuration for feedback collection. You can use this to render an appropriate feedback widget in your application.
|
|
1444
|
+
|
|
1445
|
+
#### Properties
|
|
1446
|
+
|
|
1447
|
+
##### feedbackId
|
|
1448
|
+
|
|
1449
|
+
```ts
|
|
1450
|
+
feedbackId: string;
|
|
1451
|
+
```
|
|
1452
|
+
|
|
1453
|
+
Unique identifier for the feedback collection.
|
|
1454
|
+
|
|
1455
|
+
##### feedbackName
|
|
1456
|
+
|
|
1457
|
+
```ts
|
|
1458
|
+
feedbackName: string;
|
|
1459
|
+
```
|
|
1460
|
+
|
|
1461
|
+
Human readable name of this feedback collection.
|
|
1462
|
+
|
|
1463
|
+
##### feedbackType
|
|
1464
|
+
|
|
1465
|
+
```ts
|
|
1466
|
+
feedbackType: object;
|
|
1467
|
+
```
|
|
1468
|
+
|
|
1469
|
+
Type of feedback being collected.
|
|
1470
|
+
At the moment only binary feedback is supported, but we plan to introduce more types in the future.
|
|
1471
|
+
Hence your code should make sure to check the `type` attribute to make sure the expected feedback type is handled.
|
|
1472
|
+
|
|
1473
|
+
###### type
|
|
1474
|
+
|
|
1475
|
+
```ts
|
|
1476
|
+
type: "binary";
|
|
1477
|
+
```
|
|
1478
|
+
|
|
1479
|
+
A binary feedback type is a thumbs up/down sort of choice.
|
|
1480
|
+
|
|
1481
|
+
###### config
|
|
1482
|
+
|
|
1483
|
+
```ts
|
|
1484
|
+
config: object;
|
|
1485
|
+
```
|
|
1486
|
+
|
|
1487
|
+
Configuration specific to binary feedback.
|
|
1488
|
+
|
|
1489
|
+
###### config.positiveValue
|
|
1490
|
+
|
|
1491
|
+
```ts
|
|
1492
|
+
positiveValue: number;
|
|
1493
|
+
```
|
|
1494
|
+
|
|
1495
|
+
Value to send for positive feedback. Default `1`.
|
|
1496
|
+
|
|
1497
|
+
###### config.negativeValue
|
|
1498
|
+
|
|
1499
|
+
```ts
|
|
1500
|
+
negativeValue: number;
|
|
1501
|
+
```
|
|
1502
|
+
|
|
1503
|
+
Value to send for negative feedback. Default `-1`.
|
|
1504
|
+
|
|
1505
|
+
##### commentsEnabled
|
|
1506
|
+
|
|
1507
|
+
```ts
|
|
1508
|
+
commentsEnabled: boolean;
|
|
1509
|
+
```
|
|
1510
|
+
|
|
1511
|
+
Whether comments are enabled for this feedback collection.
|
|
1512
|
+
|
|
1513
|
+
##### question?
|
|
1514
|
+
|
|
1515
|
+
```ts
|
|
1516
|
+
optional question: string;
|
|
1517
|
+
```
|
|
1518
|
+
|
|
1519
|
+
Optional question to show to the user when collecting feedback.
|
|
1520
|
+
|
|
1521
|
+
##### labels
|
|
1522
|
+
|
|
1523
|
+
```ts
|
|
1524
|
+
labels: object;
|
|
1525
|
+
```
|
|
1526
|
+
|
|
1527
|
+
Labels for individual feedback UI elements as customised by the builder.
|
|
1528
|
+
|
|
1529
|
+
###### positive?
|
|
1530
|
+
|
|
1531
|
+
```ts
|
|
1532
|
+
optional positive: string;
|
|
1533
|
+
```
|
|
1534
|
+
|
|
1535
|
+
Label for positive feedback
|
|
1536
|
+
|
|
1537
|
+
###### negative?
|
|
1538
|
+
|
|
1539
|
+
```ts
|
|
1540
|
+
optional negative: string;
|
|
1541
|
+
```
|
|
1542
|
+
|
|
1543
|
+
Label for negative feedback
|
|
1544
|
+
|
|
1545
|
+
---
|
|
1546
|
+
|
|
1394
1547
|
### StructuredRequest
|
|
1395
1548
|
|
|
1396
1549
|
The body of `sendStructured`
|
|
@@ -1953,3 +2106,4 @@ The callback function for listening to all responses.
|
|
|
1953
2106
|
#### Returns
|
|
1954
2107
|
|
|
1955
2108
|
`void`
|
|
2109
|
+
|