@scalar/agent-chat 0.4.4 → 0.4.6

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 (34) hide show
  1. package/dist/App.vue.d.ts +2 -0
  2. package/dist/App.vue.d.ts.map +1 -1
  3. package/dist/App.vue.js +9 -7
  4. package/dist/components/ApprovalSection.vue.d.ts.map +1 -1
  5. package/dist/components/ApprovalSection.vue.js +1 -1
  6. package/dist/components/ErrorMessage.vue.d.ts.map +1 -1
  7. package/dist/components/ErrorMessage.vue.js +2 -2
  8. package/dist/components/ErrorMessage.vue2.js +12 -9
  9. package/dist/components/FreeMessagesInfoSection.vue.d.ts +3 -0
  10. package/dist/components/FreeMessagesInfoSection.vue.d.ts.map +1 -0
  11. package/dist/components/FreeMessagesInfoSection.vue.js +7 -0
  12. package/dist/components/FreeMessagesInfoSection.vue2.js +49 -0
  13. package/dist/components/PaymentSection.vue.d.ts.map +1 -1
  14. package/dist/components/PaymentSection.vue.js +2 -2
  15. package/dist/components/PaymentSection.vue2.js +13 -13
  16. package/dist/components/UploadSection.vue.d.ts.map +1 -1
  17. package/dist/components/UploadSection.vue.js +2 -2
  18. package/dist/components/UploadSection.vue2.js +31 -37
  19. package/dist/hooks/use-upload-tmp-document.d.ts +1 -1
  20. package/dist/hooks/use-upload-tmp-document.js +21 -21
  21. package/dist/package.json +1 -1
  22. package/dist/state/state.d.ts +2 -1
  23. package/dist/state/state.d.ts.map +1 -1
  24. package/dist/state/state.js +94 -91
  25. package/dist/style.css +1 -1
  26. package/dist/views/Chat/Chat.vue.js +1 -1
  27. package/dist/views/PromptForm.vue.d.ts.map +1 -1
  28. package/dist/views/PromptForm.vue.js +1 -1
  29. package/dist/views/PromptForm.vue2.js +189 -187
  30. package/dist/views/Settings/DocSettings.vue.js +2 -2
  31. package/dist/views/Settings/DocSettings.vue2.js +7 -7
  32. package/dist/views/Start.vue.d.ts.map +1 -1
  33. package/dist/views/Start.vue.js +2 -2
  34. package/package.json +8 -8
