@llmnative/react 1.10.0 → 1.10.1

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/index.mjs CHANGED
@@ -9229,12 +9229,12 @@ var nu = ({ mode: e, availability: n, renderAIUnavailable: r }) => {
9229
9229
  let { handleChange: C, record: w } = Dd({
9230
9230
  name: e,
9231
9231
  subscribeToFullRecord: !0
9232
- }), T = Y("prompt"), E = Fn("prompt"), D = n || e, [O, k] = h(!1), [A, j] = h(o?.value ?? ""), [M, N] = h(!1), [P, F] = h(null), I = $c(), L = el(), R = typeof localStorage < "u" && localStorage.getItem("prompt.model") || (I ? Yc(I.id, I.defaultModel) : ""), { modelOptions: z } = eu(), B = t.useMemo(() => lu(r?.prompt, o), [o, r?.prompt]), V = B.model || R, H = u(), U = tu(V, !!m), W = !U.configured, [ee, G] = h(null), te = !ee && !U.configured ? g?.({
9232
+ }), T = Y("prompt"), E = Fn("prompt"), D = n || e, [O, k] = h(!1), [A, j] = h(o?.value ?? ""), [M, N] = h(!1), [P, F] = h(null), I = $c(), L = el(), { modelOptions: R } = eu(), z = typeof localStorage < "u" ? localStorage.getItem("prompt.model") : null, B = z && R.some((e) => e.value === z) ? z : "", V = t.useMemo(() => lu(r?.prompt, o), [o, r?.prompt]), H = V.model || B, U = u(), W = tu(H, !!m), ee = !W.configured || !m && !H, [G, te] = h(null), ne = !G && !W.configured ? g?.({
9233
9233
  mode: "run",
9234
- providerId: U.providerId,
9235
- reason: U.reason,
9236
- configured: U.configured
9237
- }) : null, ne = t.useMemo(() => {
9234
+ providerId: W.providerId,
9235
+ reason: W.reason,
9236
+ configured: W.configured
9237
+ }) : null, re = t.useMemo(() => {
9238
9238
  if (!A) return "";
9239
9239
  let e = {
9240
9240
  ...w,
@@ -9245,35 +9245,35 @@ var nu = ({ mode: e, availability: n, renderAIUnavailable: r }) => {
9245
9245
  A,
9246
9246
  w,
9247
9247
  _
9248
- ]), re = ne !== A, K = (e, t) => C?.({ target: {
9248
+ ]), K = re !== A, ie = (e, t) => C?.({ target: {
9249
9249
  name: e,
9250
9250
  value: t
9251
- } }), ie = x?.map((e) => e.key === "tokenUsage" && !e.content ? {
9251
+ } }), ae = x?.map((e) => e.key === "tokenUsage" && !e.content ? {
9252
9252
  ...e,
9253
9253
  content: P ? /* @__PURE__ */ t.createElement("div", { className: "px-3 py-2 text-xs space-y-1" }, /* @__PURE__ */ t.createElement("p", { className: "font-medium text-foreground" }, E.tokenUsage), /* @__PURE__ */ t.createElement("p", { className: "text-muted-foreground" }, Dn(E.tokenInput, { count: String(P.tokensIn) })), /* @__PURE__ */ t.createElement("p", { className: "text-muted-foreground" }, Dn(E.tokenOutput, { count: String(P.tokensOut) })), P.contextPercent !== null && /* @__PURE__ */ t.createElement("p", { className: "text-muted-foreground" }, Dn(E.tokenContext, { percent: P.contextPercent.toFixed(1) })), P.estimatedCost !== null && /* @__PURE__ */ t.createElement("p", { className: "text-muted-foreground" }, Dn(E.tokenCost, { amount: P.estimatedCost.toFixed(5) })), /* @__PURE__ */ t.createElement("p", { className: "text-muted-foreground" }, Dn(E.tokenTime, { seconds: (P.durationMs / 1e3).toFixed(1) }))) : /* @__PURE__ */ t.createElement("p", { className: "px-3 py-2 text-xs text-muted-foreground" }, E.tokenUsageEmpty)
9254
- } : e), ae = async (t) => {
9255
- let n = t.model || V || R, r = Xc(n), i = r ? L?.registry[r.provider] ?? I ?? void 0 : I ?? void 0, a = Date.now();
9254
+ } : e), oe = async (t) => {
9255
+ let n = t.model || H || B, r = Xc(n), i = r ? L?.registry[r.provider] ?? I ?? void 0 : I ?? void 0, a = Date.now();
9256
9256
  try {
9257
9257
  let r = {
9258
9258
  ...w,
9259
9259
  ..._
9260
9260
  }, o = await Promise.all(t.files.map((e) => Cl.fileToAttachment(e))), s = await fu({
9261
- ...B,
9261
+ ...V,
9262
9262
  model: n,
9263
- role: t.role ?? B.role,
9264
- voice: t.voice ?? B.voice,
9265
- style: t.style ?? B.style,
9266
- language: t.language ?? B.language,
9267
- temperature: t.temperature ?? B.temperature
9263
+ role: t.role ?? V.role,
9264
+ voice: t.voice ?? V.voice,
9265
+ style: t.style ?? V.style,
9266
+ language: t.language ?? V.language,
9267
+ temperature: t.temperature ?? V.temperature
9268
9268
  }, r, m, i, o.length > 0 ? o : void 0, {
9269
9269
  noProvider: E.noProvider,
9270
9270
  noResponse: E.noResponse
9271
9271
  }), c = Date.now() - a;
9272
- if (G(null), C?.({ target: {
9272
+ if (te(null), C?.({ target: {
9273
9273
  name: e + ".value",
9274
9274
  value: s
9275
- } }), t.role !== void 0 && K(e + ".prompt.role", t.role), t.voice !== void 0 && K(e + ".prompt.voice", t.voice), t.style !== void 0 && K(e + ".prompt.style", t.style), t.language !== void 0 && K(e + ".prompt.language", t.language), S && S.length > 0) {
9276
- let e = Jc.parsePrompt(B.value ?? "", r), t = Cl.countTokens(e), i = Cl.countTokens(s ?? ""), a = Cl.contextPercent(t, n), o = Cl.estimateCost(t, i, n);
9275
+ } }), t.role !== void 0 && ie(e + ".prompt.role", t.role), t.voice !== void 0 && ie(e + ".prompt.voice", t.voice), t.style !== void 0 && ie(e + ".prompt.style", t.style), t.language !== void 0 && ie(e + ".prompt.language", t.language), S && S.length > 0) {
9276
+ let e = Jc.parsePrompt(V.value ?? "", r), t = Cl.countTokens(e), i = Cl.countTokens(s ?? ""), a = Cl.contextPercent(t, n), o = Cl.estimateCost(t, i, n);
9277
9277
  F({
9278
9278
  tokensIn: t,
9279
9279
  tokensOut: i,
@@ -9284,11 +9284,11 @@ var nu = ({ mode: e, availability: n, renderAIUnavailable: r }) => {
9284
9284
  });
9285
9285
  }
9286
9286
  } catch (e) {
9287
- G(Ql(e, E.runFailed));
9287
+ te(Ql(e, E.runFailed));
9288
9288
  }
9289
9289
  };
9290
9290
  return /* @__PURE__ */ t.createElement(Z, { className: f || T.Prompt.wrapperClassName }, /* @__PURE__ */ t.createElement("div", { className: "flex items-center gap-2" }, l && /* @__PURE__ */ t.createElement("div", { className: "shrink-0" }, l), /* @__PURE__ */ t.createElement("div", { className: `${ql} min-w-0 flex-1` }, D && /* @__PURE__ */ t.createElement($l, {
9291
- htmlFor: H,
9291
+ htmlFor: U,
9292
9292
  label: O ? `${E.promptLabel}${D}` : D,
9293
9293
  required: i
9294
9294
  }), /* @__PURE__ */ t.createElement("div", { className: "group relative" }, /* @__PURE__ */ t.createElement("button", {
@@ -9300,7 +9300,7 @@ var nu = ({ mode: e, availability: n, renderAIUnavailable: r }) => {
9300
9300
  name: O ? "x" : "settings",
9301
9301
  size: 13
9302
9302
  })), O ? /* @__PURE__ */ t.createElement("div", { className: "overflow-hidden rounded-xl border border-input shadow-sm transition-shadow focus-within:shadow-md focus-within:ring-2 focus-within:ring-warning focus-within:ring-offset-0" }, /* @__PURE__ */ t.createElement(Ps, {
9303
- id: H,
9303
+ id: U,
9304
9304
  name: e + ".prompt.value",
9305
9305
  defaultValue: o?.value,
9306
9306
  onChange: (e) => {
@@ -9312,7 +9312,7 @@ var nu = ({ mode: e, availability: n, renderAIUnavailable: r }) => {
9312
9312
  className: `${p || T.Prompt.className} ${su}`,
9313
9313
  minHeight: s,
9314
9314
  maxHeight: c
9315
- }), re && M && /* @__PURE__ */ t.createElement("div", { className: "border-t border-input px-4 py-3 bg-muted/20" }, /* @__PURE__ */ t.createElement("p", { className: "whitespace-pre-wrap text-sm text-foreground/70" }, ne)), re && /* @__PURE__ */ t.createElement("div", { className: "flex items-center justify-end border-t border-input px-2 py-1" }, /* @__PURE__ */ t.createElement("button", {
9315
+ }), K && M && /* @__PURE__ */ t.createElement("div", { className: "border-t border-input px-4 py-3 bg-muted/20" }, /* @__PURE__ */ t.createElement("p", { className: "whitespace-pre-wrap text-sm text-foreground/70" }, re)), K && /* @__PURE__ */ t.createElement("div", { className: "flex items-center justify-end border-t border-input px-2 py-1" }, /* @__PURE__ */ t.createElement("button", {
9316
9316
  type: "button",
9317
9317
  title: M ? E.hidePreview : E.showPreview,
9318
9318
  className: `${cu} flex items-center justify-center ${M ? "bg-muted text-foreground" : ""}`,
@@ -9338,32 +9338,32 @@ var nu = ({ mode: e, availability: n, renderAIUnavailable: r }) => {
9338
9338
  onChange: C ?? (() => {})
9339
9339
  });
9340
9340
  },
9341
- disabled: W,
9341
+ disabled: ee,
9342
9342
  onSubmit: (e) => {
9343
- ae(e);
9343
+ oe(e);
9344
9344
  },
9345
9345
  attachments: b,
9346
9346
  commands: v,
9347
9347
  commandsTrigger: y,
9348
- models: z,
9349
- selectedModel: V,
9350
- onModelChange: (t) => K(e + ".prompt.model", t),
9348
+ models: R,
9349
+ selectedModel: H,
9350
+ onModelChange: (t) => ie(e + ".prompt.model", t),
9351
9351
  showSettings: !0,
9352
- defaultRole: B.role,
9353
- defaultVoice: B.voice,
9354
- defaultStyle: B.style,
9355
- defaultLanguage: B.language,
9356
- defaultTemperature: B.temperature,
9357
- actions: ie,
9352
+ defaultRole: V.role,
9353
+ defaultVoice: V.voice,
9354
+ defaultStyle: V.style,
9355
+ defaultLanguage: V.language,
9356
+ defaultTemperature: V.temperature,
9357
+ actions: ae,
9358
9358
  minHeight: s,
9359
9359
  maxHeight: c,
9360
9360
  className: p || T.Prompt.className,
9361
9361
  wrapperClassName: ""
9362
- }), (ee || !U.configured) && (te ? /* @__PURE__ */ t.createElement("div", { className: "mt-1" }, te) : /* @__PURE__ */ t.createElement("span", { className: "mt-1 flex min-w-0 items-center gap-1 text-xs text-warning" }, /* @__PURE__ */ t.createElement(Q, {
9362
+ }), (G || !W.configured) && (ne ? /* @__PURE__ */ t.createElement("div", { className: "mt-1" }, ne) : /* @__PURE__ */ t.createElement("span", { className: "mt-1 flex min-w-0 items-center gap-1 text-xs text-warning" }, /* @__PURE__ */ t.createElement(Q, {
9363
9363
  name: "triangle-alert",
9364
9364
  size: 13,
9365
9365
  className: "shrink-0"
9366
- }), /* @__PURE__ */ t.createElement("span", { className: "truncate" }, ee ?? (U.reason || E.aiNotConfiguredShort)))), S && S.length > 0 && P && /* @__PURE__ */ t.createElement("div", { className: "mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 rounded-lg border border-input/50 bg-muted/20 px-4 py-1.5 text-[11px] text-muted-foreground" }, S.map((e) => {
9366
+ }), /* @__PURE__ */ t.createElement("span", { className: "truncate" }, G ?? (W.reason || E.aiNotConfiguredShort)))), S && S.length > 0 && P && /* @__PURE__ */ t.createElement("div", { className: "mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 rounded-lg border border-input/50 bg-muted/20 px-4 py-1.5 text-[11px] text-muted-foreground" }, S.map((e) => {
9367
9367
  if (typeof e == "string") switch (e) {
9368
9368
  case "tokensIn": return /* @__PURE__ */ t.createElement("span", { key: "tokensIn" }, Dn(E.tokenInput, { count: P.tokensIn }));
9369
9369
  case "tokensOut": return /* @__PURE__ */ t.createElement("span", { key: "tokensOut" }, Dn(E.tokenOutput, { count: P.tokensOut }));