@websolutespa/bom-llm 0.0.57 → 0.0.58

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @websolutespa/bom-llm
2
2
 
3
+ ## 0.0.58
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixing: chunksToChunkItems first chunk
8
+
3
9
  ## 0.0.57
4
10
 
5
11
  ### Patch Changes
@@ -511,11 +511,14 @@ llm-embed {
511
511
  margin: 0;
512
512
  padding: 0;
513
513
  border: none;
514
+ border-radius: 0;
514
515
  text-decoration: none;
515
516
  background: none;
517
+ color: inherit;
516
518
  appearance: none;
517
519
  font-family: inherit;
518
520
  font-style: inherit;
521
+ font-size: inherit;
519
522
  font-variant-ligatures: inherit;
520
523
  font-variant-caps: inherit;
521
524
  font-variant-numeric: inherit;
@@ -628,11 +631,14 @@ llm-embed {
628
631
  margin: 0;
629
632
  padding: 0;
630
633
  border: none;
634
+ border-radius: 0;
631
635
  text-decoration: none;
632
636
  background: none;
637
+ color: inherit;
633
638
  appearance: none;
634
639
  font-family: inherit;
635
640
  font-style: inherit;
641
+ font-size: inherit;
636
642
  font-variant-ligatures: inherit;
637
643
  font-variant-caps: inherit;
638
644
  font-variant-numeric: inherit;
@@ -995,11 +1001,14 @@ llm-embed {
995
1001
  margin: 0;
996
1002
  padding: 0;
997
1003
  border: none;
1004
+ border-radius: 0;
998
1005
  text-decoration: none;
999
1006
  background: none;
1007
+ color: inherit;
1000
1008
  appearance: none;
1001
1009
  font-family: inherit;
1002
1010
  font-style: inherit;
1011
+ font-size: inherit;
1003
1012
  font-variant-ligatures: inherit;
1004
1013
  font-variant-caps: inherit;
1005
1014
  font-variant-numeric: inherit;
@@ -1064,11 +1073,14 @@ llm-embed {
1064
1073
  margin: 0;
1065
1074
  padding: 0;
1066
1075
  border: none;
1076
+ border-radius: 0;
1067
1077
  text-decoration: none;
1068
1078
  background: none;
1079
+ color: inherit;
1069
1080
  appearance: none;
1070
1081
  font-family: inherit;
1071
1082
  font-style: inherit;
1083
+ font-size: inherit;
1072
1084
  font-variant-ligatures: inherit;
1073
1085
  font-variant-caps: inherit;
1074
1086
  font-variant-numeric: inherit;
@@ -1138,11 +1150,14 @@ llm-embed {
1138
1150
  margin: 0;
1139
1151
  padding: 0;
1140
1152
  border: none;
1153
+ border-radius: 0;
1141
1154
  text-decoration: none;
1142
1155
  background: none;
1156
+ color: inherit;
1143
1157
  appearance: none;
1144
1158
  font-family: inherit;
1145
1159
  font-style: inherit;
1160
+ font-size: inherit;
1146
1161
  font-variant-ligatures: inherit;
1147
1162
  font-variant-caps: inherit;
1148
1163
  font-variant-numeric: inherit;
@@ -1311,11 +1326,14 @@ llm-embed {
1311
1326
  margin: 0;
1312
1327
  padding: 0;
1313
1328
  border: none;
1329
+ border-radius: 0;
1314
1330
  text-decoration: none;
1315
1331
  background: none;
1332
+ color: inherit;
1316
1333
  appearance: none;
1317
1334
  font-family: inherit;
1318
1335
  font-style: inherit;
1336
+ font-size: inherit;
1319
1337
  font-variant-ligatures: inherit;
1320
1338
  font-variant-caps: inherit;
1321
1339
  font-variant-numeric: inherit;
@@ -1498,11 +1516,14 @@ llm-embed {
1498
1516
  margin: 0;
1499
1517
  padding: 0;
1500
1518
  border: none;
1519
+ border-radius: 0;
1501
1520
  text-decoration: none;
1502
1521
  background: none;
1522
+ color: inherit;
1503
1523
  appearance: none;
1504
1524
  font-family: inherit;
1505
1525
  font-style: inherit;
1526
+ font-size: inherit;
1506
1527
  font-variant-ligatures: inherit;
1507
1528
  font-variant-caps: inherit;
1508
1529
  font-variant-numeric: inherit;
@@ -1593,11 +1614,14 @@ llm-embed {
1593
1614
  margin: 0;
1594
1615
  padding: 0;
1595
1616
  border: none;
1617
+ border-radius: 0;
1596
1618
  text-decoration: none;
1597
1619
  background: none;
1620
+ color: inherit;
1598
1621
  appearance: none;
1599
1622
  font-family: inherit;
1600
1623
  font-style: inherit;
1624
+ font-size: inherit;
1601
1625
  font-variant-ligatures: inherit;
1602
1626
  font-variant-caps: inherit;
1603
1627
  font-variant-numeric: inherit;
@@ -1644,11 +1668,14 @@ llm-embed {
1644
1668
  margin: 0;
1645
1669
  padding: 0;
1646
1670
  border: none;
1671
+ border-radius: 0;
1647
1672
  text-decoration: none;
1648
1673
  background: none;
1674
+ color: inherit;
1649
1675
  appearance: none;
1650
1676
  font-family: inherit;
1651
1677
  font-style: inherit;
1678
+ font-size: inherit;
1652
1679
  font-variant-ligatures: inherit;
1653
1680
  font-variant-caps: inherit;
1654
1681
  font-variant-numeric: inherit;
@@ -1724,11 +1751,14 @@ llm-embed {
1724
1751
  margin: 0;
1725
1752
  padding: 0;
1726
1753
  border: none;
1754
+ border-radius: 0;
1727
1755
  text-decoration: none;
1728
1756
  background: none;
1757
+ color: inherit;
1729
1758
  appearance: none;
1730
1759
  font-family: inherit;
1731
1760
  font-style: inherit;
1761
+ font-size: inherit;
1732
1762
  font-variant-ligatures: inherit;
1733
1763
  font-variant-caps: inherit;
1734
1764
  font-variant-numeric: inherit;
@@ -1855,11 +1885,14 @@ llm-embed {
1855
1885
  margin: 0;
1856
1886
  padding: 0;
1857
1887
  border: none;
1888
+ border-radius: 0;
1858
1889
  text-decoration: none;
1859
1890
  background: none;
1891
+ color: inherit;
1860
1892
  appearance: none;
1861
1893
  font-family: inherit;
1862
1894
  font-style: inherit;
1895
+ font-size: inherit;
1863
1896
  font-variant-ligatures: inherit;
1864
1897
  font-variant-caps: inherit;
1865
1898
  font-variant-numeric: inherit;
@@ -1926,11 +1959,14 @@ llm-embed {
1926
1959
  margin: 0;
1927
1960
  padding: 0;
1928
1961
  border: none;
1962
+ border-radius: 0;
1929
1963
  text-decoration: none;
1930
1964
  background: none;
1965
+ color: inherit;
1931
1966
  appearance: none;
1932
1967
  font-family: inherit;
1933
1968
  font-style: inherit;
1969
+ font-size: inherit;
1934
1970
  font-variant-ligatures: inherit;
1935
1971
  font-variant-caps: inherit;
1936
1972
  font-variant-numeric: inherit;
@@ -1989,11 +2025,14 @@ llm-embed {
1989
2025
  margin: 0;
1990
2026
  padding: 0;
1991
2027
  border: none;
2028
+ border-radius: 0;
1992
2029
  text-decoration: none;
1993
2030
  background: none;
2031
+ color: inherit;
1994
2032
  appearance: none;
1995
2033
  font-family: inherit;
1996
2034
  font-style: inherit;
2035
+ font-size: inherit;
1997
2036
  font-variant-ligatures: inherit;
1998
2037
  font-variant-caps: inherit;
1999
2038
  font-variant-numeric: inherit;
package/dist/umd/index.js CHANGED
@@ -18944,15 +18944,17 @@ ${Object.entries(vars).map(_ref2 => {
18944
18944
  };
18945
18945
  if (message && message.role === 'assistant') {
18946
18946
  message.chunks.forEach(chunk => {
18947
- if (typeof chunk === 'string') {
18948
- chunks.push(...chunk.split(' ').map((x, i, a) => `${x}${i < a.length - 1 ? ' ' : ''}`));
18949
- } else if (chunk.type === 'string') {
18950
- const content = chunk.content;
18951
- if (content) {
18952
- chunks.push(...content.split(' ').map((x, i, a) => `${x}${i < a.length - 1 ? ' ' : ''}`));
18947
+ {
18948
+ if (typeof chunk === 'string') {
18949
+ chunks.push(...chunk.split(' ').map((x, i, a) => `${x}${i < a.length - 1 ? ' ' : ''}`));
18950
+ } else if (chunk.type === 'string') {
18951
+ const content = chunk.content;
18952
+ if (content) {
18953
+ chunks.push(...content.split(' ').map((x, i, a) => `${x}${i < a.length - 1 ? ' ' : ''}`));
18954
+ }
18955
+ } else {
18956
+ chunks.push(chunk);
18953
18957
  }
18954
- } else {
18955
- chunks.push(chunk);
18956
18958
  }
18957
18959
  });
18958
18960
  }
@@ -19333,7 +19335,7 @@ ${Object.entries(vars).map(_ref2 => {
19333
19335
  chunksToChunkItems(chunks, response) {
19334
19336
  const chunkItems = [];
19335
19337
  chunks.forEach(x => {
19336
- const lastMessage = chunkItems[chunkItems.length - 1];
19338
+ let lastMessage = chunkItems[chunkItems.length - 1];
19337
19339
  if (isObject$3(x)) {
19338
19340
  switch (x.type) {
19339
19341
  case 'log':
@@ -19427,18 +19429,26 @@ ${Object.entries(vars).map(_ref2 => {
19427
19429
  }
19428
19430
  } else if (typeof x === 'string') {
19429
19431
  // console.warn('chunksToChunkItems typeof string');
19430
- if (lastMessage && isChunkText(lastMessage)) {
19431
- if (chunkItems.indexOf(lastMessage) > 0) {
19432
+ if (!lastMessage) {
19433
+ lastMessage = {
19434
+ type: 'text',
19435
+ text: ''
19436
+ };
19437
+ chunkItems.push(lastMessage);
19438
+ }
19439
+ if (isChunkText(lastMessage)) {
19440
+ const lastChunkText = lastMessage;
19441
+ if (chunkItems.indexOf(lastChunkText) > 0) {
19432
19442
  // secondary chunk
19433
- lastMessage.text += x;
19434
- } else if (!lastMessage.text.includes('\n')) {
19443
+ lastChunkText.text += x;
19444
+ } else if (!lastChunkText.text.includes('\n')) {
19435
19445
  // uncompleted first chunk
19436
19446
  if (x.includes('\n')) {
19437
19447
  const lines = x.split('\n');
19438
19448
  lines.forEach((line, i) => {
19439
19449
  const lastChar = lines.length > i + 1 ? '\n' : '';
19440
19450
  if (i === 0) {
19441
- lastMessage.text += line + lastChar;
19451
+ lastChunkText.text += line + lastChar;
19442
19452
  } else if (line.length > 0) {
19443
19453
  chunkItems.push({
19444
19454
  type: 'text',
@@ -19448,7 +19458,7 @@ ${Object.entries(vars).map(_ref2 => {
19448
19458
  });
19449
19459
  } else {
19450
19460
  // uncompleted first chunk
19451
- lastMessage.text += x;
19461
+ lastChunkText.text += x;
19452
19462
  }
19453
19463
  } else {
19454
19464
  // completed first chunk