@@ -1,124 +1,127 @@
1
- import { Chat as W } from "@ai-sdk/vue";
2
- import { useModal as b } from "@scalar/components";
3
- import { apiReferenceConfigurationSchema as k } from "@scalar/types/api-reference";
4
- import { createWorkspaceStore as L } from "@scalar/workspace-store/client";
5
- import { createWorkspaceEventBus as N } from "@scalar/workspace-store/events";
6
- import { DefaultChatTransport as O, lastAssistantMessageIsCompleteWithApprovalResponses as R } from "ai";
7
- import { ref as s, computed as y, watch as Y, inject as _ } from "vue";
8
- import { createApi as j, createAuthorizationHeaders as z } from "../api.js";
9
- import { createDocumentSettings as H, makeScalarProxyUrl as I } from "../helpers.js";
10
- import { useTermsAndConditions as P } from "../hooks/use-term-and-conditions.js";
11
- import { loadDocument as U } from "../registry/add-documents-to-store.js";
12
- import { createDocumentName as $ } from "../registry/create-document-name.js";
13
- const q = /* @__PURE__ */ Symbol("STATE_SYMBOL");
14
- function F({
15
- registryDocuments: o,
1
+ import { Chat as k } from "@ai-sdk/vue";
2
+ import { useModal as L } from "@scalar/components";
3
+ import { apiReferenceConfigurationSchema as N } from "@scalar/types/api-reference";
4
+ import { createWorkspaceStore as O } from "@scalar/workspace-store/client";
5
+ import { createWorkspaceEventBus as Y } from "@scalar/workspace-store/events";
6
+ import { DefaultChatTransport as _, lastAssistantMessageIsCompleteWithApprovalResponses as j } from "ai";
7
+ import { ref as s, computed as x, watch as C, inject as z } from "vue";
8
+ import { createApi as H, createAuthorizationHeaders as I } from "../api.js";
9
+ import { createDocumentSettings as P, makeScalarProxyUrl as U } from "../helpers.js";
10
+ import { useTermsAndConditions as $ } from "../hooks/use-term-and-conditions.js";
11
+ import { loadDocument as q } from "../registry/add-documents-to-store.js";
12
+ import { createDocumentName as F } from "../registry/create-document-name.js";
13
+ const G = /* @__PURE__ */ Symbol("STATE_SYMBOL");
14
+ function J({
15
+ registryDocuments: r,
16
16
  workspaceStore: c,
17
- baseUrl: u,
17
+ baseUrl: p,
18
18
  getAccessToken: n,
19
- getAgentKey: p
19
+ getAgentKey: f
20
20
  }) {
21
- return new W({
22
- sendAutomaticallyWhen: R,
23
- transport: new O({
24
- api: I(`${u}/vector/openapi/chat`),
25
- headers: () => z({ getAccessToken: n, getAgentKey: p }),
21
+ return new k({
22
+ sendAutomaticallyWhen: j,
23
+ transport: new _({
24
+ api: U(`${p}/vector/openapi/chat`),
25
+ headers: () => I({ getAccessToken: n, getAgentKey: f }),
26
26
  body: () => ({
27
- registryDocuments: o.value,
28
- documentSettings: H(c)
27
+ registryDocuments: r.value,
28
+ documentSettings: P(c)
29
29
  })
30
30
  })
31
31
  });
32
32
  }
33
- function st({
34
- initialRegistryDocuments: o,
33
+ function ct({
34
+ initialRegistryDocuments: r,
35
35
  registryUrl: c,
36
- dashboardUrl: u,
36
+ dashboardUrl: p,
37
37
  baseUrl: n,
38
- mode: p,
39
- getAccessToken: f,
40
- getAgentKey: l,
41
- getActiveDocumentJson: w
38
+ mode: f,
39
+ getAccessToken: l,
40
+ getAgentKey: d,
41
+ getActiveDocumentJson: A,
42
+ prefilledMessageRef: h
42
43
  }) {
43
- const d = s(""), r = s([]), x = s([]), h = s("https://proxy.scalar.com"), C = s(), M = P(), A = N(), m = L(), v = y(
44
- () => k.parse({
45
- proxyUrl: h.value,
44
+ const m = s(h?.value ?? ""), a = s([]), E = s([]), v = s("https://proxy.scalar.com"), M = s(), D = $(), T = Y(), i = O(), S = x(
45
+ () => N.parse({
46
+ proxyUrl: v.value,
46
47
  persistAuth: !0
47
48
  })
48
- ), a = F({
49
- registryDocuments: r,
50
- workspaceStore: m,
49
+ ), e = J({
50
+ registryDocuments: a,
51
+ workspaceStore: i,
51
52
  baseUrl: n,
52
- getAccessToken: f,
53
- getAgentKey: l
54
- }), D = j({
53
+ getAccessToken: l,
54
+ getAgentKey: d
55
+ }), y = H({
55
56
  baseUrl: n,
56
- getAccessToken: f,
57
- getAgentKey: l
58
- }), E = y(
59
- () => a.status === "submitted" || a.status === "streaming" && !a.lastMessage?.parts.some((t) => t.type === "text")
57
+ getAccessToken: l,
58
+ getAgentKey: d
59
+ }), B = x(
60
+ () => e.status === "submitted" || e.status === "streaming" && !e.lastMessage?.parts.some((t) => t.type === "text")
60
61
  );
61
- Y(
62
- () => a.status,
62
+ C(
63
+ () => e.status,
63
64
  () => {
64
- a.status === "streaming" && (d.value = "");
65
+ e.status === "streaming" && (m.value = "");
65
66
  }
66
- );
67
- const T = b();
68
- async function S({
67
+ ), h && C(h, async (t) => {
68
+ t && (m.value = t, D.accepted.value && await e.sendMessage({ text: m.value }));
69
+ });
70
+ const W = L();
71
+ async function w({
69
72
  namespace: t,
70
- slug: e,
71
- removable: i = !0
73
+ slug: o,
74
+ removable: u = !0
72
75
  }) {
73
- r.value.find((g) => g.namespace === t && g.slug === e) || await U({
76
+ a.value.find((g) => g.namespace === t && g.slug === o) || await q({
74
77
  namespace: t,
75
- slug: e,
76
- workspaceStore: m,
78
+ slug: o,
79
+ workspaceStore: i,
77
80
  registryUrl: c,
78
- registryDocuments: r,
79
- config: v.value,
80
- api: D,
81
- removable: i
81
+ registryDocuments: a,
82
+ config: S.value,
83
+ api: y,
84
+ removable: u
82
85
  });
83
86
  }
84
- function B({ namespace: t, slug: e }) {
85
- r.value = r.value.filter(
86
- (i) => !(i.namespace === t && i.slug === e)
87
- ), m.deleteDocument($(t, e));
87
+ function b({ namespace: t, slug: o }) {
88
+ a.value = a.value.filter(
89
+ (u) => !(u.namespace === t && u.slug === o)
90
+ ), i.deleteDocument(F(t, o));
88
91
  }
89
- return o.forEach(({ namespace: t, slug: e }) => S({ namespace: t, slug: e, removable: !1 })), {
90
- prompt: d,
91
- chat: a,
92
- workspaceStore: m,
93
- eventBus: A,
94
- loading: E,
95
- settingsModal: T,
96
- config: v,
92
+ return r.forEach(({ namespace: t, slug: o }) => w({ namespace: t, slug: o, removable: !1 })), {
93
+ prompt: m,
94
+ chat: e,
95
+ workspaceStore: i,
96
+ eventBus: T,
97
+ loading: B,
98
+ settingsModal: W,
99
+ config: S,
97
100
  registryUrl: c,
98
- dashboardUrl: u,
101
+ dashboardUrl: p,
99
102
  baseUrl: n,
100
- registryDocuments: r,
101
- proxyUrl: h,
102
- mode: p,
103
- terms: M,
104
- addDocument: S,
105
- removeDocument: B,
106
- getAccessToken: f,
107
- getAgentKey: l,
108
- api: D,
109
- uploadedTmpDocumentUrl: C,
110
- curatedDocuments: x,
111
- getActiveDocumentJson: w
103
+ registryDocuments: a,
104
+ proxyUrl: v,
105
+ mode: f,
106
+ terms: D,
107
+ addDocument: w,
108
+ removeDocument: b,
109
+ getAccessToken: l,
110
+ getAgentKey: d,
111
+ api: y,
112
+ uploadedTmpDocumentUrl: M,
113
+ curatedDocuments: E,
114
+ getActiveDocumentJson: A
112
115
  };
113
116
  }
114
- function ct() {
115
- const o = _(q);
116
- if (!o)
117
+ function mt() {
118
+ const r = z(G);
119
+ if (!r)
117
120
  throw new Error("No state provided.");
118
- return o;
121
+ return r;
119
122
  }
120
123
  export {
121
- q as STATE_SYMBOL,
122
- st as createState,
123
- ct as useState
124
+ G as STATE_SYMBOL,
125
+ ct as createState,
126
+ mt as useState
124
127
  };