From 0eaced4d5acc73a5eabc6007271aeeaf986114aa Mon Sep 17 00:00:00 2001 From: weichen Date: Sat, 3 Oct 2026 17:02:00 +0000 Subject: [PATCH] Switch session permission mode beside the composer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: Plan, default, and auto-edit have to be visible where the user sends a message, and confirmation cards need to show the arguments. Evidence: The mode control and card detail only use existing color, radius, and type tokens. Impact: An empty mode still renders as 默认. Confirm cards use the wait color instead of the success color. Refs: feature/permission-hooks Co-authored-by: Cursor --- src/api.ts | 1 + src/components/Conversation.tsx | 16 +++++++++++++++- src/contracts.ts | 2 ++ src/store.ts | 6 ++++++ src/styles.css | 5 +++++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/api.ts b/src/api.ts index 064d5df..30af7b7 100644 --- a/src/api.ts +++ b/src/api.ts @@ -27,6 +27,7 @@ export const api = { // 跨项目任务列表(方案 A 侧栏):默认仅未归档;includeArchived 含归档。 listTasks: (includeArchived?: boolean) => auth.fetch(`${BASE}/api/conversations${includeArchived ? '?archived=1' : ''}`).then(r => json(r)), setConversationFlags: (id: string, flags: { pinned?: boolean; archived?: boolean; allowCrossRead?: boolean; crossPrivate?: boolean }) => auth.fetch(`${BASE}/api/conversations/${id}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(flags) }).then(r => { if (!r.ok) throw new Error(`${r.status}: ${r.statusText}`) }), + setPermissionMode: (id: string, permissionMode: string) => auth.fetch(`${BASE}/api/conversations/${id}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ permissionMode }) }).then(r => { if (!r.ok) throw new Error(`${r.status}: ${r.statusText}`) }), me: () => auth.fetch(`${BASE}/api/me`).then(r => json<{ owner: string; name: string; auth: boolean; isAdmin?: boolean; mustChangePassword?: boolean }>(r)), // ---- 认证与会话(管理员发放制,R2)---- login: (owner: string, password: string) => auth.fetch(`${BASE}/api/auth/login`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ owner, password }) }).then(async r => { diff --git a/src/components/Conversation.tsx b/src/components/Conversation.tsx index 0b2a214..3103106 100644 --- a/src/components/Conversation.tsx +++ b/src/components/Conversation.tsx @@ -315,8 +315,9 @@ function HITLCardView({ card }: { card: HITLCard }) { setSubmitting(false) } return ( -
+
{card.question}
+ {card.detail &&
{card.detail}
} {card.choices && (
{card.choices.map(c => ( @@ -579,6 +580,19 @@ export function Conversation() { )} {text.startsWith('/') && setText(c)} />}
+