Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix: prevent listArtifacts failure from breaking chat message loading

Gener341c7bb58a17
diff --git a/src/web/src/components/agent-chat/agent-chat-view.tsx b/src/web/src/components/agent-chat/agent-chat-view.tsx
index 483b2f8a0..094626365 100644
--- a/src/web/src/components/agent-chat/agent-chat-view.tsx
+++ b/src/web/src/components/agent-chat/agent-chat-view.tsx
@@ -156,13 +156,20 @@ export function AgentChatView() {
try {
const conv = await getOrCreateAgentConversation(agentId, workspaceId);
setConversation(conv);
- const [msgs, arts] = await Promise.all([
+ const [msgs, arts] = await Promise.allSettled([
listMessages(conv.id, workspaceId, { limit: MESSAGE_LIMIT }),
listArtifacts(conv.id, workspaceId),
]);
- setMessages(msgs);
- setArtifacts(arts);
- setHasMore(msgs.length >= MESSAGE_LIMIT);
+
+ if (msgs.status === "fulfilled") {
+ setMessages(msgs.value);
+ setHasMore(msgs.value.length >= MESSAGE_LIMIT);
+ } else {
+ toast.error("Failed to load messages");
+ }
+ if (arts.status === "fulfilled") {
+ setArtifacts(arts.value);
+ }
// Recover active task (e.g. after page refresh)
const task = await getActiveTask(conv.id, workspaceId);