@gendive/chatllm 0.17.17 → 0.17.18
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/dist/react/index.js
CHANGED
|
@@ -1447,12 +1447,12 @@ var parsePollFromContent = (content) => {
|
|
|
1447
1447
|
let optionMatch;
|
|
1448
1448
|
while ((optionMatch = optionTagRegex.exec(innerContent)) !== null) {
|
|
1449
1449
|
const optionAttrs = optionMatch[1];
|
|
1450
|
-
const optionLabel =
|
|
1450
|
+
const optionLabel = optionMatch[2].trim();
|
|
1451
1451
|
const descMatch = optionAttrs.match(/description=["']([^"']+)["']/i);
|
|
1452
1452
|
options.push({
|
|
1453
1453
|
id: generateId2(),
|
|
1454
1454
|
label: optionLabel,
|
|
1455
|
-
description: descMatch?.[1]
|
|
1455
|
+
description: descMatch?.[1] || void 0
|
|
1456
1456
|
});
|
|
1457
1457
|
}
|
|
1458
1458
|
if (options.length === 0) {
|
|
@@ -1462,8 +1462,8 @@ var parsePollFromContent = (content) => {
|
|
|
1462
1462
|
const fullText = listMatch[1].trim();
|
|
1463
1463
|
const colonIndex = fullText.indexOf(":");
|
|
1464
1464
|
if (colonIndex > 0) {
|
|
1465
|
-
const label =
|
|
1466
|
-
const description =
|
|
1465
|
+
const label = fullText.substring(0, colonIndex).trim();
|
|
1466
|
+
const description = fullText.substring(colonIndex + 1).trim();
|
|
1467
1467
|
options.push({
|
|
1468
1468
|
id: generateId2(),
|
|
1469
1469
|
label,
|
|
@@ -1472,7 +1472,7 @@ var parsePollFromContent = (content) => {
|
|
|
1472
1472
|
} else {
|
|
1473
1473
|
options.push({
|
|
1474
1474
|
id: generateId2(),
|
|
1475
|
-
label:
|
|
1475
|
+
label: fullText
|
|
1476
1476
|
});
|
|
1477
1477
|
}
|
|
1478
1478
|
}
|
|
@@ -1483,14 +1483,14 @@ var parsePollFromContent = (content) => {
|
|
|
1483
1483
|
while ((numMatch = numberedRegex.exec(innerContent)) !== null) {
|
|
1484
1484
|
options.push({
|
|
1485
1485
|
id: generateId2(),
|
|
1486
|
-
label:
|
|
1486
|
+
label: numMatch[1].trim()
|
|
1487
1487
|
});
|
|
1488
1488
|
}
|
|
1489
1489
|
}
|
|
1490
1490
|
if (questionText && options.length >= 2) {
|
|
1491
1491
|
const pollQuestion = {
|
|
1492
1492
|
id: generateId2(),
|
|
1493
|
-
question:
|
|
1493
|
+
question: questionText,
|
|
1494
1494
|
options,
|
|
1495
1495
|
multiSelect,
|
|
1496
1496
|
allowOther,
|
|
@@ -1520,7 +1520,7 @@ var parsePollFromContent = (content) => {
|
|
|
1520
1520
|
};
|
|
1521
1521
|
};
|
|
1522
1522
|
var formatPollResponse = (question, selectedOptions, otherText) => {
|
|
1523
|
-
const selectedLabels = question.options.filter((opt) => selectedOptions.includes(opt.id)).map((opt) => opt.label);
|
|
1523
|
+
const selectedLabels = question.options.filter((opt) => selectedOptions.includes(opt.id)).map((opt) => stripInlineMarkdown(opt.label));
|
|
1524
1524
|
if (otherText) {
|
|
1525
1525
|
selectedLabels.push(otherText);
|
|
1526
1526
|
}
|