mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-17 14:01:25 +00:00
feat: add end session button to chat header
This commit is contained in:
parent
53a06becb1
commit
962512a0db
3 changed files with 29 additions and 1 deletions
|
|
@ -548,6 +548,16 @@ export default function App() {
|
|||
}
|
||||
};
|
||||
|
||||
const endSession = async () => {
|
||||
if (!sessionId) return;
|
||||
try {
|
||||
await getClient().terminateSession(sessionId);
|
||||
await fetchSessions();
|
||||
} catch (error) {
|
||||
setSessionError(getErrorMessage(error, "Unable to end session"));
|
||||
}
|
||||
};
|
||||
|
||||
const questionRequests = useMemo(() => {
|
||||
const latestById = new Map<string, QuestionEventData>();
|
||||
for (const event of events) {
|
||||
|
|
@ -859,6 +869,7 @@ export default function App() {
|
|||
onVariantChange={setVariant}
|
||||
onStreamModeChange={setStreamMode}
|
||||
onToggleStream={toggleStream}
|
||||
onEndSession={endSession}
|
||||
hasSession={Boolean(sessionId)}
|
||||
eventError={eventError}
|
||||
questionRequests={questionRequests}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue