Merge 7813aebc1a into da71eaebd2
This commit is contained in:
commit
1c2f3787ef
@ -1369,6 +1369,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.chat-compose__row {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.chat-compose__actions {
|
||||
gap: 4px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.chat-compose__actions .btn {
|
||||
padding: 4px 8px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.chat-compose__actions .btn-kbd {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===========================================
|
||||
QR Code
|
||||
=========================================== */
|
||||
|
||||
@ -497,6 +497,23 @@ export function renderApp(state: AppViewState) {
|
||||
onSplitRatioChange: (ratio: number) => state.handleSplitRatioChange(ratio),
|
||||
assistantName: state.assistantName,
|
||||
assistantAvatar: state.assistantAvatar,
|
||||
// Delete session (disabled for main session)
|
||||
isMainSession:
|
||||
state.sessionKey === "main" ||
|
||||
parseAgentSessionKey(state.sessionKey)?.rest === "main",
|
||||
onDelete: async () => {
|
||||
const { deleteSession } = await import("./controllers/sessions");
|
||||
await deleteSession(state as Parameters<typeof deleteSession>[0], state.sessionKey);
|
||||
// Switch to main session after deletion
|
||||
const mainKey = state.sessionsResult?.mainSessionKey ?? "main";
|
||||
state.sessionKey = mainKey;
|
||||
state.applySettings({
|
||||
...state.settings,
|
||||
sessionKey: mainKey,
|
||||
lastActiveSessionKey: mainKey,
|
||||
});
|
||||
void loadChatHistory(state);
|
||||
},
|
||||
})
|
||||
: nothing}
|
||||
|
||||
|
||||
@ -68,6 +68,9 @@ export type ChatProps = {
|
||||
onCloseSidebar?: () => void;
|
||||
onSplitRatioChange?: (ratio: number) => void;
|
||||
onChatScroll?: (event: Event) => void;
|
||||
// Delete session
|
||||
isMainSession?: boolean;
|
||||
onDelete?: () => void;
|
||||
};
|
||||
|
||||
const COMPACTION_TOAST_DURATION_MS = 5000;
|
||||
@ -361,6 +364,22 @@ export function renderChat(props: ChatProps) {
|
||||
>
|
||||
${canAbort ? "Stop" : "New session"}
|
||||
</button>
|
||||
${props.onDelete
|
||||
? html`
|
||||
<button
|
||||
class="btn"
|
||||
?disabled=${!props.connected || isBusy || props.isMainSession}
|
||||
@click=${() => {
|
||||
if (confirm(`Delete session "${props.sessionKey}"?`)) {
|
||||
props.onDelete!();
|
||||
}
|
||||
}}
|
||||
title=${props.isMainSession ? "Cannot delete main session" : "Delete this session"}
|
||||
>
|
||||
🗑
|
||||
</button>
|
||||
`
|
||||
: nothing}
|
||||
<button
|
||||
class="btn primary"
|
||||
?disabled=${!props.connected}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user