@budibase/frontend-core 3.23.13 → 3.23.14
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "3.23.
|
|
3
|
+
"version": "3.23.14",
|
|
4
4
|
"description": "Budibase frontend core libraries used in builder and client",
|
|
5
5
|
"author": "Budibase",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"shortid": "2.2.15",
|
|
18
18
|
"socket.io-client": "^4.7.5"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "076dc882e32d6489e874c7b3764ee670907414d0"
|
|
21
21
|
}
|
package/src/api/agents.ts
CHANGED
|
@@ -3,9 +3,14 @@ import {
|
|
|
3
3
|
AgentToolSource,
|
|
4
4
|
AgentToolSourceWithTools,
|
|
5
5
|
ChatAgentRequest,
|
|
6
|
+
CreateAgentRequest,
|
|
7
|
+
CreateAgentResponse,
|
|
6
8
|
CreateToolSourceRequest,
|
|
7
9
|
FetchAgentHistoryResponse,
|
|
10
|
+
FetchAgentsResponse,
|
|
8
11
|
LLMStreamChunk,
|
|
12
|
+
UpdateAgentRequest,
|
|
13
|
+
UpdateAgentResponse,
|
|
9
14
|
} from "@budibase/types"
|
|
10
15
|
|
|
11
16
|
import { Header } from "@budibase/shared-core"
|
|
@@ -19,15 +24,19 @@ export interface AgentEndpoints {
|
|
|
19
24
|
onError?: (error: Error) => void
|
|
20
25
|
) => Promise<void>
|
|
21
26
|
|
|
22
|
-
removeChat: (
|
|
23
|
-
fetchChats: () => Promise<FetchAgentHistoryResponse>
|
|
27
|
+
removeChat: (chatId: string) => Promise<void>
|
|
28
|
+
fetchChats: (agentId: string) => Promise<FetchAgentHistoryResponse>
|
|
24
29
|
|
|
25
|
-
fetchToolSources: () => Promise<AgentToolSourceWithTools[]>
|
|
30
|
+
fetchToolSources: (agentId: string) => Promise<AgentToolSourceWithTools[]>
|
|
26
31
|
createToolSource: (
|
|
27
32
|
toolSource: CreateToolSourceRequest
|
|
28
33
|
) => Promise<{ created: true }>
|
|
29
34
|
updateToolSource: (toolSource: AgentToolSource) => Promise<AgentToolSource>
|
|
30
35
|
deleteToolSource: (toolSourceId: string) => Promise<{ deleted: true }>
|
|
36
|
+
fetchAgents: () => Promise<FetchAgentsResponse>
|
|
37
|
+
createAgent: (agent: CreateAgentRequest) => Promise<CreateAgentResponse>
|
|
38
|
+
updateAgent: (agent: UpdateAgentRequest) => Promise<UpdateAgentResponse>
|
|
39
|
+
deleteAgent: (agentId: string) => Promise<{ deleted: true }>
|
|
31
40
|
}
|
|
32
41
|
|
|
33
42
|
export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
@@ -98,21 +107,21 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
|
98
107
|
}
|
|
99
108
|
},
|
|
100
109
|
|
|
101
|
-
removeChat: async (
|
|
110
|
+
removeChat: async (chatId: string) => {
|
|
102
111
|
return await API.delete({
|
|
103
|
-
url: `/api/agent/
|
|
112
|
+
url: `/api/agent/chats/${chatId}`,
|
|
104
113
|
})
|
|
105
114
|
},
|
|
106
115
|
|
|
107
|
-
fetchChats: async () => {
|
|
116
|
+
fetchChats: async (agentId: string) => {
|
|
108
117
|
return await API.get({
|
|
109
|
-
url:
|
|
118
|
+
url: `/api/agent/${agentId}/chats`,
|
|
110
119
|
})
|
|
111
120
|
},
|
|
112
121
|
|
|
113
|
-
fetchToolSources: async () => {
|
|
122
|
+
fetchToolSources: async (agentId: string) => {
|
|
114
123
|
return await API.get({
|
|
115
|
-
url:
|
|
124
|
+
url: `/api/agent/${agentId}/toolsource`,
|
|
116
125
|
})
|
|
117
126
|
},
|
|
118
127
|
|
|
@@ -135,4 +144,30 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
|
135
144
|
url: `/api/agent/toolsource/${toolSourceId}`,
|
|
136
145
|
})
|
|
137
146
|
},
|
|
147
|
+
|
|
148
|
+
fetchAgents: async () => {
|
|
149
|
+
return await API.get({
|
|
150
|
+
url: "/api/agent",
|
|
151
|
+
})
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
createAgent: async (agent: CreateAgentRequest) => {
|
|
155
|
+
return await API.post({
|
|
156
|
+
url: "/api/agent",
|
|
157
|
+
body: agent,
|
|
158
|
+
})
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
updateAgent: async (agent: UpdateAgentRequest) => {
|
|
162
|
+
return await API.put({
|
|
163
|
+
url: "/api/agent",
|
|
164
|
+
body: agent,
|
|
165
|
+
})
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
deleteAgent: async (agentId: string) => {
|
|
169
|
+
return await API.delete({
|
|
170
|
+
url: `/api/agent/${agentId}`,
|
|
171
|
+
})
|
|
172
|
+
},
|
|
138
173
|
})
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
export let workspaceId: string
|
|
14
14
|
export let chat: AgentChat
|
|
15
|
+
export let loading: boolean = false
|
|
15
16
|
|
|
16
17
|
const dispatch = createEventDispatcher<{ chatSaved: { chatId: string } }>()
|
|
17
18
|
|
|
18
19
|
let inputValue = ""
|
|
19
|
-
let loading: boolean = false
|
|
20
20
|
let chatAreaElement: HTMLDivElement
|
|
21
21
|
let observer: MutationObserver
|
|
22
22
|
let textareaElement: HTMLTextAreaElement
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
async function prompt() {
|
|
43
43
|
if (!chat) {
|
|
44
|
-
chat = { title: "", messages: [] }
|
|
44
|
+
chat = { title: "", messages: [], agentId: "" }
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const userMessage: UserMessage = { role: "user", content: inputValue }
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
onMount(async () => {
|
|
173
|
-
chat = { title: "", messages: [] }
|
|
173
|
+
chat = { title: "", messages: [], agentId: chat.agentId }
|
|
174
174
|
|
|
175
175
|
// Ensure we always autoscroll to reveal new messages
|
|
176
176
|
observer = new MutationObserver(async () => {
|