@scalar/agent-chat 0.4.4 → 0.4.5
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/App.vue.d.ts +2 -0
- package/dist/App.vue.d.ts.map +1 -1
- package/dist/App.vue.js +9 -7
- package/dist/components/ApprovalSection.vue.d.ts.map +1 -1
- package/dist/components/ApprovalSection.vue.js +1 -1
- package/dist/components/ErrorMessage.vue.d.ts.map +1 -1
- package/dist/components/ErrorMessage.vue.js +2 -2
- package/dist/components/ErrorMessage.vue2.js +12 -9
- package/dist/components/FreeMessagesInfoSection.vue.d.ts +3 -0
- package/dist/components/FreeMessagesInfoSection.vue.d.ts.map +1 -0
- package/dist/components/FreeMessagesInfoSection.vue.js +7 -0
- package/dist/components/FreeMessagesInfoSection.vue2.js +49 -0
- package/dist/components/PaymentSection.vue.d.ts.map +1 -1
- package/dist/components/PaymentSection.vue.js +2 -2
- package/dist/components/PaymentSection.vue2.js +13 -13
- package/dist/components/UploadSection.vue.d.ts.map +1 -1
- package/dist/components/UploadSection.vue.js +2 -2
- package/dist/components/UploadSection.vue2.js +31 -37
- package/dist/hooks/use-upload-tmp-document.d.ts +1 -1
- package/dist/hooks/use-upload-tmp-document.js +21 -21
- package/dist/package.json +1 -1
- package/dist/state/state.d.ts +2 -1
- package/dist/state/state.d.ts.map +1 -1
- package/dist/state/state.js +94 -91
- package/dist/style.css +1 -1
- package/dist/views/Chat/Chat.vue.js +1 -1
- package/dist/views/PromptForm.vue.d.ts.map +1 -1
- package/dist/views/PromptForm.vue.js +1 -1
- package/dist/views/PromptForm.vue2.js +189 -187
- package/dist/views/Settings/DocSettings.vue.js +2 -2
- package/dist/views/Settings/DocSettings.vue2.js +7 -7
- package/dist/views/Start.vue.d.ts.map +1 -1
- package/dist/views/Start.vue.js +2 -2
- package/package.json +8 -8
package/dist/App.vue.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
1
2
|
import { type RegistryDocument } from './state/state.js';
|
|
2
3
|
import { type ChatMode } from './types';
|
|
3
4
|
type __VLS_Props = {
|
|
@@ -9,6 +10,7 @@ type __VLS_Props = {
|
|
|
9
10
|
getAccessToken?: () => string;
|
|
10
11
|
getAgentKey?: () => string;
|
|
11
12
|
getActiveDocumentJson?: () => string;
|
|
13
|
+
prefilledMessage?: Ref<string>;
|
|
12
14
|
};
|
|
13
15
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
16
|
export default _default;
|
package/dist/App.vue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.vue.d.ts","sourceRoot":"","sources":["../src/App.vue"],"names":[],"mappings":"AAoDA,OAAO,EAA6B,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,gBAAgB,EAAE,CAAA;IACrC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,cAAc,CAAC,EAAE,MAAM,MAAM,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,MAAM,CAAA;IAC1B,qBAAqB,CAAC,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"App.vue.d.ts","sourceRoot":"","sources":["../src/App.vue"],"names":[],"mappings":"AAoDA,OAAO,EAAW,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAGvC,OAAO,EAA6B,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,gBAAgB,EAAE,CAAA;IACrC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,cAAc,CAAC,EAAE,MAAM,MAAM,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,MAAM,CAAA;IAC1B,qBAAqB,CAAC,EAAE,MAAM,MAAM,CAAA;IACpC,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC/B,CAAC;;AAmEF,wBAMG"}
|
package/dist/App.vue.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as t, provide as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as t, provide as r, createBlock as n, openBlock as c } from "vue";
|
|
2
|
+
import o from "./Chat.vue.js";
|
|
3
3
|
import { STATE_SYMBOL as s, createState as i } from "./state/state.js";
|
|
4
|
-
const
|
|
4
|
+
const u = /* @__PURE__ */ t({
|
|
5
5
|
__name: "App",
|
|
6
6
|
props: {
|
|
7
7
|
registryDocuments: {},
|
|
@@ -11,14 +11,16 @@ const d = /* @__PURE__ */ t({
|
|
|
11
11
|
mode: { default: "full" },
|
|
12
12
|
getAccessToken: { type: Function },
|
|
13
13
|
getAgentKey: { type: Function },
|
|
14
|
-
getActiveDocumentJson: { type: Function }
|
|
14
|
+
getActiveDocumentJson: { type: Function },
|
|
15
|
+
prefilledMessage: {}
|
|
15
16
|
},
|
|
16
17
|
setup(e) {
|
|
17
|
-
return
|
|
18
|
+
return r(
|
|
18
19
|
s,
|
|
19
20
|
i({
|
|
20
21
|
getActiveDocumentJson: e.getActiveDocumentJson,
|
|
21
22
|
initialRegistryDocuments: e.registryDocuments,
|
|
23
|
+
prefilledMessageRef: e.prefilledMessage,
|
|
22
24
|
registryUrl: e.registryUrl,
|
|
23
25
|
baseUrl: e.baseUrl,
|
|
24
26
|
mode: e.mode,
|
|
@@ -26,9 +28,9 @@ const d = /* @__PURE__ */ t({
|
|
|
26
28
|
getAgentKey: e.getAgentKey,
|
|
27
29
|
dashboardUrl: e.dashboardUrl
|
|
28
30
|
})
|
|
29
|
-
), (a,
|
|
31
|
+
), (a, l) => (c(), n(o));
|
|
30
32
|
}
|
|
31
33
|
});
|
|
32
34
|
export {
|
|
33
|
-
|
|
35
|
+
u as default
|
|
34
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApprovalSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/ApprovalSection.vue"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"ApprovalSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/ApprovalSection.vue"],"names":[],"mappings":";;;;;;;AAwMA,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-
|
|
4
|
+
const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-a7e6c699"]]);
|
|
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":"
|
|
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,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
|
|
4
|
+
const t = /* @__PURE__ */ r(o, [["__scopeId", "data-v-63a481da"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
t as default
|
|
7
7
|
};
|
|
@@ -1,22 +1,25 @@
|
|
|
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
|
|
2
|
-
import {
|
|
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";
|
|
3
3
|
import { AgentErrorCodes as l } from "../entities/error/constants.js";
|
|
4
|
-
const
|
|
4
|
+
const p = {
|
|
5
5
|
key: 0,
|
|
6
|
-
class: "error"
|
|
7
|
-
},
|
|
6
|
+
class: "error gap-1.5"
|
|
7
|
+
}, C = /* @__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 (
|
|
15
|
-
s(m(
|
|
16
|
-
|
|
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)
|
|
17
20
|
]));
|
|
18
21
|
}
|
|
19
22
|
});
|
|
20
23
|
export {
|
|
21
|
-
|
|
24
|
+
C as default
|
|
22
25
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=FreeMessagesInfoSection.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FreeMessagesInfoSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/FreeMessagesInfoSection.vue"],"names":[],"mappings":";AAkQA,wBAKG"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { defineComponent as u, ref as d, withDirectives as f, createElementBlock as p, openBlock as m, createElementVNode as e, createVNode as r, createTextVNode as g, unref as i, vShow as _ } from "vue";
|
|
2
|
+
import { ScalarIconInfo as w, ScalarIconX as b } from "@scalar/icons";
|
|
3
|
+
import { useState as v } from "../state/state.js";
|
|
4
|
+
const h = { class: "freeMessagesInfoSection" }, x = { class: "infoText flex items-center gap-1.5" }, I = { class: "actionsContainer" }, k = /* @__PURE__ */ u({
|
|
5
|
+
__name: "FreeMessagesInfoSection",
|
|
6
|
+
setup(S) {
|
|
7
|
+
const t = d(!1), { dashboardUrl: o, mode: s, uploadedTmpDocumentUrl: n } = v();
|
|
8
|
+
function c() {
|
|
9
|
+
s === "full" && window.location.replace(o), s === "preview" && window.location.replace(
|
|
10
|
+
n.value ? `${o}/register?flow=oss-agent&docUrl=${n.value}` : o
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
function l() {
|
|
14
|
+
t.value = !0;
|
|
15
|
+
}
|
|
16
|
+
return (y, a) => f((m(), p("div", h, [
|
|
17
|
+
e("strong", x, [
|
|
18
|
+
r(i(w), {
|
|
19
|
+
class: "text-blue size-4",
|
|
20
|
+
weight: "bold"
|
|
21
|
+
}),
|
|
22
|
+
a[0] || (a[0] = g(" You get 10 free messages, you can upgrade at anytime to get more for your API. ", -1))
|
|
23
|
+
]),
|
|
24
|
+
e("div", I, [
|
|
25
|
+
e("button", {
|
|
26
|
+
class: "actionButton upgradeButton",
|
|
27
|
+
type: "button",
|
|
28
|
+
onClick: c
|
|
29
|
+
}, " Upgrade "),
|
|
30
|
+
e("button", {
|
|
31
|
+
"aria-label": "Close",
|
|
32
|
+
class: "closeButton",
|
|
33
|
+
type: "button",
|
|
34
|
+
onClick: l
|
|
35
|
+
}, [
|
|
36
|
+
r(i(b), {
|
|
37
|
+
class: "size-4",
|
|
38
|
+
weight: "bold"
|
|
39
|
+
})
|
|
40
|
+
])
|
|
41
|
+
])
|
|
42
|
+
], 512)), [
|
|
43
|
+
[_, !t.value]
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
export {
|
|
48
|
+
k as default
|
|
49
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/PaymentSection.vue"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"PaymentSection.vue.d.ts","sourceRoot":"","sources":["../../src/components/PaymentSection.vue"],"names":[],"mappings":";AAwUA,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
|
|
4
|
+
const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-59a0be07"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
r as default
|
|
7
7
|
};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarIconInfo as
|
|
3
|
-
import { useState as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as d, createElementBlock as p, openBlock as i, createElementVNode as t, createVNode as r, createTextVNode as l, unref as v, createStaticVNode as c } from "vue";
|
|
2
|
+
import { ScalarIconInfo as m } from "@scalar/icons";
|
|
3
|
+
import { useState as b } from "../state/state.js";
|
|
4
|
+
const f = { class: "paymentSection" }, u = { class: "approvalText flex items-center gap-1.5" }, x = /* @__PURE__ */ d({
|
|
5
5
|
__name: "PaymentSection",
|
|
6
6
|
setup(y) {
|
|
7
|
-
const { dashboardUrl:
|
|
8
|
-
function
|
|
9
|
-
n === "full" && window.location.replace(
|
|
10
|
-
|
|
7
|
+
const { dashboardUrl: e, mode: n, uploadedTmpDocumentUrl: s } = b();
|
|
8
|
+
function o() {
|
|
9
|
+
n === "full" && window.location.replace(e), n === "preview" && window.location.replace(
|
|
10
|
+
s.value ? `${e}/register?flow=oss-agent&docUrl=${s.value}` : e
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
|
-
return (I,
|
|
13
|
+
return (I, a) => (i(), p("div", f, [
|
|
14
14
|
t("strong", u, [
|
|
15
|
-
|
|
15
|
+
r(v(m), {
|
|
16
16
|
class: "text-blue size-4",
|
|
17
17
|
weight: "bold"
|
|
18
18
|
}),
|
|
19
|
-
|
|
19
|
+
a[0] || (a[0] = l(" 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", {
|
|
23
23
|
class: "actionButton approveButton",
|
|
24
24
|
type: "button",
|
|
25
|
-
onClick:
|
|
25
|
+
onClick: o
|
|
26
26
|
}, " Upgrade "),
|
|
27
|
-
|
|
27
|
+
a[1] || (a[1] = c('<div class="paymentInfo" data-v-59a0be07><h3 data-v-59a0be07>$24 <span data-v-59a0be07>/ month</span></h3><div class="paymentInfoSection" data-v-59a0be07><div class="paymentInfoItem" data-v-59a0be07><span data-v-59a0be07>Members in your workspace</span><span data-v-59a0be07>1</span></div><div class="paymentInfoItem" data-v-59a0be07><span data-v-59a0be07>x $24 / month / member</span><span data-v-59a0be07>$24.00</span></div></div><div class="paymentInfoSection" data-v-59a0be07><div class="paymentInfoItem" data-v-59a0be07><span data-v-59a0be07>Messages</span><span data-v-59a0be07>1,000</span></div><div class="paymentInfoItem" data-v-59a0be07><span data-v-59a0be07>Additional Messages</span><span data-v-59a0be07>+ $0.02 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":"
|
|
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,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
|
|
4
|
+
const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-805bc88b"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
c as default
|
|
7
7
|
};
|
|
@@ -1,62 +1,56 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useLoadingState as
|
|
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";
|
|
3
3
|
import { ScalarIconCheck as m, ScalarIconXCircle as S } from "@scalar/icons";
|
|
4
|
-
const
|
|
4
|
+
const x = {
|
|
5
5
|
key: 0,
|
|
6
|
-
class: "
|
|
7
|
-
},
|
|
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 = {
|
|
8
14
|
key: 1,
|
|
9
15
|
class: "uploadText flex items-center gap-1.5"
|
|
10
|
-
},
|
|
16
|
+
}, h = {
|
|
11
17
|
key: 2,
|
|
12
18
|
class: "uploadText flex items-center gap-1.5"
|
|
13
|
-
},
|
|
14
|
-
key: 3,
|
|
15
|
-
class: "uploadText flex items-center gap-1.5"
|
|
16
|
-
}, N = /* @__PURE__ */ c({
|
|
19
|
+
}, V = /* @__PURE__ */ d({
|
|
17
20
|
__name: "UploadSection",
|
|
18
21
|
props: {
|
|
19
22
|
uploadState: {}
|
|
20
23
|
},
|
|
21
24
|
setup(e) {
|
|
22
|
-
const
|
|
23
|
-
return (C,
|
|
24
|
-
class:
|
|
25
|
+
const c = p();
|
|
26
|
+
return (C, l) => (o(), t("div", {
|
|
27
|
+
class: i(["uploadSection", {
|
|
25
28
|
error: e.uploadState.type === "error",
|
|
26
29
|
done: e.uploadState.type === "done"
|
|
27
30
|
}])
|
|
28
31
|
}, [
|
|
29
|
-
e.uploadState.type === "uploading" ? (
|
|
30
|
-
|
|
31
|
-
|
|
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), {
|
|
32
|
+
e.uploadState.type === "uploading" || e.uploadState.type === "processing" ? (o(), t("div", x, [
|
|
33
|
+
s(a(g), {
|
|
34
|
+
class: "text-blue",
|
|
41
35
|
loader: {
|
|
42
|
-
...
|
|
36
|
+
...a(c),
|
|
43
37
|
isLoading: !0
|
|
44
38
|
},
|
|
45
39
|
size: "lg"
|
|
46
40
|
}, null, 8, ["loader"]),
|
|
47
|
-
|
|
48
|
-
])) :
|
|
49
|
-
e.uploadState.type === "done" ? (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
])) :
|
|
53
|
-
e.uploadState.type === "error" ? (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
])) :
|
|
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)
|
|
57
51
|
], 2));
|
|
58
52
|
}
|
|
59
53
|
});
|
|
60
54
|
export {
|
|
61
|
-
|
|
55
|
+
V as default
|
|
62
56
|
};
|
|
@@ -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) => Promise<{
|
|
16
|
+
uploadTempDocument: (document: string, isAgent?: boolean) => Promise<{
|
|
17
17
|
url: string;
|
|
18
18
|
namespace: string;
|
|
19
19
|
slug: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as d } from "vue";
|
|
2
2
|
import { z as o } from "zod/mini";
|
|
3
|
-
import { useState as
|
|
3
|
+
import { useState as g } from "../state/state.js";
|
|
4
4
|
const u = "scalar-tmp-doc";
|
|
5
|
-
function
|
|
5
|
+
function f({ namespace: t, slug: e }) {
|
|
6
6
|
localStorage.setItem(u, JSON.stringify({ namespace: t, slug: e }));
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function h() {
|
|
9
9
|
const t = localStorage.getItem(u);
|
|
10
10
|
if (t)
|
|
11
11
|
return o.object({
|
|
@@ -13,31 +13,31 @@ function v() {
|
|
|
13
13
|
slug: o.string()
|
|
14
14
|
}).parse(JSON.parse(t));
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const t =
|
|
18
|
-
function c(
|
|
19
|
-
const a = `${t.baseUrl}${
|
|
16
|
+
function T() {
|
|
17
|
+
const t = g(), e = d();
|
|
18
|
+
function c(n) {
|
|
19
|
+
const a = `${t.baseUrl}${n}`;
|
|
20
20
|
if (a.startsWith("/")) return a;
|
|
21
|
-
const
|
|
22
|
-
return new URL(`https://proxy.scalar.com/?${
|
|
21
|
+
const s = new URLSearchParams({ scalar_url: a.toString() });
|
|
22
|
+
return new URL(`https://proxy.scalar.com/?${s}`);
|
|
23
23
|
}
|
|
24
|
-
async function l(
|
|
24
|
+
async function l(n, a = !1) {
|
|
25
25
|
try {
|
|
26
26
|
e.value = { type: "uploading" };
|
|
27
|
-
const
|
|
27
|
+
const s = await fetch(c(`/core/share/upload/apis${a ? "?source=agent" : ""}`), {
|
|
28
28
|
method: "POST",
|
|
29
29
|
headers: { "Content-Type": "application/json" },
|
|
30
|
-
body: JSON.stringify({ document:
|
|
30
|
+
body: JSON.stringify({ document: n })
|
|
31
31
|
});
|
|
32
|
-
if (!
|
|
32
|
+
if (!s.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
|
|
40
|
-
if (!
|
|
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) {
|
|
41
41
|
e.value = {
|
|
42
42
|
type: "error",
|
|
43
43
|
error: "Failed to process document."
|
|
@@ -47,20 +47,20 @@ function h() {
|
|
|
47
47
|
e.value = {
|
|
48
48
|
type: "processing"
|
|
49
49
|
};
|
|
50
|
-
const
|
|
50
|
+
const m = await fetch(
|
|
51
51
|
c(`/vector/registry/embeddings/${r.namespace}/${r.slug}`),
|
|
52
52
|
{
|
|
53
53
|
method: "GET"
|
|
54
54
|
}
|
|
55
55
|
);
|
|
56
|
-
if (
|
|
56
|
+
if (f({
|
|
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
|
-
}), !
|
|
63
|
+
}), !m.ok) {
|
|
64
64
|
e.value = {
|
|
65
65
|
type: "error",
|
|
66
66
|
error: "Failed to embed document."
|
|
@@ -81,6 +81,6 @@ function h() {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
export {
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
h as getTmpDocFromLocalStorage,
|
|
85
|
+
T as useUploadTmpDocument
|
|
86
86
|
};
|
package/dist/package.json
CHANGED
package/dist/state/state.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ type State = {
|
|
|
69
69
|
curatedDocuments: Ref<ApiMetadata[]>;
|
|
70
70
|
getActiveDocumentJson?: () => string;
|
|
71
71
|
};
|
|
72
|
-
export declare function createState({ initialRegistryDocuments, registryUrl, dashboardUrl, baseUrl, mode, getAccessToken, getAgentKey, getActiveDocumentJson, }: {
|
|
72
|
+
export declare function createState({ initialRegistryDocuments, registryUrl, dashboardUrl, baseUrl, mode, getAccessToken, getAgentKey, getActiveDocumentJson, prefilledMessageRef, }: {
|
|
73
73
|
initialRegistryDocuments: {
|
|
74
74
|
namespace: string;
|
|
75
75
|
slug: string;
|
|
@@ -81,6 +81,7 @@ export declare function createState({ initialRegistryDocuments, registryUrl, das
|
|
|
81
81
|
getAccessToken?: () => string;
|
|
82
82
|
getAgentKey?: () => string;
|
|
83
83
|
getActiveDocumentJson?: () => string;
|
|
84
|
+
prefilledMessageRef?: Ref<string>;
|
|
84
85
|
}): State;
|
|
85
86
|
export declare function useState(): State;
|
|
86
87
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,KAAK,UAAU,EAAY,MAAM,oBAAoB,CAAA;AAC9D,OAAO,EAAE,KAAK,4BAA4B,EAAmC,MAAM,6BAA6B,CAAA;AAChH,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,gCAAgC,CAAA;AAC1F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EAEf,MAAM,IAAI,CAAA;AACX,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,GAAG,EAAgC,MAAM,KAAK,CAAA;AAEjG,OAAO,EAAE,KAAK,GAAG,EAAyC,MAAM,OAAO,CAAA;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,KAAK,EACV,gCAAgC,EAChC,yBAAyB,EAC1B,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EACV,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EACV,mCAAmC,EACnC,gCAAgC,EACjC,MAAM,2CAA2C,CAAA;AAKlD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAA;IAC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