@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.
- 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/state/state.js
CHANGED
|
@@ -1,124 +1,127 @@
|
|
|
1
|
-
import { Chat as
|
|
2
|
-
import { useModal as
|
|
3
|
-
import { apiReferenceConfigurationSchema as
|
|
4
|
-
import { createWorkspaceStore as
|
|
5
|
-
import { createWorkspaceEventBus as
|
|
6
|
-
import { DefaultChatTransport as
|
|
7
|
-
import { ref as s, computed as
|
|
8
|
-
import { createApi as
|
|
9
|
-
import { createDocumentSettings as
|
|
10
|
-
import { useTermsAndConditions as
|
|
11
|
-
import { loadDocument as
|
|
12
|
-
import { createDocumentName as
|
|
13
|
-
const
|
|
14
|
-
function
|
|
15
|
-
registryDocuments:
|
|
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:
|
|
17
|
+
baseUrl: p,
|
|
18
18
|
getAccessToken: n,
|
|
19
|
-
getAgentKey:
|
|
19
|
+
getAgentKey: f
|
|
20
20
|
}) {
|
|
21
|
-
return new
|
|
22
|
-
sendAutomaticallyWhen:
|
|
23
|
-
transport: new
|
|
24
|
-
api:
|
|
25
|
-
headers: () =>
|
|
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:
|
|
28
|
-
documentSettings:
|
|
27
|
+
registryDocuments: r.value,
|
|
28
|
+
documentSettings: P(c)
|
|
29
29
|
})
|
|
30
30
|
})
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
initialRegistryDocuments:
|
|
33
|
+
function ct({
|
|
34
|
+
initialRegistryDocuments: r,
|
|
35
35
|
registryUrl: c,
|
|
36
|
-
dashboardUrl:
|
|
36
|
+
dashboardUrl: p,
|
|
37
37
|
baseUrl: n,
|
|
38
|
-
mode:
|
|
39
|
-
getAccessToken:
|
|
40
|
-
getAgentKey:
|
|
41
|
-
getActiveDocumentJson:
|
|
38
|
+
mode: f,
|
|
39
|
+
getAccessToken: l,
|
|
40
|
+
getAgentKey: d,
|
|
41
|
+
getActiveDocumentJson: A,
|
|
42
|
+
prefilledMessageRef: h
|
|
42
43
|
}) {
|
|
43
|
-
const
|
|
44
|
-
() =>
|
|
45
|
-
proxyUrl:
|
|
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
|
-
),
|
|
49
|
-
registryDocuments:
|
|
50
|
-
workspaceStore:
|
|
49
|
+
), e = J({
|
|
50
|
+
registryDocuments: a,
|
|
51
|
+
workspaceStore: i,
|
|
51
52
|
baseUrl: n,
|
|
52
|
-
getAccessToken:
|
|
53
|
-
getAgentKey:
|
|
54
|
-
}),
|
|
53
|
+
getAccessToken: l,
|
|
54
|
+
getAgentKey: d
|
|
55
|
+
}), y = H({
|
|
55
56
|
baseUrl: n,
|
|
56
|
-
getAccessToken:
|
|
57
|
-
getAgentKey:
|
|
58
|
-
}),
|
|
59
|
-
() =>
|
|
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
|
-
|
|
62
|
-
() =>
|
|
62
|
+
C(
|
|
63
|
+
() => e.status,
|
|
63
64
|
() => {
|
|
64
|
-
|
|
65
|
+
e.status === "streaming" && (m.value = "");
|
|
65
66
|
}
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
|
|
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:
|
|
71
|
-
removable:
|
|
73
|
+
slug: o,
|
|
74
|
+
removable: u = !0
|
|
72
75
|
}) {
|
|
73
|
-
|
|
76
|
+
a.value.find((g) => g.namespace === t && g.slug === o) || await q({
|
|
74
77
|
namespace: t,
|
|
75
|
-
slug:
|
|
76
|
-
workspaceStore:
|
|
78
|
+
slug: o,
|
|
79
|
+
workspaceStore: i,
|
|
77
80
|
registryUrl: c,
|
|
78
|
-
registryDocuments:
|
|
79
|
-
config:
|
|
80
|
-
api:
|
|
81
|
-
removable:
|
|
81
|
+
registryDocuments: a,
|
|
82
|
+
config: S.value,
|
|
83
|
+
api: y,
|
|
84
|
+
removable: u
|
|
82
85
|
});
|
|
83
86
|
}
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
(
|
|
87
|
-
),
|
|
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
|
|
90
|
-
prompt:
|
|
91
|
-
chat:
|
|
92
|
-
workspaceStore:
|
|
93
|
-
eventBus:
|
|
94
|
-
loading:
|
|
95
|
-
settingsModal:
|
|
96
|
-
config:
|
|
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:
|
|
101
|
+
dashboardUrl: p,
|
|
99
102
|
baseUrl: n,
|
|
100
|
-
registryDocuments:
|
|
101
|
-
proxyUrl:
|
|
102
|
-
mode:
|
|
103
|
-
terms:
|
|
104
|
-
addDocument:
|
|
105
|
-
removeDocument:
|
|
106
|
-
getAccessToken:
|
|
107
|
-
getAgentKey:
|
|
108
|
-
api:
|
|
109
|
-
uploadedTmpDocumentUrl:
|
|
110
|
-
curatedDocuments:
|
|
111
|
-
getActiveDocumentJson:
|
|
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
|
|
115
|
-
const
|
|
116
|
-
if (!
|
|
117
|
+
function mt() {
|
|
118
|
+
const r = z(G);
|
|
119
|
+
if (!r)
|
|
117
120
|
throw new Error("No state provided.");
|
|
118
|
-
return
|
|
121
|
+
return r;
|
|
119
122
|
}
|
|
120
123
|
export {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
G as STATE_SYMBOL,
|
|
125
|
+
ct as createState,
|
|
126
|
+
mt as useState
|
|
124
127
|
};
|