@autobe/ui 0.21.0 → 0.22.1
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/lib/{AutoBeAssistantMessageMovie.d.ts → components/AutoBeAssistantMessageMovie.d.ts} +1 -1
- package/lib/{AutoBeAssistantMessageMovie.js → components/AutoBeAssistantMessageMovie.js} +3 -1
- package/lib/components/AutoBeAssistantMessageMovie.js.map +1 -0
- package/lib/components/AutoBeChatMain.d.ts +12 -0
- package/lib/components/AutoBeChatMain.js +88 -0
- package/lib/components/AutoBeChatMain.js.map +1 -0
- package/lib/components/AutoBeStatusModal.d.ts +6 -0
- package/lib/components/AutoBeStatusModal.js +269 -0
- package/lib/components/AutoBeStatusModal.js.map +1 -0
- package/lib/{AutoBeUserMessageMovie.d.ts → components/AutoBeUserMessageMovie.d.ts} +1 -1
- package/lib/{AutoBeUserMessageMovie.js → components/AutoBeUserMessageMovie.js} +3 -1
- package/lib/components/AutoBeUserMessageMovie.js.map +1 -0
- package/lib/{common → components/common}/ChatBubble.js +1 -1
- package/lib/components/common/ChatBubble.js.map +1 -0
- package/lib/{common → components/common}/Collapsible.js +6 -6
- package/lib/components/common/Collapsible.js.map +1 -0
- package/lib/components/common/index.js.map +1 -0
- package/lib/components/common/openai/OpenAIContent.js.map +1 -0
- package/lib/components/common/openai/OpenAIUserAudioContent.js.map +1 -0
- package/lib/components/common/openai/OpenAIUserFileContent.js.map +1 -0
- package/lib/components/common/openai/OpenAIUserImageContent.js.map +1 -0
- package/lib/{common → components/common}/openai/OpenAIUserTextContent.js +0 -1
- package/lib/components/common/openai/OpenAIUserTextContent.js.map +1 -0
- package/lib/components/common/openai/index.js.map +1 -0
- package/lib/components/events/AutoBeCompleteEventMovie.js.map +1 -0
- package/lib/components/events/AutoBeCorrectEventMovie.d.ts +9 -0
- package/lib/components/events/AutoBeCorrectEventMovie.js +146 -0
- package/lib/components/events/AutoBeCorrectEventMovie.js.map +1 -0
- package/lib/{events → components/events}/AutoBeEventMovie.d.ts +1 -2
- package/lib/{events → components/events}/AutoBeEventMovie.js +16 -7
- package/lib/components/events/AutoBeEventMovie.js.map +1 -0
- package/lib/components/events/AutoBeProgressEventMovie.js.map +1 -0
- package/lib/components/events/AutoBeScenarioEventMovie.js.map +1 -0
- package/lib/components/events/AutoBeStartEventMovie.js.map +1 -0
- package/lib/{events → components/events}/AutoBeValidateEventMovie.js +2 -2
- package/lib/components/events/AutoBeValidateEventMovie.js.map +1 -0
- package/lib/{events → components/events}/common/CollapsibleEventGroup.js +1 -5
- package/lib/components/events/common/CollapsibleEventGroup.js.map +1 -0
- package/lib/components/events/common/EventCard.js.map +1 -0
- package/lib/components/events/common/EventContent.js.map +1 -0
- package/lib/{events → components/events}/common/EventHeader.js +1 -1
- package/lib/components/events/common/EventHeader.js.map +1 -0
- package/lib/components/events/common/EventIcon.js.map +1 -0
- package/lib/{events → components/events}/common/ProgressBar.js +3 -2
- package/lib/components/events/common/ProgressBar.js.map +1 -0
- package/lib/components/events/common/index.js.map +1 -0
- package/lib/components/events/groups/CorrectEventGroup.d.ts +12 -0
- package/lib/components/events/groups/CorrectEventGroup.js +83 -0
- package/lib/components/events/groups/CorrectEventGroup.js.map +1 -0
- package/lib/{events → components/events}/groups/ValidateEventGroup.js +3 -3
- package/lib/components/events/groups/ValidateEventGroup.js.map +1 -0
- package/lib/{events → components/events}/groups/index.d.ts +1 -0
- package/lib/components/events/groups/index.js +8 -0
- package/lib/components/events/groups/index.js.map +1 -0
- package/lib/{events → components/events}/index.d.ts +1 -0
- package/lib/{events → components/events}/index.js +3 -1
- package/lib/components/events/index.js.map +1 -0
- package/lib/components/events/utils/eventGrouper.js.map +1 -0
- package/lib/components/events/utils/index.js.map +1 -0
- package/lib/components/index.d.ts +7 -0
- package/lib/{banner → components}/index.js +7 -4
- package/lib/components/index.js.map +1 -0
- package/lib/{upload → components/upload}/AutoBeChatUploadBox.js +3 -2
- package/lib/components/upload/AutoBeChatUploadBox.js.map +1 -0
- package/lib/components/upload/AutoBeChatUploadSendButton.js.map +1 -0
- package/lib/components/upload/AutoBeFileUploadBox.js.map +1 -0
- package/lib/components/upload/AutoBeUploadConfig.js.map +1 -0
- package/lib/{upload → components/upload}/AutoBeVoiceRecoderButton.js +1 -1
- package/lib/components/upload/AutoBeVoiceRecoderButton.js.map +1 -0
- package/lib/components/upload/index.js.map +1 -0
- package/lib/constant/color.d.ts +4 -0
- package/lib/constant/color.js +4 -0
- package/lib/constant/color.js.map +1 -1
- package/lib/context/AutoBeAgentContext.d.ts +20 -0
- package/lib/context/AutoBeAgentContext.js +50 -0
- package/lib/context/AutoBeAgentContext.js.map +1 -0
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useEscapeKey.d.ts +7 -0
- package/lib/hooks/useEscapeKey.js +27 -0
- package/lib/hooks/useEscapeKey.js.map +1 -0
- package/lib/hooks/useMediaQuery.d.ts +8 -3
- package/lib/hooks/useMediaQuery.js +8 -3
- package/lib/hooks/useMediaQuery.js.map +1 -1
- package/lib/icons/Receipt.d.ts +12 -0
- package/lib/icons/Receipt.js +9 -0
- package/lib/icons/Receipt.js.map +1 -0
- package/lib/index.d.ts +3 -9
- package/lib/index.js +3 -17
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/src/{AutoBeAssistantMessageMovie.tsx → components/AutoBeAssistantMessageMovie.tsx} +1 -1
- package/src/components/AutoBeChatMain.tsx +178 -0
- package/src/components/AutoBeStatusModal.tsx +483 -0
- package/src/{AutoBeUserMessageMovie.tsx → components/AutoBeUserMessageMovie.tsx} +3 -1
- package/src/{common → components/common}/ChatBubble.tsx +1 -1
- package/src/{common → components/common}/Collapsible.tsx +7 -7
- package/src/{common → components/common}/openai/OpenAIUserTextContent.tsx +0 -1
- package/src/components/events/AutoBeCorrectEventMovie.tsx +368 -0
- package/src/{events → components/events}/AutoBeEventMovie.tsx +25 -9
- package/src/{events → components/events}/AutoBeValidateEventMovie.tsx +2 -2
- package/src/{events → components/events}/common/CollapsibleEventGroup.tsx +1 -10
- package/src/{events → components/events}/common/EventHeader.tsx +1 -1
- package/src/{events → components/events}/common/ProgressBar.tsx +3 -2
- package/src/components/events/groups/CorrectEventGroup.tsx +183 -0
- package/src/{events → components/events}/groups/ValidateEventGroup.tsx +3 -3
- package/src/{events → components/events}/groups/index.ts +4 -0
- package/src/{events → components/events}/index.ts +1 -0
- package/src/components/index.ts +7 -0
- package/src/{upload → components/upload}/AutoBeChatUploadBox.tsx +4 -2
- package/src/{upload → components/upload}/AutoBeVoiceRecoderButton.tsx +1 -1
- package/src/constant/color.ts +4 -0
- package/src/context/AutoBeAgentContext.tsx +79 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useEscapeKey.ts +24 -0
- package/src/hooks/useMediaQuery.ts +8 -3
- package/src/icons/Receipt.tsx +74 -0
- package/src/index.ts +3 -12
- package/lib/AutoBeAssistantMessageMovie.js.map +0 -1
- package/lib/AutoBeChatMain.d.ts +0 -16
- package/lib/AutoBeChatMain.js +0 -51
- package/lib/AutoBeChatMain.js.map +0 -1
- package/lib/AutoBeUserMessageMovie.js.map +0 -1
- package/lib/banner/AutoBeAgentInformation.d.ts +0 -15
- package/lib/banner/AutoBeAgentInformation.js +0 -41
- package/lib/banner/AutoBeAgentInformation.js.map +0 -1
- package/lib/banner/AutoBeChatBanner.d.ts +0 -15
- package/lib/banner/AutoBeChatBanner.js +0 -29
- package/lib/banner/AutoBeChatBanner.js.map +0 -1
- package/lib/banner/AutoBeChatState.d.ts +0 -6
- package/lib/banner/AutoBeChatState.js +0 -80
- package/lib/banner/AutoBeChatState.js.map +0 -1
- package/lib/banner/AutoBeTokenUsage.d.ts +0 -14
- package/lib/banner/AutoBeTokenUsage.js +0 -60
- package/lib/banner/AutoBeTokenUsage.js.map +0 -1
- package/lib/banner/index.d.ts +0 -4
- package/lib/banner/index.js.map +0 -1
- package/lib/common/ChatBubble.js.map +0 -1
- package/lib/common/Collapsible.js.map +0 -1
- package/lib/common/index.js.map +0 -1
- package/lib/common/openai/OpenAIContent.js.map +0 -1
- package/lib/common/openai/OpenAIUserAudioContent.js.map +0 -1
- package/lib/common/openai/OpenAIUserFileContent.js.map +0 -1
- package/lib/common/openai/OpenAIUserImageContent.js.map +0 -1
- package/lib/common/openai/OpenAIUserTextContent.js.map +0 -1
- package/lib/common/openai/index.js.map +0 -1
- package/lib/events/AutoBeCompleteEventMovie.js.map +0 -1
- package/lib/events/AutoBeEventMovie.js.map +0 -1
- package/lib/events/AutoBeProgressEventMovie.js.map +0 -1
- package/lib/events/AutoBeScenarioEventMovie.js.map +0 -1
- package/lib/events/AutoBeStartEventMovie.js.map +0 -1
- package/lib/events/AutoBeValidateEventMovie.js.map +0 -1
- package/lib/events/common/CollapsibleEventGroup.js.map +0 -1
- package/lib/events/common/EventCard.js.map +0 -1
- package/lib/events/common/EventContent.js.map +0 -1
- package/lib/events/common/EventHeader.js.map +0 -1
- package/lib/events/common/EventIcon.js.map +0 -1
- package/lib/events/common/ProgressBar.js.map +0 -1
- package/lib/events/common/index.js.map +0 -1
- package/lib/events/groups/ValidateEventGroup.js.map +0 -1
- package/lib/events/groups/index.js +0 -6
- package/lib/events/groups/index.js.map +0 -1
- package/lib/events/index.js.map +0 -1
- package/lib/events/utils/eventGrouper.js.map +0 -1
- package/lib/events/utils/index.js.map +0 -1
- package/lib/upload/AutoBeChatUploadBox.js.map +0 -1
- package/lib/upload/AutoBeChatUploadSendButton.js.map +0 -1
- package/lib/upload/AutoBeFileUploadBox.js.map +0 -1
- package/lib/upload/AutoBeUploadConfig.js.map +0 -1
- package/lib/upload/AutoBeVoiceRecoderButton.js.map +0 -1
- package/lib/upload/index.js.map +0 -1
- package/src/AutoBeChatMain.tsx +0 -123
- package/src/banner/AutoBeAgentInformation.tsx +0 -102
- package/src/banner/AutoBeChatBanner.tsx +0 -72
- package/src/banner/AutoBeChatState.tsx +0 -152
- package/src/banner/AutoBeTokenUsage.tsx +0 -152
- package/src/banner/index.ts +0 -4
- /package/lib/{common → components/common}/ChatBubble.d.ts +0 -0
- /package/lib/{common → components/common}/Collapsible.d.ts +0 -0
- /package/lib/{common → components/common}/index.d.ts +0 -0
- /package/lib/{common → components/common}/index.js +0 -0
- /package/lib/{common → components/common}/openai/OpenAIContent.d.ts +0 -0
- /package/lib/{common → components/common}/openai/OpenAIContent.js +0 -0
- /package/lib/{common → components/common}/openai/OpenAIUserAudioContent.d.ts +0 -0
- /package/lib/{common → components/common}/openai/OpenAIUserAudioContent.js +0 -0
- /package/lib/{common → components/common}/openai/OpenAIUserFileContent.d.ts +0 -0
- /package/lib/{common → components/common}/openai/OpenAIUserFileContent.js +0 -0
- /package/lib/{common → components/common}/openai/OpenAIUserImageContent.d.ts +0 -0
- /package/lib/{common → components/common}/openai/OpenAIUserImageContent.js +0 -0
- /package/lib/{common → components/common}/openai/OpenAIUserTextContent.d.ts +0 -0
- /package/lib/{common → components/common}/openai/index.d.ts +0 -0
- /package/lib/{common → components/common}/openai/index.js +0 -0
- /package/lib/{events → components/events}/AutoBeCompleteEventMovie.d.ts +0 -0
- /package/lib/{events → components/events}/AutoBeCompleteEventMovie.js +0 -0
- /package/lib/{events → components/events}/AutoBeProgressEventMovie.d.ts +0 -0
- /package/lib/{events → components/events}/AutoBeProgressEventMovie.js +0 -0
- /package/lib/{events → components/events}/AutoBeScenarioEventMovie.d.ts +0 -0
- /package/lib/{events → components/events}/AutoBeScenarioEventMovie.js +0 -0
- /package/lib/{events → components/events}/AutoBeStartEventMovie.d.ts +0 -0
- /package/lib/{events → components/events}/AutoBeStartEventMovie.js +0 -0
- /package/lib/{events → components/events}/AutoBeValidateEventMovie.d.ts +0 -0
- /package/lib/{events → components/events}/common/CollapsibleEventGroup.d.ts +0 -0
- /package/lib/{events → components/events}/common/EventCard.d.ts +0 -0
- /package/lib/{events → components/events}/common/EventCard.js +0 -0
- /package/lib/{events → components/events}/common/EventContent.d.ts +0 -0
- /package/lib/{events → components/events}/common/EventContent.js +0 -0
- /package/lib/{events → components/events}/common/EventHeader.d.ts +0 -0
- /package/lib/{events → components/events}/common/EventIcon.d.ts +0 -0
- /package/lib/{events → components/events}/common/EventIcon.js +0 -0
- /package/lib/{events → components/events}/common/ProgressBar.d.ts +0 -0
- /package/lib/{events → components/events}/common/index.d.ts +0 -0
- /package/lib/{events → components/events}/common/index.js +0 -0
- /package/lib/{events → components/events}/groups/ValidateEventGroup.d.ts +0 -0
- /package/lib/{events → components/events}/utils/eventGrouper.d.ts +0 -0
- /package/lib/{events → components/events}/utils/eventGrouper.js +0 -0
- /package/lib/{events → components/events}/utils/index.d.ts +0 -0
- /package/lib/{events → components/events}/utils/index.js +0 -0
- /package/lib/{upload → components/upload}/AutoBeChatUploadBox.d.ts +0 -0
- /package/lib/{upload → components/upload}/AutoBeChatUploadSendButton.d.ts +0 -0
- /package/lib/{upload → components/upload}/AutoBeChatUploadSendButton.js +0 -0
- /package/lib/{upload → components/upload}/AutoBeFileUploadBox.d.ts +0 -0
- /package/lib/{upload → components/upload}/AutoBeFileUploadBox.js +0 -0
- /package/lib/{upload → components/upload}/AutoBeUploadConfig.d.ts +0 -0
- /package/lib/{upload → components/upload}/AutoBeUploadConfig.js +0 -0
- /package/lib/{upload → components/upload}/AutoBeVoiceRecoderButton.d.ts +0 -0
- /package/lib/{upload → components/upload}/index.d.ts +0 -0
- /package/lib/{upload → components/upload}/index.js +0 -0
- /package/src/{common → components/common}/index.ts +0 -0
- /package/src/{common → components/common}/openai/OpenAIContent.tsx +0 -0
- /package/src/{common → components/common}/openai/OpenAIUserAudioContent.tsx +0 -0
- /package/src/{common → components/common}/openai/OpenAIUserFileContent.tsx +0 -0
- /package/src/{common → components/common}/openai/OpenAIUserImageContent.tsx +0 -0
- /package/src/{common → components/common}/openai/index.ts +0 -0
- /package/src/{events → components/events}/AutoBeCompleteEventMovie.tsx +0 -0
- /package/src/{events → components/events}/AutoBeProgressEventMovie.tsx +0 -0
- /package/src/{events → components/events}/AutoBeScenarioEventMovie.tsx +0 -0
- /package/src/{events → components/events}/AutoBeStartEventMovie.tsx +0 -0
- /package/src/{events → components/events}/README.md +0 -0
- /package/src/{events → components/events}/common/EventCard.tsx +0 -0
- /package/src/{events → components/events}/common/EventContent.tsx +0 -0
- /package/src/{events → components/events}/common/EventIcon.tsx +0 -0
- /package/src/{events → components/events}/common/index.ts +0 -0
- /package/src/{events → components/events}/utils/eventGrouper.tsx +0 -0
- /package/src/{events → components/events}/utils/index.ts +0 -0
- /package/src/{upload → components/upload}/AutoBeChatUploadSendButton.tsx +0 -0
- /package/src/{upload → components/upload}/AutoBeFileUploadBox.tsx +0 -0
- /package/src/{upload → components/upload}/AutoBeUploadConfig.ts +0 -0
- /package/src/{upload → components/upload}/index.ts +0 -0
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AutoBeAnalyzeCompleteEvent,
|
|
3
|
-
AutoBeInterfaceCompleteEvent,
|
|
4
|
-
AutoBePrismaCompleteEvent,
|
|
5
|
-
AutoBeRealizeCompleteEvent,
|
|
6
|
-
AutoBeTestCompleteEvent,
|
|
7
|
-
} from "@autobe/interface";
|
|
8
|
-
|
|
9
|
-
import { AutoBeListenerState } from "..";
|
|
10
|
-
import { COLORS } from "../constant/color";
|
|
11
|
-
|
|
12
|
-
export interface IAutoBeChatStateProps {
|
|
13
|
-
state: AutoBeListenerState;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** Common styles for step items */
|
|
17
|
-
const getStepItemStyle = (isActive: boolean): React.CSSProperties => ({
|
|
18
|
-
padding: "12px",
|
|
19
|
-
backgroundColor: COLORS.GRAY_BACKGROUND,
|
|
20
|
-
borderRadius: "6px",
|
|
21
|
-
borderLeft: `4px solid ${isActive ? "#007bff" : COLORS.GRAY_BORDER}`,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const stepTitleStyle: React.CSSProperties = {
|
|
25
|
-
fontWeight: "bold",
|
|
26
|
-
fontSize: "0.9rem",
|
|
27
|
-
marginBottom: "4px",
|
|
28
|
-
color: COLORS.GRAY_TEXT_DARK,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const stepDataStyle: React.CSSProperties = {
|
|
32
|
-
fontSize: "0.85rem",
|
|
33
|
-
color: COLORS.GRAY_TEXT_MEDIUM,
|
|
34
|
-
lineHeight: "1.4",
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/** Props interface for StateStep component */
|
|
38
|
-
interface IStateStepProps {
|
|
39
|
-
/** Step name */
|
|
40
|
-
step: string;
|
|
41
|
-
|
|
42
|
-
data:
|
|
43
|
-
| AutoBeAnalyzeCompleteEvent
|
|
44
|
-
| AutoBePrismaCompleteEvent
|
|
45
|
-
| AutoBeInterfaceCompleteEvent
|
|
46
|
-
| AutoBeTestCompleteEvent
|
|
47
|
-
| AutoBeRealizeCompleteEvent;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** Component for displaying active state step */
|
|
51
|
-
const StateStep = ({ step, data }: IStateStepProps) => (
|
|
52
|
-
<div style={getStepItemStyle(true)}>
|
|
53
|
-
<div
|
|
54
|
-
style={stepTitleStyle}
|
|
55
|
-
>{`${step.charAt(0).toUpperCase()}${step.slice(1)}`}</div>
|
|
56
|
-
<div style={stepDataStyle}>
|
|
57
|
-
{Object.entries(getStepCount(data))
|
|
58
|
-
.map(([key, value]) => `${key}: ${value.toLocaleString()}`)
|
|
59
|
-
.join(" • ")}
|
|
60
|
-
</div>
|
|
61
|
-
<div style={stepDataStyle}>
|
|
62
|
-
⏱️ {(Math.floor((data.elapsed / 60_000) * 100) / 100).toLocaleString()}{" "}
|
|
63
|
-
mins
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
/** Component for displaying empty state step */
|
|
69
|
-
const StateEmpty = ({ step }: { step: string }) => (
|
|
70
|
-
<div style={getStepItemStyle(false)}>
|
|
71
|
-
<div
|
|
72
|
-
style={stepTitleStyle}
|
|
73
|
-
>{`${step.charAt(0).toUpperCase()}${step.slice(1)}`}</div>
|
|
74
|
-
<div style={stepDataStyle}>0 items • ⏱️ 0 mins</div>
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
/** Component to display development state information */
|
|
79
|
-
export const AutoBeChatState = (props: IAutoBeChatStateProps) => {
|
|
80
|
-
const containerStyle: React.CSSProperties = {
|
|
81
|
-
display: "flex",
|
|
82
|
-
flexDirection: "column",
|
|
83
|
-
gap: "12px",
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const steps = ["analyze", "prisma", "interface", "test", "realize"] as const;
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<div style={containerStyle}>
|
|
90
|
-
<div style={{ display: "flex", flexDirection: "column", gap: "8px" }}>
|
|
91
|
-
{steps.map((stepType) =>
|
|
92
|
-
props.state[stepType] ? (
|
|
93
|
-
<StateStep
|
|
94
|
-
key={stepType}
|
|
95
|
-
step={stepType}
|
|
96
|
-
data={props.state[stepType]}
|
|
97
|
-
/>
|
|
98
|
-
) : (
|
|
99
|
-
<StateEmpty key={stepType} step={stepType} />
|
|
100
|
-
),
|
|
101
|
-
)}
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
/** Calculate count data based on step type */
|
|
108
|
-
const getStepCount = (
|
|
109
|
-
data:
|
|
110
|
-
| AutoBeAnalyzeCompleteEvent
|
|
111
|
-
| AutoBePrismaCompleteEvent
|
|
112
|
-
| AutoBeInterfaceCompleteEvent
|
|
113
|
-
| AutoBeTestCompleteEvent
|
|
114
|
-
| AutoBeRealizeCompleteEvent,
|
|
115
|
-
): Record<string, number> => {
|
|
116
|
-
switch (data.type) {
|
|
117
|
-
case "analyzeComplete": {
|
|
118
|
-
return {
|
|
119
|
-
Documents: Object.keys(data.files).length,
|
|
120
|
-
"Actor Roles": data.roles.length,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
case "prismaComplete": {
|
|
124
|
-
return {
|
|
125
|
-
Namespaces: data.result.data.files.length,
|
|
126
|
-
Models: data.result.data.files
|
|
127
|
-
.map((f: { models: unknown[] }) => f.models.length)
|
|
128
|
-
.reduce((a: number, b: number) => a + b, 0),
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
case "interfaceComplete": {
|
|
132
|
-
return {
|
|
133
|
-
Operations: data.document.operations.length,
|
|
134
|
-
Schemas: Object.keys(data.document.components.schemas).length,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
case "testComplete": {
|
|
138
|
-
return {
|
|
139
|
-
Functions: data.files.length,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
case "realizeComplete": {
|
|
143
|
-
return {
|
|
144
|
-
Controllers: Object.keys(data.controllers).length,
|
|
145
|
-
Functions: data.functions.length,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
default:
|
|
149
|
-
data satisfies never;
|
|
150
|
-
throw new Error(`Unknown step type: ${data}`);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { IAutoBeTokenUsageJson } from "@autobe/interface";
|
|
2
|
-
import { ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
import { COLORS } from "../constant/color";
|
|
5
|
-
import { toCompactNumberFormat } from "../utils";
|
|
6
|
-
|
|
7
|
-
/** Props interface for TokenUsageCard component */
|
|
8
|
-
interface ITokenUsageCardProps {
|
|
9
|
-
/** Token usage data to display */
|
|
10
|
-
tokenUsage: IAutoBeTokenUsageJson | null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/** Props interface for TokenRow component */
|
|
14
|
-
interface ITokenRowProps {
|
|
15
|
-
/** Label text */
|
|
16
|
-
label: string;
|
|
17
|
-
/** Value to display */
|
|
18
|
-
value: ReactNode;
|
|
19
|
-
/** Whether this is the total row with border */
|
|
20
|
-
isTotal?: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/** Props interface for TokenLabel component */
|
|
24
|
-
interface ITokenLabelProps {
|
|
25
|
-
/** Label text */
|
|
26
|
-
children: string;
|
|
27
|
-
/** Whether this is a total label */
|
|
28
|
-
isTotal?: boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** Props interface for TokenValue component */
|
|
32
|
-
interface ITokenValueProps {
|
|
33
|
-
/** Value content */
|
|
34
|
-
children: ReactNode;
|
|
35
|
-
/** Color variant for the value */
|
|
36
|
-
variant: "input" | "cachedInput" | "output" | "total";
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Token row component with consistent flex layout */
|
|
40
|
-
const TokenRow = ({ label, value, isTotal = false }: ITokenRowProps) => (
|
|
41
|
-
<div
|
|
42
|
-
style={{
|
|
43
|
-
display: "flex",
|
|
44
|
-
justifyContent: "space-between",
|
|
45
|
-
alignItems: "center",
|
|
46
|
-
...(isTotal && {
|
|
47
|
-
paddingTop: "8px",
|
|
48
|
-
borderTop: `1px solid ${COLORS.GRAY_BORDER_LIGHT}`,
|
|
49
|
-
}),
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
<TokenLabel isTotal={isTotal}>{label}</TokenLabel>
|
|
53
|
-
{value}
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
/** Token label component with consistent styling */
|
|
58
|
-
const TokenLabel = ({ children, isTotal = false }: ITokenLabelProps) => (
|
|
59
|
-
<span
|
|
60
|
-
style={{
|
|
61
|
-
color: isTotal ? COLORS.GRAY_TEXT_DARK : COLORS.GRAY_TEXT_MEDIUM,
|
|
62
|
-
fontWeight: isTotal ? "600" : "500",
|
|
63
|
-
}}
|
|
64
|
-
>
|
|
65
|
-
{children}
|
|
66
|
-
</span>
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
/** Token value component with variant-based styling */
|
|
70
|
-
const TokenValue = ({ children, variant }: ITokenValueProps) => {
|
|
71
|
-
const getVariantStyles = () => {
|
|
72
|
-
switch (variant) {
|
|
73
|
-
case "input":
|
|
74
|
-
return { color: COLORS.TOKEN_INPUT, fontWeight: "600" };
|
|
75
|
-
case "cachedInput":
|
|
76
|
-
return {
|
|
77
|
-
color: COLORS.GRAY_TEXT_MEDIUM,
|
|
78
|
-
fontWeight: "400",
|
|
79
|
-
fontSize: "0.875rem",
|
|
80
|
-
};
|
|
81
|
-
case "output":
|
|
82
|
-
return { color: COLORS.TOKEN_OUTPUT, fontWeight: "600" };
|
|
83
|
-
case "total":
|
|
84
|
-
return {
|
|
85
|
-
color: COLORS.TOKEN_TOTAL,
|
|
86
|
-
fontWeight: "700",
|
|
87
|
-
fontSize: "1.125rem",
|
|
88
|
-
};
|
|
89
|
-
default:
|
|
90
|
-
variant satisfies never;
|
|
91
|
-
return {};
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
return <span style={getVariantStyles()}>{children}</span>;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Token usage card component displaying input, output, and total token counts
|
|
100
|
-
*
|
|
101
|
-
* @param props - Component props
|
|
102
|
-
* @returns JSX element representing the token usage card
|
|
103
|
-
*/
|
|
104
|
-
export const AutoBeTokenUsage = ({ tokenUsage }: ITokenUsageCardProps) => {
|
|
105
|
-
return (
|
|
106
|
-
<>
|
|
107
|
-
<div
|
|
108
|
-
style={{
|
|
109
|
-
display: "flex",
|
|
110
|
-
flexDirection: "column",
|
|
111
|
-
gap: "8px",
|
|
112
|
-
}}
|
|
113
|
-
>
|
|
114
|
-
<TokenRow
|
|
115
|
-
label="Input:"
|
|
116
|
-
value={
|
|
117
|
-
<TokenValue variant="input">
|
|
118
|
-
{toCompactNumberFormat(tokenUsage?.aggregate.input.total ?? 0)}
|
|
119
|
-
</TokenValue>
|
|
120
|
-
}
|
|
121
|
-
/>
|
|
122
|
-
<TokenRow
|
|
123
|
-
label="Cached Input:"
|
|
124
|
-
value={
|
|
125
|
-
<TokenValue variant="cachedInput">
|
|
126
|
-
{toCompactNumberFormat(tokenUsage?.aggregate.input.cached ?? 0)}
|
|
127
|
-
</TokenValue>
|
|
128
|
-
}
|
|
129
|
-
/>
|
|
130
|
-
<TokenRow
|
|
131
|
-
label="Output:"
|
|
132
|
-
value={
|
|
133
|
-
<TokenValue variant="output">
|
|
134
|
-
{toCompactNumberFormat(tokenUsage?.aggregate.output.total ?? 0)}
|
|
135
|
-
</TokenValue>
|
|
136
|
-
}
|
|
137
|
-
/>
|
|
138
|
-
<TokenRow
|
|
139
|
-
label="Total:"
|
|
140
|
-
value={
|
|
141
|
-
<TokenValue variant="total">
|
|
142
|
-
{toCompactNumberFormat(tokenUsage?.aggregate.total ?? 0)}
|
|
143
|
-
</TokenValue>
|
|
144
|
-
}
|
|
145
|
-
isTotal
|
|
146
|
-
/>
|
|
147
|
-
</div>
|
|
148
|
-
</>
|
|
149
|
-
);
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
export default AutoBeTokenUsage;
|
package/src/banner/index.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|