@scalar/agent-chat 0.4.2 → 0.4.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ApprovalSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/ApprovalSection.vue"],"names":[],"mappings":";;;;;;;AAwMA,wBAMG"}
1
+ {"version":3,"file":"ApprovalSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/ApprovalSection.vue"],"names":[],"mappings":";;;;;;;AAqMA,wBAMG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./ApprovalSection.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../_virtual/_plugin-vue_export-helper.js";
4
- const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-a7e6c699"]]);
4
+ const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-1cb4fa51"]]);
5
5
  export {
6
6
  c as default
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorMessage.vue.d.ts","sourceRoot":"","sources":["../../src/components/ErrorMessage.vue"],"names":[],"mappings":"AA+CA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD,KAAK,WAAW,GAAG;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;;AA2DxC,wBAMG"}
1
+ {"version":3,"file":"ErrorMessage.vue.d.ts","sourceRoot":"","sources":["../../src/components/ErrorMessage.vue"],"names":[],"mappings":"AAqCA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD,KAAK,WAAW,GAAG;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;;AAoDxC,wBAMG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./ErrorMessage.vue2.js";
2
2
  /* empty css */
3
3
  import r from "../_virtual/_plugin-vue_export-helper.js";
4
- const t = /* @__PURE__ */ r(o, [["__scopeId", "data-v-63a481da"]]);
4
+ const a = /* @__PURE__ */ r(o, [["__scopeId", "data-v-0e26328c"]]);
5
5
  export {
6
- t as default
6
+ a as default
7
7
  };
@@ -1,25 +1,22 @@
1
- import { defineComponent as o, createElementBlock as t, createCommentVNode as c, openBlock as n, createVNode as s, createTextVNode as a, unref as m, toDisplayString as d } from "vue";
2
- import { ScalarIconInfo as i } from "@scalar/icons";
1
+ import { defineComponent as o, createElementBlock as t, createCommentVNode as c, openBlock as n, createVNode as s, createTextVNode as a, unref as m, toDisplayString as i } from "vue";
2
+ import { ScalarIconXCircle as d } from "@scalar/icons";
3
3
  import { AgentErrorCodes as l } from "../entities/error/constants.js";
4
- const p = {
4
+ const _ = {
5
5
  key: 0,
6
- class: "error gap-1.5"
7
- }, C = /* @__PURE__ */ o({
6
+ class: "error"
7
+ }, D = /* @__PURE__ */ o({
8
8
  __name: "ErrorMessage",
9
9
  props: {
10
10
  error: {}
11
11
  },
12
12
  setup(e) {
13
13
  const r = [l.LIMIT_REACHED];
14
- return (_, f) => r.includes(e.error.code) ? c("", !0) : (n(), t("div", p, [
15
- s(m(i), {
16
- class: "text-red size-4",
17
- weight: "bold"
18
- }),
19
- a(" " + d(e.error.message), 1)
14
+ return (p, E) => r.includes(e.error.code) ? c("", !0) : (n(), t("div", _, [
15
+ s(m(d)),
16
+ a(" " + i(e.error.message), 1)
20
17
  ]));
21
18
  }
22
19
  });
23
20
  export {
24
- C as default
21
+ D as default
25
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/PaymentSection.vue"],"names":[],"mappings":";AAwUA,wBAKG"}
1
+ {"version":3,"file":"PaymentSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/PaymentSection.vue"],"names":[],"mappings":";AAqUA,wBAKG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./PaymentSection.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../_virtual/_plugin-vue_export-helper.js";
4
- const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-0f59d089"]]);
4
+ const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-bbcefd08"]]);
5
5
  export {
6
- e as default
6
+ a as default
7
7
  };
@@ -1,22 +1,22 @@
1
- import { defineComponent as o, createElementBlock as p, openBlock as i, createElementVNode as t, createVNode as r, createTextVNode as f, unref as l, createStaticVNode as v } from "vue";
2
- import { ScalarIconInfo as c } from "@scalar/icons";
3
- import { useState as m } from "../state/state.js";
4
- const u = { class: "paymentSection" }, y = { class: "approvalText flex items-center gap-1.5" }, x = /* @__PURE__ */ o({
1
+ import { defineComponent as o, createElementBlock as c, openBlock as p, createElementVNode as t, createVNode as i, createTextVNode as r, unref as b, createStaticVNode as f } from "vue";
2
+ import { ScalarIconInfo as l } from "@scalar/icons";
3
+ import { useState as v } from "../state/state.js";
4
+ const m = { class: "paymentSection" }, u = { class: "approvalText flex items-center gap-1.5" }, x = /* @__PURE__ */ o({
5
5
  __name: "PaymentSection",
6
- setup(I) {
7
- const { dashboardUrl: e, mode: n, uploadedTmpDocumentUrl: d } = m();
6
+ setup(y) {
7
+ const { dashboardUrl: a, mode: n, uploadedTmpDocumentUrl: d } = v();
8
8
  function s() {
9
- n === "full" && window.location.replace(e), n === "preview" && window.location.replace(
10
- d.value ? `${e}/register?flow=oss-agent&docUrl=${d.value}` : e
9
+ n === "full" && window.location.replace(a), n === "preview" && window.location.replace(
10
+ d.value ? `${a}/register?flow=oss-agent&docUrl=${d.value}` : a
11
11
  );
12
12
  }
13
- return (g, a) => (i(), p("div", u, [
14
- t("strong", y, [
15
- r(l(c), {
13
+ return (I, e) => (p(), c("div", m, [
14
+ t("strong", u, [
15
+ i(b(l), {
16
16
  class: "text-blue size-4",
17
17
  weight: "bold"
18
18
  }),
19
- a[0] || (a[0] = f(" You've used up all your free messages, upgrade for $24/mo. ", -1))
19
+ e[0] || (e[0] = r(" You've used up all your free messages, upgrade for $24/mo. ", -1))
20
20
  ]),
21
21
  t("div", { class: "paymentContainer" }, [
22
22
  t("button", {
@@ -24,7 +24,7 @@ const u = { class: "paymentSection" }, y = { class: "approvalText flex items-cen
24
24
  type: "button",
25
25
  onClick: s
26
26
  }, " Upgrade "),
27
- a[1] || (a[1] = v('<div class="paymentInfo" data-v-0f59d089><h3 data-v-0f59d089>$24 <span data-v-0f59d089>/ month</span></h3><div class="paymentInfoSection" data-v-0f59d089><div class="paymentInfoItem" data-v-0f59d089><span data-v-0f59d089>Members in your workspace</span><span data-v-0f59d089>1</span></div><div class="paymentInfoItem" data-v-0f59d089><span data-v-0f59d089>x $24 / month / member</span><span data-v-0f59d089>$24.00</span></div></div><div class="paymentInfoSection" data-v-0f59d089><div class="paymentInfoItem" data-v-0f59d089><span data-v-0f59d089>Messages</span><span data-v-0f59d089>1000</span></div><div class="paymentInfoItem" data-v-0f59d089><span data-v-0f59d089>Additional Messages</span><span data-v-0f59d089>+ $0.02 Message</span></div></div></div>', 1))
27
+ e[1] || (e[1] = f('<div class="paymentInfo" data-v-bbcefd08><h3 data-v-bbcefd08>$24 <span data-v-bbcefd08>/ month</span></h3><div class="paymentInfoSection" data-v-bbcefd08><div class="paymentInfoItem" data-v-bbcefd08><span data-v-bbcefd08>Members in your workspace</span><span data-v-bbcefd08>1</span></div><div class="paymentInfoItem" data-v-bbcefd08><span data-v-bbcefd08>x $24 / month / member</span><span data-v-bbcefd08>$24.00</span></div></div><div class="paymentInfoSection" data-v-bbcefd08><div class="paymentInfoItem" data-v-bbcefd08><span data-v-bbcefd08>Messages</span><span data-v-bbcefd08>1000</span></div><div class="paymentInfoItem" data-v-bbcefd08><span data-v-bbcefd08>Additional Messages</span><span data-v-bbcefd08>+ $0.15 Message</span></div></div></div>', 1))
28
28
  ])
29
29
  ]));
30
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UploadSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/UploadSection.vue"],"names":[],"mappings":"AA8GA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AAE7E,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,sBAAsB,CAAA;CACpC,CAAC;;AAyIF,wBAMG"}
1
+ {"version":3,"file":"UploadSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/UploadSection.vue"],"names":[],"mappings":"AA0GA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AAE7E,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,sBAAsB,CAAA;CACpC,CAAC;;AAiJF,wBAMG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./UploadSection.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../_virtual/_plugin-vue_export-helper.js";
4
- const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-805bc88b"]]);
4
+ const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-4df8af00"]]);
5
5
  export {
6
- c as default
6
+ r as default
7
7
  };
@@ -1,56 +1,62 @@
1
- import { defineComponent as d, createElementBlock as t, openBlock as o, normalizeClass as i, createCommentVNode as n, createVNode as s, unref as a, createTextVNode as r, toDisplayString as u } from "vue";
2
- import { useLoadingState as p, ScalarLoading as g } from "@scalar/components";
1
+ import { defineComponent as c, createElementBlock as a, openBlock as n, normalizeClass as u, createCommentVNode as r, createVNode as l, createTextVNode as s, unref as o, toDisplayString as p } from "vue";
2
+ import { useLoadingState as g, ScalarLoading as i } from "@scalar/components";
3
3
  import { ScalarIconCheck as m, ScalarIconXCircle as S } from "@scalar/icons";
4
- const x = {
4
+ const f = {
5
5
  key: 0,
6
- class: "flex items-center gap-1.5"
7
- }, y = {
8
- key: 0,
9
- class: "uploadText"
10
- }, f = {
11
- key: 1,
12
- class: "uploadText"
13
- }, k = {
6
+ class: "uploadText flex items-center gap-1.5"
7
+ }, x = {
14
8
  key: 1,
15
9
  class: "uploadText flex items-center gap-1.5"
16
- }, h = {
10
+ }, y = {
17
11
  key: 2,
18
12
  class: "uploadText flex items-center gap-1.5"
19
- }, V = /* @__PURE__ */ d({
13
+ }, k = {
14
+ key: 3,
15
+ class: "uploadText flex items-center gap-1.5"
16
+ }, N = /* @__PURE__ */ c({
20
17
  __name: "UploadSection",
21
18
  props: {
22
19
  uploadState: {}
23
20
  },
24
21
  setup(e) {
25
- const c = p();
26
- return (C, l) => (o(), t("div", {
27
- class: i(["uploadSection", {
22
+ const d = g();
23
+ return (C, t) => (n(), a("div", {
24
+ class: u(["uploadSection", {
28
25
  error: e.uploadState.type === "error",
29
26
  done: e.uploadState.type === "done"
30
27
  }])
31
28
  }, [
32
- e.uploadState.type === "uploading" || e.uploadState.type === "processing" ? (o(), t("div", x, [
33
- s(a(g), {
34
- class: "text-blue",
29
+ e.uploadState.type === "uploading" ? (n(), a("strong", f, [
30
+ l(o(i), {
31
+ loader: {
32
+ ...o(d),
33
+ isLoading: !0
34
+ },
35
+ size: "lg"
36
+ }, null, 8, ["loader"]),
37
+ t[0] || (t[0] = s(" Uploading document... ", -1))
38
+ ])) : r("", !0),
39
+ e.uploadState.type === "processing" ? (n(), a("strong", x, [
40
+ l(o(i), {
35
41
  loader: {
36
- ...a(c),
42
+ ...o(d),
37
43
  isLoading: !0
38
44
  },
39
45
  size: "lg"
40
46
  }, null, 8, ["loader"]),
41
- e.uploadState.type === "processing" ? (o(), t("strong", y, " Processing document... ")) : (o(), t("strong", f, " Uploading document... "))
42
- ])) : n("", !0),
43
- e.uploadState.type === "done" ? (o(), t("strong", k, [
44
- s(a(m), { class: "icon text-green" }),
45
- l[0] || (l[0] = r(" Document processed ", -1))
46
- ])) : n("", !0),
47
- e.uploadState.type === "error" ? (o(), t("strong", h, [
48
- s(a(S), { class: "icon text-red" }),
49
- r(" " + u(e.uploadState.error), 1)
50
- ])) : n("", !0)
47
+ t[1] || (t[1] = s(" Processing document... ", -1))
48
+ ])) : r("", !0),
49
+ e.uploadState.type === "done" ? (n(), a("strong", y, [
50
+ l(o(m), { class: "icon" }),
51
+ t[2] || (t[2] = s(" Document processed ", -1))
52
+ ])) : r("", !0),
53
+ e.uploadState.type === "error" ? (n(), a("strong", k, [
54
+ l(o(S), { class: "icon" }),
55
+ s(" " + p(e.uploadState.error), 1)
56
+ ])) : r("", !0)
51
57
  ], 2));
52
58
  }
53
59
  });
54
60
  export {
55
- V as default
61
+ N as default
56
62
  };
@@ -13,7 +13,7 @@ export declare function getTmpDocFromLocalStorage(): {
13
13
  slug: string;
14
14
  } | undefined;
15
15
  export declare function useUploadTmpDocument(): {
16
- uploadTempDocument: (document: string, isAgent?: boolean) => Promise<{
16
+ uploadTempDocument: (document: string) => Promise<{
17
17
  url: string;
18
18
  namespace: string;
19
19
  slug: string;
@@ -1,11 +1,11 @@
1
- import { ref as d } from "vue";
1
+ import { ref as m } from "vue";
2
2
  import { z as o } from "zod/mini";
3
- import { useState as g } from "../state/state.js";
3
+ import { useState as d } from "../state/state.js";
4
4
  const u = "scalar-tmp-doc";
5
- function f({ namespace: t, slug: e }) {
5
+ function g({ namespace: t, slug: e }) {
6
6
  localStorage.setItem(u, JSON.stringify({ namespace: t, slug: e }));
7
7
  }
8
- function h() {
8
+ function v() {
9
9
  const t = localStorage.getItem(u);
10
10
  if (t)
11
11
  return o.object({
@@ -13,31 +13,31 @@ function h() {
13
13
  slug: o.string()
14
14
  }).parse(JSON.parse(t));
15
15
  }
16
- function T() {
17
- const t = g(), e = d();
18
- function c(n) {
19
- const a = `${t.baseUrl}${n}`;
16
+ function h() {
17
+ const t = d(), e = m();
18
+ function c(s) {
19
+ const a = `${t.baseUrl}${s}`;
20
20
  if (a.startsWith("/")) return a;
21
- const s = new URLSearchParams({ scalar_url: a.toString() });
22
- return new URL(`https://proxy.scalar.com/?${s}`);
21
+ const n = new URLSearchParams({ scalar_url: a.toString() });
22
+ return new URL(`https://proxy.scalar.com/?${n}`);
23
23
  }
24
- async function l(n, a = !1) {
24
+ async function l(s) {
25
25
  try {
26
26
  e.value = { type: "uploading" };
27
- const s = await fetch(c(`/core/share/upload/apis${a ? "?isAgent=true" : ""}`), {
27
+ const a = await fetch(c("/core/share/upload/apis"), {
28
28
  method: "POST",
29
29
  headers: { "Content-Type": "application/json" },
30
- body: JSON.stringify({ document: n })
30
+ body: JSON.stringify({ document: s })
31
31
  });
32
- if (!s.ok) {
32
+ if (!a.ok) {
33
33
  e.value = {
34
34
  type: "error",
35
35
  error: "Failed to upload document."
36
36
  };
37
37
  return;
38
38
  }
39
- const p = await s.json(), { success: i, data: r } = o.object({ url: o.string(), namespace: o.string(), slug: o.string() }).safeParse(p);
40
- if (!i) {
39
+ const n = await a.json(), { success: p, data: r } = o.object({ url: o.string(), namespace: o.string(), slug: o.string() }).safeParse(n);
40
+ if (!p) {
41
41
  e.value = {
42
42
  type: "error",
43
43
  error: "Failed to process document."
@@ -47,20 +47,20 @@ function T() {
47
47
  e.value = {
48
48
  type: "processing"
49
49
  };
50
- const m = await fetch(
50
+ const i = await fetch(
51
51
  c(`/vector/registry/embeddings/${r.namespace}/${r.slug}`),
52
52
  {
53
53
  method: "GET"
54
54
  }
55
55
  );
56
- if (f({
56
+ if (g({
57
57
  namespace: r.namespace,
58
58
  slug: r.slug
59
59
  }), await t.addDocument({
60
60
  namespace: r.namespace,
61
61
  slug: r.slug,
62
62
  removable: !1
63
- }), !m.ok) {
63
+ }), !i.ok) {
64
64
  e.value = {
65
65
  type: "error",
66
66
  error: "Failed to embed document."
@@ -81,6 +81,6 @@ function T() {
81
81
  };
82
82
  }
83
83
  export {
84
- h as getTmpDocFromLocalStorage,
85
- T as useUploadTmpDocument
84
+ v as getTmpDocFromLocalStorage,
85
+ h as useUploadTmpDocument
86
86
  };
package/dist/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "git+https://github.com/scalar/scalar.git",
11
11
  "directory": "packages/agent-chat"
12
12
  },
13
- "version": "0.4.2",
13
+ "version": "0.4.4",
14
14
  "engines": {
15
15
  "node": ">=20"
16
16
  },