lightnode-sdk 0.8.7 → 0.8.8

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.
Files changed (2) hide show
  1. package/dist/add.js +17 -7
  2. package/package.json +1 -1
package/dist/add.js CHANGED
@@ -1007,9 +1007,10 @@ export default function ChatWeb3() {
1007
1007
  return () => { cancelled = true; };
1008
1008
  }, [network]);
1009
1009
 
1010
- // Keep the latest turn (and the "writing on chain" indicator) in view.
1010
+ // Keep the latest turn in view. Instant while streaming (smooth scrolling on
1011
+ // every chunk competes for the main thread); smooth once idle.
1011
1012
  useEffect(() => {
1012
- endRef.current?.scrollIntoView({ behavior: "smooth" });
1013
+ endRef.current?.scrollIntoView({ behavior: busy ? "auto" : "smooth", block: "nearest" });
1013
1014
  }, [turns, busy]);
1014
1015
 
1015
1016
  /** Build a single prompt from history + new user input. */
@@ -1143,9 +1144,15 @@ export default function ChatWeb3() {
1143
1144
  <LcaiMark className="mt-0.5 size-7 shrink-0" />
1144
1145
  <div className="flex min-w-0 flex-1 flex-col gap-2">
1145
1146
  {t.text ? (
1146
- <div className="max-w-none text-sm leading-relaxed text-foreground [&_*:first-child]:mt-0 [&_*:last-child]:mb-0">
1147
- <Streamdown>{t.text}</Streamdown>
1148
- </div>
1147
+ t.streaming ? (
1148
+ // While streaming, render plain text (cheap) - markdown is
1149
+ // parsed once when the turn finalizes, below.
1150
+ <div className="whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground">{t.text}</div>
1151
+ ) : (
1152
+ <div className="max-w-none text-sm leading-relaxed text-foreground [&_*:first-child]:mt-0 [&_*:last-child]:mb-0">
1153
+ <Streamdown>{t.text}</Streamdown>
1154
+ </div>
1155
+ )
1149
1156
  ) : (
1150
1157
  <div className="animate-pulse-dot pt-1 text-sm text-muted-foreground">
1151
1158
  {busyStage || "Writing on chain..."}
@@ -1391,10 +1398,13 @@ export default function InferenceWeb3() {
1391
1398
  <div className="flex gap-3">
1392
1399
  <LcaiMark className="mt-0.5 size-7 shrink-0" />
1393
1400
  <div className="flex min-w-0 flex-1 flex-col gap-2">
1394
- {result || stream ? (
1401
+ {result ? (
1395
1402
  <div className="max-w-none text-sm leading-relaxed text-foreground [&_*:first-child]:mt-0 [&_*:last-child]:mb-0">
1396
- <Streamdown>{result ? result.answer : stream}</Streamdown>
1403
+ <Streamdown>{result.answer}</Streamdown>
1397
1404
  </div>
1405
+ ) : stream ? (
1406
+ // Plain text while streaming; markdown is parsed once on completion.
1407
+ <div className="whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground">{stream}</div>
1398
1408
  ) : (
1399
1409
  <div className="animate-pulse-dot pt-1 text-sm text-muted-foreground">
1400
1410
  {busyStage || "Writing on chain..."}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lightnode-sdk",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "description": "Read-only TypeScript client for LightChain AI: workers, jobs, models, on-chain registration, and per-model network analytics. Independent, community-built (not an official LightChain package).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",