ui(sessions): support editing session labels
Expose session "label" as an editable field in the Sessions view and persist changes via sessions.patch.
This commit is contained in:
@@ -43,6 +43,7 @@ export async function patchSession(
|
|||||||
state: SessionsState,
|
state: SessionsState,
|
||||||
key: string,
|
key: string,
|
||||||
patch: {
|
patch: {
|
||||||
|
label?: string | null;
|
||||||
thinkingLevel?: string | null;
|
thinkingLevel?: string | null;
|
||||||
verboseLevel?: string | null;
|
verboseLevel?: string | null;
|
||||||
reasoningLevel?: string | null;
|
reasoningLevel?: string | null;
|
||||||
@@ -50,6 +51,7 @@ export async function patchSession(
|
|||||||
) {
|
) {
|
||||||
if (!state.client || !state.connected) return;
|
if (!state.client || !state.connected) return;
|
||||||
const params: Record<string, unknown> = { key };
|
const params: Record<string, unknown> = { key };
|
||||||
|
if ("label" in patch) params.label = patch.label;
|
||||||
if ("thinkingLevel" in patch) params.thinkingLevel = patch.thinkingLevel;
|
if ("thinkingLevel" in patch) params.thinkingLevel = patch.thinkingLevel;
|
||||||
if ("verboseLevel" in patch) params.verboseLevel = patch.verboseLevel;
|
if ("verboseLevel" in patch) params.verboseLevel = patch.verboseLevel;
|
||||||
if ("reasoningLevel" in patch) params.reasoningLevel = patch.reasoningLevel;
|
if ("reasoningLevel" in patch) params.reasoningLevel = patch.reasoningLevel;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export type SessionsProps = {
|
|||||||
onPatch: (
|
onPatch: (
|
||||||
key: string,
|
key: string,
|
||||||
patch: {
|
patch: {
|
||||||
|
label?: string | null;
|
||||||
thinkingLevel?: string | null;
|
thinkingLevel?: string | null;
|
||||||
verboseLevel?: string | null;
|
verboseLevel?: string | null;
|
||||||
reasoningLevel?: string | null;
|
reasoningLevel?: string | null;
|
||||||
@@ -195,7 +196,17 @@ function renderRow(
|
|||||||
<div class="mono">${canLink
|
<div class="mono">${canLink
|
||||||
? html`<a href=${chatUrl} class="session-link">${displayName}</a>`
|
? html`<a href=${chatUrl} class="session-link">${displayName}</a>`
|
||||||
: displayName}</div>
|
: displayName}</div>
|
||||||
<div>${row.label ?? ""}</div>
|
<div>
|
||||||
|
<input
|
||||||
|
.value=${row.label ?? ""}
|
||||||
|
?disabled=${disabled}
|
||||||
|
placeholder="(optional)"
|
||||||
|
@change=${(e: Event) => {
|
||||||
|
const value = (e.target as HTMLInputElement).value.trim();
|
||||||
|
onPatch(row.key, { label: value || null });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div>${row.kind}</div>
|
<div>${row.kind}</div>
|
||||||
<div>${updated}</div>
|
<div>${updated}</div>
|
||||||
<div>${formatSessionTokens(row)}</div>
|
<div>${formatSessionTokens(row)}</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user