Skip to content

Commit a4847a1

Browse files
author
Jicheng Lu
committed
refine conv loading
1 parent 23a3460 commit a4847a1

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

src/routes/page/conversation/+page.svelte

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,27 @@
102102
};
103103
104104
isLoading = true;
105-
Promise.all([
106-
loadAgentOptions(),
107-
loadSearchOption(),
108-
loadConversations()])
109-
.finally(() => {
110-
isLoading = false
111-
});
105+
try {
106+
const [agents] = await Promise.all([
107+
loadAgentOptions(),
108+
loadSearchOption()
109+
]);
110+
111+
searchOption = {
112+
...searchOption,
113+
agentIds: agents?.length > 0 ? [agents[0].value] : []
114+
};
115+
filter = {
116+
...filter,
117+
agentIds: searchOption.agentIds
118+
};
119+
120+
await loadConversations();
121+
} catch (error) {
122+
console.error('Error loading conversation data:', error);
123+
} finally {
124+
isLoading = false;
125+
}
112126
});
113127
114128
function loadConversations() {

0 commit comments

Comments
 (0)