fix: feedback buttons always visible, thread title update for untitled threads
Trigger auto deployment for soc-langgraph / build-and-deploy (push) Failing after 30s
Deploy LangGraph UI to Azure Static Web Apps / build-and-deploy (push) Failing after 34s

- Remove opacity-0 group-hover from ThumbsUp/ThumbsDown buttons — always visible
- Fix thread title: update title whenever currentTitle is empty, not just first message

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gongzhiyong
2026-04-14 01:29:27 +08:00
co-authored by Claude Opus 4.6
parent d53655c180
commit eb200cbdfd
+19 -16
View File
@@ -153,7 +153,7 @@ function FeedbackButtons({ messageId }: { messageId: string }) {
"inline-flex items-center text-xs px-1.5 py-0.5 rounded transition-colors",
feedback === "up"
? "text-green-600 bg-green-100 dark:bg-green-900/30"
: "opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-foreground hover:bg-accent",
: "text-muted-foreground hover:text-foreground hover:bg-accent",
)}
title="有帮助"
>
@@ -166,7 +166,7 @@ function FeedbackButtons({ messageId }: { messageId: string }) {
"inline-flex items-center text-xs px-1.5 py-0.5 rounded transition-colors",
feedback === "down"
? "text-red-600 bg-red-100 dark:bg-red-900/30"
: "opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-foreground hover:bg-accent",
: "text-muted-foreground hover:text-foreground hover:bg-accent",
)}
title="无帮助"
>
@@ -588,20 +588,23 @@ function App() {
},
);
if (isFirstMessage && currentThreadId) {
// Smart title: truncate at word/punctuation boundary instead of mid-word
const rawTitle = text.slice(0, 30);
const boundaryMatch = rawTitle.match(/^(.{10,}?)[,。!?、;:\s,.!?;:]/);
const titleText = boundaryMatch ? boundaryMatch[1] : rawTitle.replace(/\s+\S*$/, "") || rawTitle;
client.threads.update(currentThreadId, { metadata: { title: titleText } }).catch(() => {});
try { localStorage.setItem(`title_${currentThreadId}`, titleText); } catch { /* ignore */ }
setThreads((prev) =>
prev.map((t) =>
t.thread_id === currentThreadId
? { ...t, metadata: { ...t.metadata, title: titleText } }
: t,
),
);
// Always set title if thread doesn't have one yet
if (currentThreadId && text) {
const currentTitle = threads.find((t) => t.thread_id === currentThreadId)?.metadata?.title;
if (!currentTitle || activeMessages.length === 0) {
const rawTitle = text.slice(0, 30);
const boundaryMatch = rawTitle.match(/^(.{10,}?)[,。!?、;:\s,.!?;:]/);
const titleText = boundaryMatch ? boundaryMatch[1] : rawTitle.replace(/\s+\S*$/, "") || rawTitle;
client.threads.update(currentThreadId, { metadata: { title: titleText } }).catch(() => {});
try { localStorage.setItem(`title_${currentThreadId}`, titleText); } catch { /* ignore */ }
setThreads((prev) =>
prev.map((t) =>
t.thread_id === currentThreadId
? { ...t, metadata: { ...t.metadata, title: titleText } }
: t,
),
);
}
}
}