@agentica/chat 0.10.3 → 0.11.0
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/assets/AgenticaChatApplication-DkstxT-S.js +4072 -0
- package/dist/assets/{OpenApi-CGb-Vryh.js → OpenApi-Dar2k8cb.js} +1 -1
- package/dist/assets/bbs/{index-W3yuE4AY.js → index-BKyXcr4r.js} +1 -1
- package/dist/assets/{index-BIl3c91I.js → index-BHv9GvT-.js} +1 -1
- package/dist/assets/shopping/index.html-CxRAYtIl.js +1 -0
- package/dist/assets/{playground/index.html-qvfdbFE0.js → uploader/index.html-Bsx-chqu.js} +1 -1
- package/dist/bbs/index.html +3 -3
- package/dist/index.html +2 -2
- package/dist/shopping/index.html +4 -4
- package/dist/{playground → uploader}/index.html +4 -4
- package/lib/AgenticaChatApplication.d.ts +2 -1
- package/lib/examples/uploader/AgenticaChatPlaygroundApplication.d.ts +9 -0
- package/lib/examples/uploader/AgenticaChatUploaderMovie.d.ts +7 -0
- package/lib/index.mjs +51 -61
- package/lib/index.mjs.map +1 -1
- package/lib/movies/AgenticaChatMovie.d.ts +2 -1
- package/lib/movies/messages/AgenticaChatDescribeMessageMovie.d.ts +2 -2
- package/lib/movies/messages/AgenticaChatExecuteMessageMovie.d.ts +2 -2
- package/lib/movies/messages/AgenticaChatMessageMovie.d.ts +2 -2
- package/lib/movies/messages/AgenticaChatSelectMessageMovie.d.ts +2 -2
- package/lib/movies/messages/AgenticaChatTextMessageMovie.d.ts +2 -2
- package/lib/movies/sides/AgenticaChatFunctionStackSideMovie.d.ts +2 -2
- package/lib/movies/sides/AgenticaChatSideMovie.d.ts +3 -3
- package/lib/movies/sides/AgenticaChatTokenUsageSideMovie.d.ts +2 -2
- package/package.json +3 -4
- package/src/AgenticaChatApplication.tsx +5 -4
- package/src/movies/AgenticaChatMovie.tsx +54 -62
- package/src/movies/messages/AgenticaChatDescribeMessageMovie.tsx +6 -4
- package/src/movies/messages/AgenticaChatExecuteMessageMovie.tsx +10 -8
- package/src/movies/messages/AgenticaChatMessageMovie.tsx +3 -3
- package/src/movies/messages/AgenticaChatSelectMessageMovie.tsx +9 -7
- package/src/movies/messages/AgenticaChatTextMessageMovie.tsx +2 -2
- package/src/movies/sides/AgenticaChatFunctionStackSideMovie.tsx +11 -7
- package/src/movies/sides/AgenticaChatSideMovie.tsx +4 -4
- package/src/movies/sides/AgenticaChatTokenUsageSideMovie.tsx +3 -3
- package/dist/assets/AgenticaChatApplication-BKEsRS5q.js +0 -4092
- package/dist/assets/shopping/index.html-B7wM1x_y.js +0 -1
- package/lib/examples/playground/AgenticaChatPlaygroundApplication.d.ts +0 -9
- package/lib/examples/playground/AgenticaChatPlaygroundFileUploadMovie.d.ts +0 -7
- /package/lib/examples/{playground → uploader}/index.d.ts +0 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Agentica,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
AgenticaDescribeEvent,
|
|
4
|
+
AgenticaOperationSelection,
|
|
5
|
+
AgenticaPrompt,
|
|
6
|
+
AgenticaSelectEvent,
|
|
7
|
+
AgenticaTextEvent,
|
|
8
|
+
AgenticaTokenUsage,
|
|
7
9
|
} from "@agentica/core";
|
|
8
10
|
import AddAPhotoIcon from "@mui/icons-material/AddAPhoto";
|
|
9
11
|
import ReceiptLongIcon from "@mui/icons-material/ReceiptLong";
|
|
@@ -22,8 +24,7 @@ import {
|
|
|
22
24
|
useTheme,
|
|
23
25
|
} from "@mui/material";
|
|
24
26
|
import { ILlmSchema } from "@samchon/openapi";
|
|
25
|
-
import
|
|
26
|
-
import fileDownload from "js-file-download";
|
|
27
|
+
import { toPng } from "html-to-image";
|
|
27
28
|
import React, { useEffect, useRef, useState } from "react";
|
|
28
29
|
|
|
29
30
|
import { AgenticaChatMessageMovie } from "./messages/AgenticaChatMessageMovie";
|
|
@@ -31,6 +32,7 @@ import { AgenticaChatSideMovie } from "./sides/AgenticaChatSideMovie";
|
|
|
31
32
|
|
|
32
33
|
export const AgenticaChatMovie = <Model extends ILlmSchema.Model>({
|
|
33
34
|
agent,
|
|
35
|
+
title,
|
|
34
36
|
}: AgenticaChatMovie.IProps<Model>) => {
|
|
35
37
|
//----
|
|
36
38
|
// VARIABLES
|
|
@@ -45,16 +47,16 @@ export const AgenticaChatMovie = <Model extends ILlmSchema.Model>({
|
|
|
45
47
|
// STATES
|
|
46
48
|
const [error, setError] = useState<Error | null>(null);
|
|
47
49
|
const [text, setText] = useState("");
|
|
48
|
-
const [histories, setHistories] = useState<
|
|
50
|
+
const [histories, setHistories] = useState<AgenticaPrompt<Model>[]>(
|
|
49
51
|
agent.getPromptHistories().slice(),
|
|
50
52
|
);
|
|
51
|
-
const [tokenUsage, setTokenUsage] = useState<
|
|
53
|
+
const [tokenUsage, setTokenUsage] = useState<AgenticaTokenUsage>(
|
|
52
54
|
JSON.parse(JSON.stringify(agent.getTokenUsage())),
|
|
53
55
|
);
|
|
54
56
|
const [height, setHeight] = useState(122);
|
|
55
57
|
const [enabled, setEnabled] = useState(true);
|
|
56
58
|
const [selections, setSelections] = useState<
|
|
57
|
-
|
|
59
|
+
AgenticaOperationSelection<Model>[]
|
|
58
60
|
>([]);
|
|
59
61
|
const [openSide, setOpenSide] = useState(false);
|
|
60
62
|
|
|
@@ -62,33 +64,21 @@ export const AgenticaChatMovie = <Model extends ILlmSchema.Model>({
|
|
|
62
64
|
// EVENT INTERACTIONS
|
|
63
65
|
//----
|
|
64
66
|
// EVENT LISTENERS
|
|
65
|
-
const handleText = (
|
|
66
|
-
|
|
67
|
+
const handleText = async (event: AgenticaTextEvent) => {
|
|
68
|
+
await event.join(); // @todo Jaxtyn: streaming
|
|
69
|
+
histories.push(event.toPrompt());
|
|
67
70
|
setHistories(histories);
|
|
68
71
|
};
|
|
69
|
-
const handleDescribe = (
|
|
70
|
-
|
|
72
|
+
const handleDescribe = async (event: AgenticaDescribeEvent<Model>) => {
|
|
73
|
+
await event.join(); // @todo Jaxtyn: streaming
|
|
74
|
+
histories.push(event.toPrompt());
|
|
71
75
|
setHistories(histories);
|
|
72
76
|
};
|
|
73
|
-
const handleSelect = (
|
|
74
|
-
histories.push(
|
|
75
|
-
type: "select",
|
|
76
|
-
id: "something",
|
|
77
|
-
operations: [
|
|
78
|
-
{
|
|
79
|
-
...evt.operation,
|
|
80
|
-
reason: evt.reason,
|
|
81
|
-
toJSON: () => ({}) as any,
|
|
82
|
-
} satisfies IAgenticaOperationSelection<Model>,
|
|
83
|
-
],
|
|
84
|
-
});
|
|
77
|
+
const handleSelect = (evevnt: AgenticaSelectEvent<Model>) => {
|
|
78
|
+
histories.push(evevnt.toPrompt());
|
|
85
79
|
setHistories(histories);
|
|
86
80
|
|
|
87
|
-
selections.push(
|
|
88
|
-
...evt.operation,
|
|
89
|
-
reason: evt.reason,
|
|
90
|
-
toJSON: () => ({}) as any,
|
|
91
|
-
} satisfies IAgenticaOperationSelection<Model>);
|
|
81
|
+
selections.push(evevnt.selection);
|
|
92
82
|
setSelections(selections);
|
|
93
83
|
};
|
|
94
84
|
|
|
@@ -148,21 +138,21 @@ export const AgenticaChatMovie = <Model extends ILlmSchema.Model>({
|
|
|
148
138
|
setTokenUsage(agent.getTokenUsage());
|
|
149
139
|
setEnabled(true);
|
|
150
140
|
|
|
151
|
-
const selections:
|
|
141
|
+
const selections: AgenticaOperationSelection<Model>[] = agent
|
|
152
142
|
.getPromptHistories()
|
|
153
143
|
.filter((h) => h.type === "select")
|
|
154
|
-
.map((h) => h.
|
|
144
|
+
.map((h) => h.selections)
|
|
155
145
|
.flat();
|
|
156
146
|
for (const cancel of agent
|
|
157
147
|
.getPromptHistories()
|
|
158
148
|
.filter((h) => h.type === "cancel")
|
|
159
|
-
.map((h) => h.
|
|
149
|
+
.map((h) => h.selections)
|
|
160
150
|
.flat()) {
|
|
161
151
|
const index: number = selections.findIndex(
|
|
162
152
|
(s) =>
|
|
163
|
-
s.protocol === cancel.protocol &&
|
|
164
|
-
s.controller.name === cancel.controller.name &&
|
|
165
|
-
s.function.name === cancel.function.name,
|
|
153
|
+
s.operation.protocol === cancel.operation.protocol &&
|
|
154
|
+
s.operation.controller.name === cancel.operation.controller.name &&
|
|
155
|
+
s.operation.function.name === cancel.operation.function.name,
|
|
166
156
|
);
|
|
167
157
|
if (index !== -1) selections.splice(index, 1);
|
|
168
158
|
}
|
|
@@ -171,20 +161,13 @@ export const AgenticaChatMovie = <Model extends ILlmSchema.Model>({
|
|
|
171
161
|
|
|
172
162
|
const capture = async () => {
|
|
173
163
|
if (bodyContainerRef.current === null) return;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
useCORS: true,
|
|
182
|
-
},
|
|
183
|
-
);
|
|
184
|
-
canvas.toBlob((blob) => {
|
|
185
|
-
if (blob === null) return;
|
|
186
|
-
fileDownload(blob, "nestia-chat-screenshot.png");
|
|
187
|
-
});
|
|
164
|
+
|
|
165
|
+
const dataUrl = await toPng(bodyContainerRef.current, {});
|
|
166
|
+
const link = document.createElement("a");
|
|
167
|
+
link.download = "nestia-chat-screenshot.png";
|
|
168
|
+
link.href = dataUrl;
|
|
169
|
+
link.click();
|
|
170
|
+
link.remove();
|
|
188
171
|
};
|
|
189
172
|
|
|
190
173
|
//----
|
|
@@ -193,22 +176,30 @@ export const AgenticaChatMovie = <Model extends ILlmSchema.Model>({
|
|
|
193
176
|
const theme: Theme = useTheme();
|
|
194
177
|
const isMobile: boolean = useMediaQuery(theme.breakpoints.down("lg"));
|
|
195
178
|
const bodyMovie = (): JSX.Element => (
|
|
196
|
-
<
|
|
197
|
-
ref={bodyContainerRef}
|
|
198
|
-
maxWidth={false}
|
|
179
|
+
<div
|
|
199
180
|
style={{
|
|
200
|
-
|
|
201
|
-
paddingBottom: 50,
|
|
202
|
-
width: isMobile ? "100%" : `calc(100% - ${SIDE_WIDTH}px)`,
|
|
181
|
+
overflowY: "auto",
|
|
203
182
|
height: "100%",
|
|
204
|
-
|
|
183
|
+
width: isMobile ? "100%" : `calc(100% - ${SIDE_WIDTH}px)`,
|
|
184
|
+
margin: 0,
|
|
205
185
|
backgroundColor: "lightblue",
|
|
206
186
|
}}
|
|
207
187
|
>
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
188
|
+
<Container
|
|
189
|
+
style={{
|
|
190
|
+
paddingBottom: 50,
|
|
191
|
+
width: "100%",
|
|
192
|
+
minHeight: "100%",
|
|
193
|
+
backgroundColor: "lightblue",
|
|
194
|
+
margin: 0,
|
|
195
|
+
}}
|
|
196
|
+
ref={bodyContainerRef}
|
|
197
|
+
>
|
|
198
|
+
{histories
|
|
199
|
+
.map((prompt) => <AgenticaChatMessageMovie prompt={prompt} />)
|
|
200
|
+
.filter((elem) => elem !== null)}
|
|
201
|
+
</Container>
|
|
202
|
+
</div>
|
|
212
203
|
);
|
|
213
204
|
const sideMovie = (): JSX.Element => (
|
|
214
205
|
<div
|
|
@@ -239,7 +230,7 @@ export const AgenticaChatMovie = <Model extends ILlmSchema.Model>({
|
|
|
239
230
|
<AppBar ref={upperDivRef} position="relative" component="div">
|
|
240
231
|
<Toolbar>
|
|
241
232
|
<Typography variant="h6" component="div" sx={{ flexGrow: 1 }}>
|
|
242
|
-
Agentica Chatbot
|
|
233
|
+
{title ?? "Agentica Chatbot"}
|
|
243
234
|
</Typography>
|
|
244
235
|
{isMobile ? (
|
|
245
236
|
<>
|
|
@@ -324,6 +315,7 @@ export const AgenticaChatMovie = <Model extends ILlmSchema.Model>({
|
|
|
324
315
|
export namespace AgenticaChatMovie {
|
|
325
316
|
export interface IProps<Model extends ILlmSchema.Model> {
|
|
326
317
|
agent: Agentica<Model>;
|
|
318
|
+
title?: string;
|
|
327
319
|
}
|
|
328
320
|
}
|
|
329
321
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AgenticaDescribePrompt } from "@agentica/core";
|
|
2
2
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
@@ -14,7 +14,9 @@ import { useState } from "react";
|
|
|
14
14
|
import { MarkdownViewer } from "../../components/MarkdownViewer";
|
|
15
15
|
import { AgenticaChatExecuteMessageMovie } from "./AgenticaChatExecuteMessageMovie";
|
|
16
16
|
|
|
17
|
-
export const AgenticaChatDescribeMessageMovie = <
|
|
17
|
+
export const AgenticaChatDescribeMessageMovie = <
|
|
18
|
+
Model extends ILlmSchema.Model,
|
|
19
|
+
>({
|
|
18
20
|
prompt,
|
|
19
21
|
}: AgenticaChatDescribeMessageMovie.IProps<Model>) => {
|
|
20
22
|
const [expanded, setExpanded] = useState(false);
|
|
@@ -47,7 +49,7 @@ export const AgenticaChatDescribeMessageMovie = <Model extends ILlmSchema.Model>
|
|
|
47
49
|
</CardActions>
|
|
48
50
|
<Collapse in={expanded} timeout="auto" unmountOnExit>
|
|
49
51
|
<CardContent>
|
|
50
|
-
{prompt.
|
|
52
|
+
{prompt.executes.map((execute) => (
|
|
51
53
|
<AgenticaChatExecuteMessageMovie execute={execute} />
|
|
52
54
|
))}
|
|
53
55
|
</CardContent>
|
|
@@ -57,6 +59,6 @@ export const AgenticaChatDescribeMessageMovie = <Model extends ILlmSchema.Model>
|
|
|
57
59
|
};
|
|
58
60
|
export namespace AgenticaChatDescribeMessageMovie {
|
|
59
61
|
export interface IProps<Model extends ILlmSchema.Model> {
|
|
60
|
-
prompt:
|
|
62
|
+
prompt: AgenticaDescribePrompt<Model>;
|
|
61
63
|
}
|
|
62
64
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AgenticaExecutePrompt } from "@agentica/core";
|
|
2
2
|
import { Typography } from "@mui/material";
|
|
3
3
|
import { ILlmSchema } from "@samchon/openapi";
|
|
4
4
|
import React from "react";
|
|
5
5
|
|
|
6
6
|
import { MarkdownViewer } from "../../components/MarkdownViewer";
|
|
7
7
|
|
|
8
|
-
export const AgenticaChatExecuteMessageMovie = <
|
|
8
|
+
export const AgenticaChatExecuteMessageMovie = <
|
|
9
|
+
Model extends ILlmSchema.Model,
|
|
10
|
+
>({
|
|
9
11
|
execute,
|
|
10
12
|
}: AgenticaChatExecuteMessageMovie.IProps<Model>) => {
|
|
11
13
|
return (
|
|
@@ -13,7 +15,7 @@ export const AgenticaChatExecuteMessageMovie = <Model extends ILlmSchema.Model>(
|
|
|
13
15
|
<Typography variant="h5"> {getTitle(execute)} </Typography>
|
|
14
16
|
<hr />
|
|
15
17
|
<Typography variant="h6"> Description </Typography>
|
|
16
|
-
<MarkdownViewer>{execute.function.description}</MarkdownViewer>
|
|
18
|
+
<MarkdownViewer>{execute.operation.function.description}</MarkdownViewer>
|
|
17
19
|
<br />
|
|
18
20
|
<Typography variant="h6"> Arguments </Typography>
|
|
19
21
|
<MarkdownViewer>
|
|
@@ -31,13 +33,13 @@ export const AgenticaChatExecuteMessageMovie = <Model extends ILlmSchema.Model>(
|
|
|
31
33
|
};
|
|
32
34
|
export namespace AgenticaChatExecuteMessageMovie {
|
|
33
35
|
export interface IProps<Model extends ILlmSchema.Model> {
|
|
34
|
-
execute:
|
|
36
|
+
execute: AgenticaExecutePrompt<Model>;
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
const getTitle = <Model extends ILlmSchema.Model>(
|
|
39
|
-
exec:
|
|
41
|
+
exec: AgenticaExecutePrompt<Model>,
|
|
40
42
|
) =>
|
|
41
|
-
exec.protocol === "http"
|
|
42
|
-
? `${exec.function.method.toUpperCase()} ${exec.function.path}`
|
|
43
|
-
: exec.function.name;
|
|
43
|
+
exec.operation.protocol === "http"
|
|
44
|
+
? `${exec.operation.function.method.toUpperCase()} ${exec.operation.function.path}`
|
|
45
|
+
: exec.operation.function.name;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AgenticaPrompt } from "@agentica/core";
|
|
2
2
|
import { ILlmSchema } from "@samchon/openapi";
|
|
3
3
|
|
|
4
4
|
import { AgenticaChatDescribeMessageMovie } from "./AgenticaChatDescribeMessageMovie";
|
|
@@ -11,7 +11,7 @@ export const AgenticaChatMessageMovie = <Model extends ILlmSchema.Model>({
|
|
|
11
11
|
if (prompt.type === "text")
|
|
12
12
|
return <AgenticaChatTextMessageMovie prompt={prompt} />;
|
|
13
13
|
else if (prompt.type === "select")
|
|
14
|
-
return prompt.
|
|
14
|
+
return prompt.selections.map((selection) => (
|
|
15
15
|
<AgenticaChatSelectMessageMovie selection={selection} />
|
|
16
16
|
));
|
|
17
17
|
else if (prompt.type === "describe")
|
|
@@ -20,6 +20,6 @@ export const AgenticaChatMessageMovie = <Model extends ILlmSchema.Model>({
|
|
|
20
20
|
};
|
|
21
21
|
export namespace AgenticaChatMessageMovie {
|
|
22
22
|
export interface IProps<Model extends ILlmSchema.Model> {
|
|
23
|
-
prompt:
|
|
23
|
+
prompt: AgenticaPrompt<Model>;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AgenticaOperationSelection } from "@agentica/core";
|
|
2
2
|
import GradingIcon from "@mui/icons-material/Grading";
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
@@ -36,14 +36,14 @@ export const AgenticaChatSelectMessageMovie = <Model extends ILlmSchema.Model>({
|
|
|
36
36
|
<br />
|
|
37
37
|
<br />
|
|
38
38
|
Operation:
|
|
39
|
-
{selection.protocol === "http" ? (
|
|
39
|
+
{selection.operation.protocol === "http" ? (
|
|
40
40
|
<ul>
|
|
41
|
-
<li>{selection.function.method.toUpperCase()}</li>
|
|
42
|
-
<li>{selection.function.path}</li>
|
|
41
|
+
<li>{selection.operation.function.method.toUpperCase()}</li>
|
|
42
|
+
<li>{selection.operation.function.path}</li>
|
|
43
43
|
</ul>
|
|
44
44
|
) : (
|
|
45
45
|
<ul>
|
|
46
|
-
<li>{selection.function.name}</li>
|
|
46
|
+
<li>{selection.operation.function.name}</li>
|
|
47
47
|
</ul>
|
|
48
48
|
)}
|
|
49
49
|
<MarkdownViewer>{selection.reason}</MarkdownViewer>
|
|
@@ -55,7 +55,9 @@ export const AgenticaChatSelectMessageMovie = <Model extends ILlmSchema.Model>({
|
|
|
55
55
|
</CardActions>
|
|
56
56
|
<Collapse in={expanded} timeout="auto" unmountOnExit>
|
|
57
57
|
<CardContent>
|
|
58
|
-
<MarkdownViewer>
|
|
58
|
+
<MarkdownViewer>
|
|
59
|
+
{selection.operation.function.description}
|
|
60
|
+
</MarkdownViewer>
|
|
59
61
|
</CardContent>
|
|
60
62
|
</Collapse>
|
|
61
63
|
</Card>
|
|
@@ -63,6 +65,6 @@ export const AgenticaChatSelectMessageMovie = <Model extends ILlmSchema.Model>({
|
|
|
63
65
|
};
|
|
64
66
|
export namespace AgenticaChatSelectMessageMovie {
|
|
65
67
|
export interface IProps<Model extends ILlmSchema.Model> {
|
|
66
|
-
selection:
|
|
68
|
+
selection: AgenticaOperationSelection<Model>;
|
|
67
69
|
}
|
|
68
70
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AgenticaTextPrompt } from "@agentica/core";
|
|
2
2
|
import FaceIcon from "@mui/icons-material/Face";
|
|
3
3
|
import SmartToyIcon from "@mui/icons-material/SmartToy";
|
|
4
4
|
import { Card, CardContent, Chip } from "@mui/material";
|
|
@@ -41,6 +41,6 @@ export const AgenticaChatTextMessageMovie = ({
|
|
|
41
41
|
};
|
|
42
42
|
export namespace AgenticaChatTextMessageMovie {
|
|
43
43
|
export interface IProps {
|
|
44
|
-
prompt:
|
|
44
|
+
prompt: AgenticaTextPrompt;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AgenticaOperationSelection } from "@agentica/core";
|
|
2
2
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
3
3
|
import {
|
|
4
4
|
Accordion,
|
|
@@ -11,7 +11,9 @@ import React from "react";
|
|
|
11
11
|
|
|
12
12
|
import { MarkdownViewer } from "../../components/MarkdownViewer";
|
|
13
13
|
|
|
14
|
-
export const AgenticaChatFunctionStackSideMovie = <
|
|
14
|
+
export const AgenticaChatFunctionStackSideMovie = <
|
|
15
|
+
Model extends ILlmSchema.Model,
|
|
16
|
+
>(
|
|
15
17
|
props: AgenticaChatFunctionStackSideMovie.IProps<Model>,
|
|
16
18
|
) => {
|
|
17
19
|
return (
|
|
@@ -22,9 +24,9 @@ export const AgenticaChatFunctionStackSideMovie = <Model extends ILlmSchema.Mode
|
|
|
22
24
|
<Accordion>
|
|
23
25
|
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
|
|
24
26
|
<Typography component="h6">
|
|
25
|
-
{select.protocol === "http"
|
|
26
|
-
? `${select.function.method.toUpperCase()} ${select.function.path}`
|
|
27
|
-
: select.function.name}
|
|
27
|
+
{select.operation.protocol === "http"
|
|
28
|
+
? `${select.operation.function.method.toUpperCase()} ${select.operation.function.path}`
|
|
29
|
+
: select.operation.function.name}
|
|
28
30
|
</Typography>
|
|
29
31
|
</AccordionSummary>
|
|
30
32
|
<AccordionDetails>
|
|
@@ -32,7 +34,9 @@ export const AgenticaChatFunctionStackSideMovie = <Model extends ILlmSchema.Mode
|
|
|
32
34
|
{select.reason}
|
|
33
35
|
<br />
|
|
34
36
|
<br />
|
|
35
|
-
<MarkdownViewer>
|
|
37
|
+
<MarkdownViewer>
|
|
38
|
+
{select.operation.function.description}
|
|
39
|
+
</MarkdownViewer>
|
|
36
40
|
</AccordionDetails>
|
|
37
41
|
</Accordion>
|
|
38
42
|
))}
|
|
@@ -41,6 +45,6 @@ export const AgenticaChatFunctionStackSideMovie = <Model extends ILlmSchema.Mode
|
|
|
41
45
|
};
|
|
42
46
|
export namespace AgenticaChatFunctionStackSideMovie {
|
|
43
47
|
export interface IProps<Model extends ILlmSchema.Model> {
|
|
44
|
-
selections:
|
|
48
|
+
selections: AgenticaOperationSelection<Model>[];
|
|
45
49
|
}
|
|
46
50
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AgenticaOperationSelection,
|
|
3
|
+
AgenticaTokenUsage,
|
|
2
4
|
IAgenticaConfig,
|
|
3
|
-
IAgenticaOperationSelection,
|
|
4
|
-
IAgenticaTokenUsage,
|
|
5
5
|
IAgenticaVendor,
|
|
6
6
|
} from "@agentica/core";
|
|
7
7
|
import { Typography } from "@mui/material";
|
|
@@ -58,8 +58,8 @@ export namespace AgenticaChatSideMovie {
|
|
|
58
58
|
export interface IProps<Model extends ILlmSchema.Model> {
|
|
59
59
|
vendor: IAgenticaVendor;
|
|
60
60
|
config: IAgenticaConfig<Model> | undefined;
|
|
61
|
-
usage:
|
|
62
|
-
selections:
|
|
61
|
+
usage: AgenticaTokenUsage;
|
|
62
|
+
selections: AgenticaOperationSelection<Model>[];
|
|
63
63
|
error: Error | null;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AgenticaTokenUsage } from "@agentica/core";
|
|
2
2
|
import {
|
|
3
3
|
Table,
|
|
4
4
|
TableBody,
|
|
@@ -54,7 +54,7 @@ export const AgenticaChatTokenUsageSideMovie = (
|
|
|
54
54
|
};
|
|
55
55
|
export namespace AgenticaChatTokenUsageSideMovie {
|
|
56
56
|
export interface IProps {
|
|
57
|
-
usage:
|
|
57
|
+
usage: AgenticaTokenUsage;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -64,7 +64,7 @@ interface IPrice {
|
|
|
64
64
|
completion: number;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
const compute = (usage:
|
|
67
|
+
const compute = (usage: AgenticaTokenUsage): IPrice => {
|
|
68
68
|
const prompt: number =
|
|
69
69
|
(usage.aggregate.input.total - usage.aggregate.input.cached) *
|
|
70
70
|
(2.5 / 1_000_000) +
|