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
|
QR Code
|
||||||
=========================================== */
|
=========================================== */
|
||||||
|
|||||||
@ -497,6 +497,23 @@ export function renderApp(state: AppViewState) {
|
|||||||
onSplitRatioChange: (ratio: number) => state.handleSplitRatioChange(ratio),
|
onSplitRatioChange: (ratio: number) => state.handleSplitRatioChange(ratio),
|
||||||
assistantName: state.assistantName,
|
assistantName: state.assistantName,
|
||||||
assistantAvatar: state.assistantAvatar,
|
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}
|
: nothing}
|
||||||
|
|
||||||
|
|||||||
@ -68,6 +68,9 @@ export type ChatProps = {
|
|||||||
onCloseSidebar?: () => void;
|
onCloseSidebar?: () => void;
|
||||||
onSplitRatioChange?: (ratio: number) => void;
|
onSplitRatioChange?: (ratio: number) => void;
|
||||||
onChatScroll?: (event: Event) => void;
|
onChatScroll?: (event: Event) => void;
|
||||||
|
// Delete session
|
||||||
|
isMainSession?: boolean;
|
||||||
|
onDelete?: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const COMPACTION_TOAST_DURATION_MS = 5000;
|
const COMPACTION_TOAST_DURATION_MS = 5000;
|
||||||
@ -361,6 +364,22 @@ export function renderChat(props: ChatProps) {
|
|||||||
>
|
>
|
||||||
${canAbort ? "Stop" : "New session"}
|
${canAbort ? "Stop" : "New session"}
|
||||||
</button>
|
</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
|
<button
|
||||||
class="btn primary"
|
class="btn primary"
|
||||||
?disabled=${!props.connected}
|
?disabled=${!props.connected}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user