casabot 1.1.12 → 1.1.13
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/cli/index.js +1 -1
- package/dist/tui/app.js +5 -17
- package/package.json +1 -1
- package/src/cli/index.ts +1 -1
- package/src/tui/app.tsx +8 -40
package/dist/cli/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
13
13
|
async function displayLogo() {
|
|
14
14
|
try {
|
|
15
15
|
const logoPath = join(__dirname, "..", "..", "Logo2.png");
|
|
16
|
-
const maxWidth = Math.min(process.stdout.columns || 80,
|
|
16
|
+
const maxWidth = Math.min(process.stdout.columns || 80, 160);
|
|
17
17
|
const art = await renderBrailleLogo(logoPath, maxWidth);
|
|
18
18
|
console.log(art);
|
|
19
19
|
console.log("");
|
package/dist/tui/app.js
CHANGED
|
@@ -38,9 +38,6 @@ function getPreview(conv, maxLen = 50) {
|
|
|
38
38
|
function HRule({ columns }) {
|
|
39
39
|
return (_jsx(Box, { paddingX: 1, width: columns, children: _jsx(Text, { dimColor: true, children: "─".repeat(Math.max(columns - 4, 1)) }) }));
|
|
40
40
|
}
|
|
41
|
-
function HeaderBlock({ columns }) {
|
|
42
|
-
return (_jsxs(Box, { flexDirection: "column", paddingTop: 1, width: columns, children: [_jsx(Box, { paddingX: 2, children: _jsx(Gradient, { colors: [BRAND_RED, BRAND_BLUE], children: _jsx(Text, { bold: true, children: "✦ CasAbot" }) }) }), _jsx(Box, { paddingX: 2, children: _jsx(Text, { wrap: "wrap", dimColor: true, children: "Cassiopeia A — Freely creates everything, like a supernova explosion." }) }), _jsx(HRule, { columns: columns })] }));
|
|
43
|
-
}
|
|
44
41
|
function UserMessageView({ content, columns }) {
|
|
45
42
|
return (_jsxs(Box, { flexDirection: "column", paddingX: 2, marginTop: 1, width: columns, children: [_jsx(Text, { color: BRAND_RED, bold: true, children: "▶ You" }), _jsx(Box, { marginLeft: 2, width: Math.max(columns - 6, 10), children: _jsx(Text, { wrap: "wrap", children: content }) })] }));
|
|
46
43
|
}
|
|
@@ -228,23 +225,14 @@ function App({ provider, conversation: initialConversation, skills, }) {
|
|
|
228
225
|
});
|
|
229
226
|
const userCount = messages.filter((m) => m.role === "user").length;
|
|
230
227
|
const convId = conversationRef.current.id;
|
|
231
|
-
const items = useMemo(() =>
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
type: "message",
|
|
236
|
-
message: msg,
|
|
237
|
-
})),
|
|
238
|
-
], [messages, convId]);
|
|
228
|
+
const items = useMemo(() => messages.map((msg, i) => ({
|
|
229
|
+
key: `${convId}-msg-${i}`,
|
|
230
|
+
message: msg,
|
|
231
|
+
})), [messages, convId]);
|
|
239
232
|
if (mode === "history") {
|
|
240
233
|
return (_jsx(HistoryBrowser, { columns: columns, currentId: conversationRef.current.id, onSelect: handleHistorySelect, onBack: () => setMode("chat") }));
|
|
241
234
|
}
|
|
242
|
-
return (_jsxs(Box, { flexDirection: "column", width: columns, children: [_jsx(Static, { items: items, children: (item) => {
|
|
243
|
-
if (item.type === "header") {
|
|
244
|
-
return (_jsx(Box, { flexDirection: "column", width: columns, children: _jsx(HeaderBlock, { columns: columns }) }, item.key));
|
|
245
|
-
}
|
|
246
|
-
return (_jsx(Box, { flexDirection: "column", width: columns, children: _jsx(MessageView, { message: item.message, columns: columns }) }, item.key));
|
|
247
|
-
} }), messages.length === 0 && !isProcessing && _jsx(WelcomeHint, { columns: columns }), isProcessing && _jsx(ProcessingIndicator, { columns: columns }), _jsx(HRule, { columns: columns }), _jsx(Box, { paddingX: 1, width: columns, children: _jsxs(Box, { borderStyle: "round", borderColor: isProcessing ? "gray" : BRAND_BLUE, paddingX: 1, width: Math.max(columns - 2, 10), overflow: "hidden", children: [_jsx(Text, { color: BRAND_BLUE, bold: true, children: "❯ " }), _jsx(TextInput, { value: input, onChange: setInput, onSubmit: (val) => {
|
|
235
|
+
return (_jsxs(Box, { flexDirection: "column", width: columns, children: [_jsx(Static, { items: items, children: (item) => (_jsx(Box, { flexDirection: "column", width: columns, children: _jsx(MessageView, { message: item.message, columns: columns }) }, item.key)) }), messages.length === 0 && !isProcessing && _jsx(WelcomeHint, { columns: columns }), isProcessing && _jsx(ProcessingIndicator, { columns: columns }), _jsx(HRule, { columns: columns }), _jsx(Box, { paddingX: 1, width: columns, children: _jsxs(Box, { borderStyle: "round", borderColor: isProcessing ? "gray" : BRAND_BLUE, paddingX: 1, width: Math.max(columns - 2, 10), overflow: "hidden", children: [_jsx(Text, { color: BRAND_BLUE, bold: true, children: "❯ " }), _jsx(TextInput, { value: input, onChange: setInput, onSubmit: (val) => {
|
|
248
236
|
handleSubmit(val).catch(() => { });
|
|
249
237
|
}, placeholder: "Type your message\u2026", focus: !isProcessing, showCursor: true })] }) }), _jsxs(Box, { paddingX: 2, width: columns, justifyContent: "space-between", children: [_jsx(Text, { dimColor: true, children: isProcessing
|
|
250
238
|
? "ESC / Ctrl+C cancel"
|
package/package.json
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
16
16
|
async function displayLogo(): Promise<void> {
|
|
17
17
|
try {
|
|
18
18
|
const logoPath = join(__dirname, "..", "..", "Logo2.png");
|
|
19
|
-
const maxWidth = Math.min(process.stdout.columns || 80,
|
|
19
|
+
const maxWidth = Math.min(process.stdout.columns || 80, 160);
|
|
20
20
|
const art = await renderBrailleLogo(logoPath, maxWidth);
|
|
21
21
|
console.log(art);
|
|
22
22
|
console.log("");
|
package/src/tui/app.tsx
CHANGED
|
@@ -56,24 +56,6 @@ function HRule({ columns }: { columns: number }): React.ReactElement {
|
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
function HeaderBlock({ columns }: { columns: number }): React.ReactElement {
|
|
60
|
-
return (
|
|
61
|
-
<Box flexDirection="column" paddingTop={1} width={columns}>
|
|
62
|
-
<Box paddingX={2}>
|
|
63
|
-
<Gradient colors={[BRAND_RED, BRAND_BLUE]}>
|
|
64
|
-
<Text bold>{"✦ CasAbot"}</Text>
|
|
65
|
-
</Gradient>
|
|
66
|
-
</Box>
|
|
67
|
-
<Box paddingX={2}>
|
|
68
|
-
<Text wrap="wrap" dimColor>
|
|
69
|
-
{"Cassiopeia A — Freely creates everything, like a supernova explosion."}
|
|
70
|
-
</Text>
|
|
71
|
-
</Box>
|
|
72
|
-
<HRule columns={columns} />
|
|
73
|
-
</Box>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
59
|
function UserMessageView({ content, columns }: { content: string; columns: number }): React.ReactElement {
|
|
78
60
|
return (
|
|
79
61
|
<Box flexDirection="column" paddingX={2} marginTop={1} width={columns}>
|
|
@@ -364,9 +346,7 @@ function HistoryBrowser({
|
|
|
364
346
|
);
|
|
365
347
|
}
|
|
366
348
|
|
|
367
|
-
type DisplayItem =
|
|
368
|
-
| { key: string; type: "header" }
|
|
369
|
-
| { key: string; type: "message"; message: Message };
|
|
349
|
+
type DisplayItem = { key: string; message: Message };
|
|
370
350
|
|
|
371
351
|
type AppMode = "chat" | "history";
|
|
372
352
|
|
|
@@ -498,16 +478,13 @@ function App({
|
|
|
498
478
|
const convId = conversationRef.current.id;
|
|
499
479
|
|
|
500
480
|
const items = useMemo(
|
|
501
|
-
(): DisplayItem[] =>
|
|
502
|
-
|
|
503
|
-
...messages.map(
|
|
481
|
+
(): DisplayItem[] =>
|
|
482
|
+
messages.map(
|
|
504
483
|
(msg, i): DisplayItem => ({
|
|
505
484
|
key: `${convId}-msg-${i}`,
|
|
506
|
-
type: "message",
|
|
507
485
|
message: msg,
|
|
508
486
|
}),
|
|
509
487
|
),
|
|
510
|
-
],
|
|
511
488
|
[messages, convId],
|
|
512
489
|
);
|
|
513
490
|
|
|
@@ -525,20 +502,11 @@ function App({
|
|
|
525
502
|
return (
|
|
526
503
|
<Box flexDirection="column" width={columns}>
|
|
527
504
|
<Static items={items}>
|
|
528
|
-
{(item) =>
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
</Box>
|
|
534
|
-
);
|
|
535
|
-
}
|
|
536
|
-
return (
|
|
537
|
-
<Box key={item.key} flexDirection="column" width={columns}>
|
|
538
|
-
<MessageView message={item.message} columns={columns} />
|
|
539
|
-
</Box>
|
|
540
|
-
);
|
|
541
|
-
}}
|
|
505
|
+
{(item) => (
|
|
506
|
+
<Box key={item.key} flexDirection="column" width={columns}>
|
|
507
|
+
<MessageView message={item.message} columns={columns} />
|
|
508
|
+
</Box>
|
|
509
|
+
)}
|
|
542
510
|
</Static>
|
|
543
511
|
|
|
544
512
|
{messages.length === 0 && !isProcessing && <WelcomeHint columns={columns} />}
|