}
onClick={() => {
if (agent.isRequesting()) {
message.error(
'Message is Requesting, you can create a new conversation after request done or abort it right now...',
);
return;
}
if (messages?.length) {
const timeNow = dayjs().valueOf().toString();
abortController.current?.abort();
// The abort execution will trigger an asynchronous requestFallback, which may lead to timing issues.
// In future versions, the sessionId capability will be added to resolve this problem.
setTimeout(() => {
setSessionList([
{ key: timeNow, label: 'New session', group: 'Today' },
...sessionList,
]);
setCurSession(timeNow);
setMessages([]);
}, 100);
} else {
message.error('It is now a new conversation.');
}
}}
className={styles.headerButton}
/>
i.key === curSession ? { ...i, label: `[current] ${i.label}` } : i,
)}
activeKey={curSession}
groupable
onActiveChange={async (val) => {
abortController.current?.abort();
// The abort execution will trigger an asynchronous requestFallback, which may lead to timing issues.
// In future versions, the sessionId capability will be added to resolve this problem.
setTimeout(() => {
setCurSession(val);
setMessages(messageHistory?.[val] || []);
}, 100);
}}
styles={{ item: { padding: '0 8px' } }}
className={styles.conversations}
/>
}
>
} className={styles.headerButton} />
}
onClick={() => setCopilotOpen(false)}
className={styles.headerButton}
/>