@budibase/frontend-core 3.10.4 → 3.10.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/package.json +2 -2
- package/src/api/agents.ts +36 -0
- package/src/api/index.ts +2 -0
- package/src/api/types.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.6",
|
|
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": "f1e8fdc36892d9bfedeea3c5148433c4bfcc6bdf"
|
|
21
21
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentChat,
|
|
3
|
+
ChatAgentRequest,
|
|
4
|
+
ChatAgentResponse,
|
|
5
|
+
FetchAgentHistoryResponse,
|
|
6
|
+
} from "@budibase/types"
|
|
7
|
+
import { BaseAPIClient } from "./types"
|
|
8
|
+
|
|
9
|
+
export interface AgentEndpoints {
|
|
10
|
+
agentChat: (chat: AgentChat) => Promise<ChatAgentResponse>
|
|
11
|
+
|
|
12
|
+
removeChat: (historyId: string) => Promise<void>
|
|
13
|
+
fetchChats: () => Promise<FetchAgentHistoryResponse>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
17
|
+
agentChat: async chat => {
|
|
18
|
+
const body: ChatAgentRequest = chat
|
|
19
|
+
return await API.post({
|
|
20
|
+
url: "/api/agent/chat",
|
|
21
|
+
body,
|
|
22
|
+
})
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
removeChat: async (historyId: string) => {
|
|
26
|
+
return await API.delete({
|
|
27
|
+
url: `/api/agent/history/${historyId}`,
|
|
28
|
+
})
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
fetchChats: async () => {
|
|
32
|
+
return await API.get({
|
|
33
|
+
url: "/api/agent/history",
|
|
34
|
+
})
|
|
35
|
+
},
|
|
36
|
+
})
|
package/src/api/index.ts
CHANGED
|
@@ -46,6 +46,7 @@ import { buildLogsEndpoints } from "./logs"
|
|
|
46
46
|
import { buildMigrationEndpoints } from "./migrations"
|
|
47
47
|
import { buildRowActionEndpoints } from "./rowActions"
|
|
48
48
|
import { buildOAuth2Endpoints } from "./oauth2"
|
|
49
|
+
import { buildAgentEndpoints } from "./agents"
|
|
49
50
|
import { buildFeatureFlagEndpoints } from "./features"
|
|
50
51
|
|
|
51
52
|
export type { APIClient } from "./types"
|
|
@@ -290,6 +291,7 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
|
|
|
290
291
|
...buildAuditLogEndpoints(API),
|
|
291
292
|
...buildLogsEndpoints(API),
|
|
292
293
|
...buildMigrationEndpoints(API),
|
|
294
|
+
...buildAgentEndpoints(API),
|
|
293
295
|
...buildFeatureFlagEndpoints(API),
|
|
294
296
|
viewV2: buildViewV2Endpoints(API),
|
|
295
297
|
rowActions: buildRowActionEndpoints(API),
|
package/src/api/types.ts
CHANGED
|
@@ -34,6 +34,7 @@ import { TemplateEndpoints } from "./templates"
|
|
|
34
34
|
import { UserEndpoints } from "./user"
|
|
35
35
|
import { ViewEndpoints } from "./views"
|
|
36
36
|
import { ViewV2Endpoints } from "./viewsV2"
|
|
37
|
+
import { AgentEndpoints } from "./agents"
|
|
37
38
|
|
|
38
39
|
export enum HTTPMethod {
|
|
39
40
|
POST = "POST",
|
|
@@ -104,6 +105,7 @@ export type APIError = {
|
|
|
104
105
|
|
|
105
106
|
export type APIClient = BaseAPIClient &
|
|
106
107
|
AIEndpoints &
|
|
108
|
+
AgentEndpoints &
|
|
107
109
|
AnalyticsEndpoints &
|
|
108
110
|
AppEndpoints &
|
|
109
111
|
AttachmentEndpoints &
|