@beanx/cathygo-web-core 0.1.0 → 0.1.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/dist/index.d.ts +24 -5
- package/dist/index.js +118 -38
- package/dist/styles.css +91 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -123,11 +123,19 @@ type AgentRunThinking = {
|
|
|
123
123
|
type ChatAction = {
|
|
124
124
|
type: 'session.created';
|
|
125
125
|
sessionId: string;
|
|
126
|
+
} | {
|
|
127
|
+
type: 'session.loading';
|
|
128
|
+
sessionId: string;
|
|
126
129
|
} | {
|
|
127
130
|
type: 'session.loaded';
|
|
128
131
|
sessionId: string;
|
|
129
132
|
messages: ChatMessage$1[];
|
|
130
133
|
activities?: AgentActivity[];
|
|
134
|
+
} | {
|
|
135
|
+
type: 'session.load.failed';
|
|
136
|
+
sessionId: string;
|
|
137
|
+
error: string;
|
|
138
|
+
code?: string;
|
|
131
139
|
} | {
|
|
132
140
|
type: 'user.sent';
|
|
133
141
|
id: string;
|
|
@@ -174,6 +182,9 @@ type CathyGOChatAppProps = {
|
|
|
174
182
|
gatewayLinked?: boolean;
|
|
175
183
|
model?: GatewayModelStatus;
|
|
176
184
|
agentStatus?: AgentIdentityStatus;
|
|
185
|
+
activeSessionId?: string;
|
|
186
|
+
loadingSessionId?: string;
|
|
187
|
+
debugPanels?: boolean;
|
|
177
188
|
homeAvatarSrc?: string;
|
|
178
189
|
onDraftChange: (value: string) => void;
|
|
179
190
|
onFilesSelected?: (files: File[]) => void;
|
|
@@ -184,8 +195,9 @@ type CathyGOChatAppProps = {
|
|
|
184
195
|
onSuggest?: (text: string) => void;
|
|
185
196
|
onOpenChat: (sessionId: string) => void;
|
|
186
197
|
onNewChat: () => void;
|
|
198
|
+
onSettingsOpen?: () => void;
|
|
187
199
|
};
|
|
188
|
-
declare function CathyGOChatApp({ screen, chat, chats, draft, attachments, attachmentPolicy, composerError, busy, connectionStatus, gatewayLinked, model, agentStatus, homeAvatarSrc, onDraftChange, onFilesSelected, onRemoveAttachment, onSendMessage, onSendHomeMessage, onAbort, onSuggest, onOpenChat, onNewChat, }: CathyGOChatAppProps): react.JSX.Element;
|
|
200
|
+
declare function CathyGOChatApp({ screen, chat, chats, draft, attachments, attachmentPolicy, composerError, busy, connectionStatus, gatewayLinked, model, agentStatus, activeSessionId, loadingSessionId, debugPanels, homeAvatarSrc, onDraftChange, onFilesSelected, onRemoveAttachment, onSendMessage, onSendHomeMessage, onAbort, onSuggest, onOpenChat, onNewChat, onSettingsOpen, }: CathyGOChatAppProps): react.JSX.Element;
|
|
189
201
|
|
|
190
202
|
type UseCathyGOChatResult = {
|
|
191
203
|
chat: ChatState;
|
|
@@ -246,8 +258,9 @@ type ChatTopBarProps = {
|
|
|
246
258
|
debugUI?: boolean;
|
|
247
259
|
canAbort?: boolean;
|
|
248
260
|
onAbort?: () => void;
|
|
261
|
+
onSettingsOpen?: () => void;
|
|
249
262
|
};
|
|
250
|
-
declare function ChatTopBar({ agentStatus, connectionStatus, gatewayLinked, model, debugUI, canAbort, onAbort, }: ChatTopBarProps): react.JSX.Element;
|
|
263
|
+
declare function ChatTopBar({ agentStatus, connectionStatus, gatewayLinked, model, debugUI, canAbort, onAbort, onSettingsOpen, }: ChatTopBarProps): react.JSX.Element;
|
|
251
264
|
|
|
252
265
|
type ChatTranscriptProps = {
|
|
253
266
|
messages: ChatMessage$1[];
|
|
@@ -325,19 +338,22 @@ interface ChatHomeViewProps {
|
|
|
325
338
|
model?: GatewayModelStatus;
|
|
326
339
|
agentStatus?: AgentIdentityStatus;
|
|
327
340
|
avatarSrc?: string;
|
|
341
|
+
onSettingsOpen?: () => void;
|
|
328
342
|
onDraftChange: (value: string) => void;
|
|
329
343
|
onFilesSelected?: (files: File[]) => void;
|
|
330
344
|
onRemoveAttachment?: (id: string) => void;
|
|
331
345
|
onSend: (modeId: ChatHomeModeId) => void;
|
|
332
346
|
}
|
|
333
|
-
declare function ChatHomeView({ draft, attachments, attachmentPolicy, error, busy, connectionStatus, gatewayLinked, model, agentStatus, avatarSrc, onDraftChange, onFilesSelected, onRemoveAttachment, onSend, }: ChatHomeViewProps): react.JSX.Element;
|
|
347
|
+
declare function ChatHomeView({ draft, attachments, attachmentPolicy, error, busy, connectionStatus, gatewayLinked, model, agentStatus, avatarSrc, onSettingsOpen, onDraftChange, onFilesSelected, onRemoveAttachment, onSend, }: ChatHomeViewProps): react.JSX.Element;
|
|
334
348
|
|
|
335
349
|
interface ChatListViewProps {
|
|
336
350
|
chats: ConversationSummary[];
|
|
351
|
+
activeSessionId?: string;
|
|
352
|
+
loadingSessionId?: string;
|
|
337
353
|
onOpen: (sessionId: string) => void;
|
|
338
354
|
onNewChat: () => void;
|
|
339
355
|
}
|
|
340
|
-
declare function ChatListView({ chats, onOpen, onNewChat }: ChatListViewProps): react.JSX.Element;
|
|
356
|
+
declare function ChatListView({ chats, activeSessionId, loadingSessionId, onOpen, onNewChat, }: ChatListViewProps): react.JSX.Element;
|
|
341
357
|
|
|
342
358
|
interface ChatViewProps {
|
|
343
359
|
chat: ChatState;
|
|
@@ -345,18 +361,21 @@ interface ChatViewProps {
|
|
|
345
361
|
attachments?: PendingComposerAttachment[];
|
|
346
362
|
attachmentPolicy?: ComposerAttachmentPolicy;
|
|
347
363
|
composerError?: string;
|
|
364
|
+
busy?: boolean;
|
|
348
365
|
connectionStatus: string;
|
|
349
366
|
gatewayLinked?: boolean;
|
|
350
367
|
model?: GatewayModelStatus;
|
|
351
368
|
agentStatus?: AgentIdentityStatus;
|
|
369
|
+
debugPanels?: boolean;
|
|
352
370
|
onDraftChange: (value: string) => void;
|
|
353
371
|
onFilesSelected?: (files: File[]) => void;
|
|
354
372
|
onRemoveAttachment?: (id: string) => void;
|
|
355
373
|
onSend: () => void;
|
|
356
374
|
onAbort: () => void;
|
|
357
375
|
onSuggest?: (text: string) => void;
|
|
376
|
+
onSettingsOpen?: () => void;
|
|
358
377
|
}
|
|
359
|
-
declare function ChatView({ chat, draft, attachments, attachmentPolicy, composerError, connectionStatus, gatewayLinked, model, agentStatus, onDraftChange, onFilesSelected, onRemoveAttachment, onSend, onAbort, onSuggest, }: ChatViewProps): react.JSX.Element;
|
|
378
|
+
declare function ChatView({ chat, draft, attachments, attachmentPolicy, composerError, busy: externalBusy, connectionStatus, gatewayLinked, model, agentStatus, debugPanels, onDraftChange, onFilesSelected, onRemoveAttachment, onSend, onAbort, onSuggest, onSettingsOpen, }: ChatViewProps): react.JSX.Element;
|
|
360
379
|
|
|
361
380
|
declare function modelStatusText(model: GatewayModelStatus): string;
|
|
362
381
|
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
// src/features/chat/ChatHomeView.tsx
|
|
2
2
|
import { useRef as useRef2, useState as useState2 } from "react";
|
|
3
3
|
|
|
4
|
-
// src/chat-ui/agentIdentity.ts
|
|
5
|
-
function agentDisplayName(status) {
|
|
6
|
-
return status?.display_name?.trim() || status?.agent_id?.trim() || "CathyGO Agent";
|
|
7
|
-
}
|
|
8
|
-
function agentShortId(status) {
|
|
9
|
-
const value = status?.agent_short_id?.trim();
|
|
10
|
-
return value || void 0;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
4
|
// src/chat-ui/icons.tsx
|
|
14
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
6
|
function IconNewChat({ className }) {
|
|
@@ -773,6 +764,15 @@ function IconSend({ className }) {
|
|
|
773
764
|
);
|
|
774
765
|
}
|
|
775
766
|
|
|
767
|
+
// src/chat-ui/agentIdentity.ts
|
|
768
|
+
function agentDisplayName(status) {
|
|
769
|
+
return status?.display_name?.trim() || status?.agent_id?.trim() || "CathyGO Agent";
|
|
770
|
+
}
|
|
771
|
+
function agentShortId(status) {
|
|
772
|
+
const value = status?.agent_short_id?.trim();
|
|
773
|
+
return value || void 0;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
776
|
// src/chat-ui/components/ChatAgentIdentity.tsx
|
|
777
777
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
778
778
|
function ChatAgentIdentity({ agentStatus }) {
|
|
@@ -816,7 +816,8 @@ function ChatTopBar({
|
|
|
816
816
|
model,
|
|
817
817
|
debugUI,
|
|
818
818
|
canAbort,
|
|
819
|
-
onAbort
|
|
819
|
+
onAbort,
|
|
820
|
+
onSettingsOpen
|
|
820
821
|
}) {
|
|
821
822
|
const tone = connectionTone(connectionStatus, gatewayLinked);
|
|
822
823
|
const statusLabel = gatewayLinked ? "Connected" : connectionStatus;
|
|
@@ -833,6 +834,17 @@ function ChatTopBar({
|
|
|
833
834
|
}
|
|
834
835
|
),
|
|
835
836
|
debugUI ? /* @__PURE__ */ jsx3("span", { className: "chat-topbar-debug", children: "Debug" }) : null,
|
|
837
|
+
onSettingsOpen ? /* @__PURE__ */ jsx3(
|
|
838
|
+
"button",
|
|
839
|
+
{
|
|
840
|
+
"aria-label": "\u6253\u5F00\u8BBE\u7F6E",
|
|
841
|
+
className: "chat-topbar-icon-btn",
|
|
842
|
+
onClick: onSettingsOpen,
|
|
843
|
+
title: "\u8BBE\u7F6E",
|
|
844
|
+
type: "button",
|
|
845
|
+
children: /* @__PURE__ */ jsx3(IconSettings, {})
|
|
846
|
+
}
|
|
847
|
+
) : null,
|
|
836
848
|
canAbort ? /* @__PURE__ */ jsx3("button", { className: "chat-topbar-abort", onClick: onAbort, type: "button", children: "\u505C\u6B62" }) : null
|
|
837
849
|
] })
|
|
838
850
|
] });
|
|
@@ -1108,6 +1120,7 @@ function ChatHomeView({
|
|
|
1108
1120
|
model,
|
|
1109
1121
|
agentStatus,
|
|
1110
1122
|
avatarSrc,
|
|
1123
|
+
onSettingsOpen,
|
|
1111
1124
|
onDraftChange,
|
|
1112
1125
|
onFilesSelected,
|
|
1113
1126
|
onRemoveAttachment,
|
|
@@ -1130,7 +1143,8 @@ function ChatHomeView({
|
|
|
1130
1143
|
connectionStatus,
|
|
1131
1144
|
gatewayLinked,
|
|
1132
1145
|
model,
|
|
1133
|
-
agentStatus
|
|
1146
|
+
agentStatus,
|
|
1147
|
+
onSettingsOpen
|
|
1134
1148
|
}
|
|
1135
1149
|
),
|
|
1136
1150
|
/* @__PURE__ */ jsxs5("div", { className: "chat-home-center", children: [
|
|
@@ -1188,29 +1202,37 @@ function stripMathForPreview(text, maxLen = 80) {
|
|
|
1188
1202
|
|
|
1189
1203
|
// src/features/chat/ChatListView.tsx
|
|
1190
1204
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1191
|
-
function ChatListView({
|
|
1205
|
+
function ChatListView({
|
|
1206
|
+
chats,
|
|
1207
|
+
activeSessionId,
|
|
1208
|
+
loadingSessionId,
|
|
1209
|
+
onOpen,
|
|
1210
|
+
onNewChat
|
|
1211
|
+
}) {
|
|
1192
1212
|
return /* @__PURE__ */ jsxs6("section", { className: "cathygo-chat-panel list-workspace", children: [
|
|
1193
1213
|
/* @__PURE__ */ jsxs6("header", { className: "page-topbar", children: [
|
|
1194
1214
|
/* @__PURE__ */ jsx6("h1", { className: "page-topbar-title", children: "\u5BF9\u8BDD\u5386\u53F2" }),
|
|
1195
1215
|
/* @__PURE__ */ jsx6("button", { className: "primary-action", onClick: onNewChat, type: "button", children: "\u65B0\u5BF9\u8BDD" })
|
|
1196
1216
|
] }),
|
|
1197
|
-
/* @__PURE__ */ jsx6("div", { className: "chat-column list-column", children: chats.length ? /* @__PURE__ */ jsx6("div", { className: "history-list", children: chats.map((chat) =>
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
"
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1217
|
+
/* @__PURE__ */ jsx6("div", { className: "chat-column list-column", children: chats.length ? /* @__PURE__ */ jsx6("div", { className: "history-list", children: chats.map((chat) => {
|
|
1218
|
+
const active = chat.session_id === activeSessionId;
|
|
1219
|
+
const loading = chat.session_id === loadingSessionId;
|
|
1220
|
+
return /* @__PURE__ */ jsxs6(
|
|
1221
|
+
"button",
|
|
1222
|
+
{
|
|
1223
|
+
"aria-current": active ? "true" : void 0,
|
|
1224
|
+
className: `history-row${active ? " active" : ""}${loading ? " loading" : ""}`,
|
|
1225
|
+
onClick: () => onOpen(chat.session_id),
|
|
1226
|
+
type: "button",
|
|
1227
|
+
children: [
|
|
1228
|
+
/* @__PURE__ */ jsx6("strong", { children: chat.title }),
|
|
1229
|
+
/* @__PURE__ */ jsx6("span", { children: chat.preview ? stripMathForPreview(chat.preview, 120) : "\u6682\u65E0\u9884\u89C8" }),
|
|
1230
|
+
/* @__PURE__ */ jsx6("small", { children: loading ? "\u6B63\u5728\u6253\u5F00" : `${chat.message_count} \u6761\u6D88\u606F` })
|
|
1231
|
+
]
|
|
1232
|
+
},
|
|
1233
|
+
chat.session_id
|
|
1234
|
+
);
|
|
1235
|
+
}) }) : /* @__PURE__ */ jsx6("p", { className: "empty", children: "\u6682\u65E0\u5BF9\u8BDD\u3002\u521B\u5EFA\u65B0\u5BF9\u8BDD\u540E\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002" }) })
|
|
1214
1236
|
] });
|
|
1215
1237
|
}
|
|
1216
1238
|
|
|
@@ -1631,22 +1653,26 @@ function ChatView({
|
|
|
1631
1653
|
attachments,
|
|
1632
1654
|
attachmentPolicy,
|
|
1633
1655
|
composerError,
|
|
1656
|
+
busy: externalBusy,
|
|
1634
1657
|
connectionStatus,
|
|
1635
1658
|
gatewayLinked,
|
|
1636
1659
|
model,
|
|
1637
1660
|
agentStatus,
|
|
1661
|
+
debugPanels = true,
|
|
1638
1662
|
onDraftChange,
|
|
1639
1663
|
onFilesSelected,
|
|
1640
1664
|
onRemoveAttachment,
|
|
1641
1665
|
onSend,
|
|
1642
1666
|
onAbort,
|
|
1643
|
-
onSuggest
|
|
1667
|
+
onSuggest,
|
|
1668
|
+
onSettingsOpen
|
|
1644
1669
|
}) {
|
|
1645
|
-
const
|
|
1646
|
-
const
|
|
1670
|
+
const loadingSession = chat.status === "Loading";
|
|
1671
|
+
const busy = Boolean(chat.activeTurnId) || Boolean(externalBusy) || loadingSession;
|
|
1672
|
+
const ready = Boolean(chat.sessionId) && !loadingSession;
|
|
1647
1673
|
const usingMock = model?.provider === "mock";
|
|
1648
1674
|
const modelLabel = model ? model.model || model.display_name || model.provider : "loading model status";
|
|
1649
|
-
const debugUI = isDebugUIEnabled();
|
|
1675
|
+
const debugUI = debugPanels && isDebugUIEnabled();
|
|
1650
1676
|
return /* @__PURE__ */ jsxs11("section", { className: "cathygo-chat-panel chat-workspace", children: [
|
|
1651
1677
|
/* @__PURE__ */ jsx13(
|
|
1652
1678
|
ChatTopBar,
|
|
@@ -1657,7 +1683,8 @@ function ChatView({
|
|
|
1657
1683
|
agentStatus,
|
|
1658
1684
|
debugUI,
|
|
1659
1685
|
canAbort: Boolean(chat.activeTurnId),
|
|
1660
|
-
onAbort
|
|
1686
|
+
onAbort,
|
|
1687
|
+
onSettingsOpen
|
|
1661
1688
|
}
|
|
1662
1689
|
),
|
|
1663
1690
|
debugUI ? /* @__PURE__ */ jsxs11("div", { className: "chat-debug-panels", children: [
|
|
@@ -1681,7 +1708,7 @@ function ChatView({
|
|
|
1681
1708
|
)
|
|
1682
1709
|
] }) : null,
|
|
1683
1710
|
/* @__PURE__ */ jsxs11("div", { className: "chat-main", children: [
|
|
1684
|
-
/* @__PURE__ */ jsx13(
|
|
1711
|
+
loadingSession ? /* @__PURE__ */ jsx13(ChatSessionLoading, {}) : /* @__PURE__ */ jsx13(
|
|
1685
1712
|
ChatTranscript,
|
|
1686
1713
|
{
|
|
1687
1714
|
activeTurnId: chat.activeTurnId,
|
|
@@ -1691,6 +1718,7 @@ function ChatView({
|
|
|
1691
1718
|
onSuggest: ready && !busy ? onSuggest : void 0
|
|
1692
1719
|
}
|
|
1693
1720
|
),
|
|
1721
|
+
!loadingSession && chat.status === "Error" && chat.error ? /* @__PURE__ */ jsx13("p", { className: "chat-session-error", children: chat.error }) : null,
|
|
1694
1722
|
/* @__PURE__ */ jsx13(
|
|
1695
1723
|
MessageComposer,
|
|
1696
1724
|
{
|
|
@@ -1708,6 +1736,17 @@ function ChatView({
|
|
|
1708
1736
|
] })
|
|
1709
1737
|
] });
|
|
1710
1738
|
}
|
|
1739
|
+
function ChatSessionLoading() {
|
|
1740
|
+
return /* @__PURE__ */ jsx13("div", { className: "chat-transcript-wrap", children: /* @__PURE__ */ jsx13("section", { className: "chat-transcript", "aria-busy": "true", "aria-label": "\u6B63\u5728\u52A0\u8F7D\u4F1A\u8BDD", children: /* @__PURE__ */ jsxs11("div", { className: "chat-column session-loading", children: [
|
|
1741
|
+
/* @__PURE__ */ jsx13("div", { className: "session-loading-title" }),
|
|
1742
|
+
/* @__PURE__ */ jsx13("div", { className: "session-loading-line wide" }),
|
|
1743
|
+
/* @__PURE__ */ jsx13("div", { className: "session-loading-line" }),
|
|
1744
|
+
/* @__PURE__ */ jsxs11("div", { className: "session-loading-card", children: [
|
|
1745
|
+
/* @__PURE__ */ jsx13("div", {}),
|
|
1746
|
+
/* @__PURE__ */ jsx13("div", {})
|
|
1747
|
+
] })
|
|
1748
|
+
] }) }) });
|
|
1749
|
+
}
|
|
1711
1750
|
|
|
1712
1751
|
// src/CathyGOChatApp.tsx
|
|
1713
1752
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
@@ -1724,6 +1763,9 @@ function CathyGOChatApp({
|
|
|
1724
1763
|
gatewayLinked,
|
|
1725
1764
|
model,
|
|
1726
1765
|
agentStatus,
|
|
1766
|
+
activeSessionId,
|
|
1767
|
+
loadingSessionId,
|
|
1768
|
+
debugPanels = true,
|
|
1727
1769
|
homeAvatarSrc,
|
|
1728
1770
|
onDraftChange,
|
|
1729
1771
|
onFilesSelected,
|
|
@@ -1733,10 +1775,20 @@ function CathyGOChatApp({
|
|
|
1733
1775
|
onAbort,
|
|
1734
1776
|
onSuggest,
|
|
1735
1777
|
onOpenChat,
|
|
1736
|
-
onNewChat
|
|
1778
|
+
onNewChat,
|
|
1779
|
+
onSettingsOpen
|
|
1737
1780
|
}) {
|
|
1738
1781
|
if (screen === "history") {
|
|
1739
|
-
return /* @__PURE__ */ jsx14(
|
|
1782
|
+
return /* @__PURE__ */ jsx14(
|
|
1783
|
+
ChatListView,
|
|
1784
|
+
{
|
|
1785
|
+
activeSessionId,
|
|
1786
|
+
chats,
|
|
1787
|
+
loadingSessionId,
|
|
1788
|
+
onOpen: onOpenChat,
|
|
1789
|
+
onNewChat
|
|
1790
|
+
}
|
|
1791
|
+
);
|
|
1740
1792
|
}
|
|
1741
1793
|
if (screen === "home") {
|
|
1742
1794
|
return /* @__PURE__ */ jsx14(
|
|
@@ -1752,6 +1804,7 @@ function CathyGOChatApp({
|
|
|
1752
1804
|
gatewayLinked,
|
|
1753
1805
|
model,
|
|
1754
1806
|
agentStatus,
|
|
1807
|
+
onSettingsOpen,
|
|
1755
1808
|
onDraftChange,
|
|
1756
1809
|
onFilesSelected,
|
|
1757
1810
|
onRemoveAttachment,
|
|
@@ -1766,17 +1819,20 @@ function CathyGOChatApp({
|
|
|
1766
1819
|
draft,
|
|
1767
1820
|
attachments,
|
|
1768
1821
|
attachmentPolicy,
|
|
1822
|
+
busy,
|
|
1769
1823
|
composerError,
|
|
1770
1824
|
connectionStatus,
|
|
1771
1825
|
gatewayLinked,
|
|
1772
1826
|
model,
|
|
1773
1827
|
agentStatus,
|
|
1828
|
+
debugPanels,
|
|
1774
1829
|
onDraftChange,
|
|
1775
1830
|
onFilesSelected,
|
|
1776
1831
|
onRemoveAttachment,
|
|
1777
1832
|
onSend: onSendMessage,
|
|
1778
1833
|
onAbort,
|
|
1779
|
-
onSuggest
|
|
1834
|
+
onSuggest,
|
|
1835
|
+
onSettingsOpen
|
|
1780
1836
|
}
|
|
1781
1837
|
);
|
|
1782
1838
|
}
|
|
@@ -1805,6 +1861,19 @@ function reduceChat(state, action) {
|
|
|
1805
1861
|
errorCode: void 0
|
|
1806
1862
|
};
|
|
1807
1863
|
}
|
|
1864
|
+
if (action.type === "session.loading") {
|
|
1865
|
+
return {
|
|
1866
|
+
...state,
|
|
1867
|
+
sessionId: action.sessionId,
|
|
1868
|
+
activeTurnId: void 0,
|
|
1869
|
+
messages: [],
|
|
1870
|
+
activitiesByTurnId: {},
|
|
1871
|
+
progressByTurnId: {},
|
|
1872
|
+
status: "Loading",
|
|
1873
|
+
error: void 0,
|
|
1874
|
+
errorCode: void 0
|
|
1875
|
+
};
|
|
1876
|
+
}
|
|
1808
1877
|
if (action.type === "session.loaded") {
|
|
1809
1878
|
return {
|
|
1810
1879
|
...state,
|
|
@@ -1818,6 +1887,17 @@ function reduceChat(state, action) {
|
|
|
1818
1887
|
errorCode: void 0
|
|
1819
1888
|
};
|
|
1820
1889
|
}
|
|
1890
|
+
if (action.type === "session.load.failed") {
|
|
1891
|
+
return {
|
|
1892
|
+
...state,
|
|
1893
|
+
sessionId: action.sessionId,
|
|
1894
|
+
activeTurnId: void 0,
|
|
1895
|
+
progressByTurnId: {},
|
|
1896
|
+
status: "Error",
|
|
1897
|
+
error: action.error,
|
|
1898
|
+
errorCode: action.code
|
|
1899
|
+
};
|
|
1900
|
+
}
|
|
1821
1901
|
if (action.type === "user.sent") {
|
|
1822
1902
|
return {
|
|
1823
1903
|
...state,
|
package/dist/styles.css
CHANGED
|
@@ -240,6 +240,25 @@
|
|
|
240
240
|
padding: 5px 12px;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
+
.chat-topbar-icon-btn {
|
|
244
|
+
align-items: center;
|
|
245
|
+
background: transparent;
|
|
246
|
+
border: 1px solid var(--border-subtle);
|
|
247
|
+
border-radius: 50%;
|
|
248
|
+
color: var(--text-muted);
|
|
249
|
+
cursor: pointer;
|
|
250
|
+
display: inline-flex;
|
|
251
|
+
flex-shrink: 0;
|
|
252
|
+
height: 32px;
|
|
253
|
+
justify-content: center;
|
|
254
|
+
width: 32px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.chat-topbar-icon-btn:hover {
|
|
258
|
+
background: var(--bg-hover);
|
|
259
|
+
color: var(--text-primary);
|
|
260
|
+
}
|
|
261
|
+
|
|
243
262
|
.chat-topbar-abort:hover {
|
|
244
263
|
background: var(--bg-hover);
|
|
245
264
|
}
|
|
@@ -469,6 +488,68 @@
|
|
|
469
488
|
background: var(--bg-hover);
|
|
470
489
|
}
|
|
471
490
|
|
|
491
|
+
.session-loading {
|
|
492
|
+
gap: 14px;
|
|
493
|
+
margin-top: 72px;
|
|
494
|
+
max-width: 40rem;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.session-loading-title,
|
|
498
|
+
.session-loading-line,
|
|
499
|
+
.session-loading-card {
|
|
500
|
+
animation: session-loading-pulse 1.2s ease-in-out infinite;
|
|
501
|
+
background: linear-gradient(90deg, #ececf1 0%, #f7f7f8 48%, #ececf1 100%);
|
|
502
|
+
background-size: 200% 100%;
|
|
503
|
+
border-radius: 8px;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.session-loading-title {
|
|
507
|
+
height: 28px;
|
|
508
|
+
width: 180px;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.session-loading-line {
|
|
512
|
+
height: 16px;
|
|
513
|
+
width: 68%;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.session-loading-line.wide {
|
|
517
|
+
width: 92%;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.session-loading-card {
|
|
521
|
+
border-radius: 12px;
|
|
522
|
+
display: grid;
|
|
523
|
+
gap: 12px;
|
|
524
|
+
margin-left: auto;
|
|
525
|
+
min-height: 132px;
|
|
526
|
+
padding: 18px;
|
|
527
|
+
width: min(360px, 80%);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
.session-loading-card div {
|
|
531
|
+
background: rgba(255, 255, 255, 0.65);
|
|
532
|
+
border-radius: 7px;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.chat-session-error {
|
|
536
|
+
color: #b42318;
|
|
537
|
+
font-size: 14px;
|
|
538
|
+
margin: 0 auto 8px;
|
|
539
|
+
max-width: var(--chat-column-width);
|
|
540
|
+
padding: 0 20px;
|
|
541
|
+
width: 100%;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
@keyframes session-loading-pulse {
|
|
545
|
+
0% {
|
|
546
|
+
background-position: 100% 0;
|
|
547
|
+
}
|
|
548
|
+
100% {
|
|
549
|
+
background-position: -100% 0;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
472
553
|
.empty-chat h2,
|
|
473
554
|
.empty-state h1 {
|
|
474
555
|
color: #1f2937;
|
|
@@ -1293,10 +1374,19 @@
|
|
|
1293
1374
|
width: 100%;
|
|
1294
1375
|
}
|
|
1295
1376
|
|
|
1296
|
-
.history-row:hover
|
|
1377
|
+
.history-row:hover,
|
|
1378
|
+
.history-row.active {
|
|
1297
1379
|
background: var(--bg-hover);
|
|
1298
1380
|
}
|
|
1299
1381
|
|
|
1382
|
+
.history-row.active {
|
|
1383
|
+
box-shadow: inset 3px 0 0 #2563eb;
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
.history-row.loading small {
|
|
1387
|
+
color: #2563eb;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1300
1390
|
.list-surface {
|
|
1301
1391
|
align-content: start;
|
|
1302
1392
|
display: grid;
|