Skip to content

Commit c1955bc

Browse files
fix(chat): increase title truncation length to 80 chars
Co-Authored-By: open-agents-bot[bot] <260704009+open-agents-bot[bot]@users.noreply.github.com>
1 parent cdd8119 commit c1955bc

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

apps/web/app/api/chat/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ async function persistLatestUserMessage(
383383

384384
if (textContent.length > 0) {
385385
const title =
386-
textContent.length > 30
387-
? `${textContent.slice(0, 30)}...`
386+
textContent.length > 80
387+
? `${textContent.slice(0, 80)}...`
388388
: textContent;
389389
await updateChat(chatId, { title });
390390
}

apps/web/app/sessions/[sessionId]/chats/[chatId]/session-chat-content.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3925,8 +3925,8 @@ export function SessionChatContent({
39253925
trimmedText.length > 0
39263926
) {
39273927
const nextTitle =
3928-
trimmedText.length > 30
3929-
? `${trimmedText.slice(0, 30)}...`
3928+
trimmedText.length > 80
3929+
? `${trimmedText.slice(0, 80)}...`
39303930
: trimmedText;
39313931
pendingOptimisticTitleChatIdRef.current =
39323932
chatInfo.id;

apps/web/app/workflows/chat-post-finish.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,17 @@ describe("persistUserMessage", () => {
174174
});
175175
});
176176

177-
test("truncates title when text exceeds 30 chars", async () => {
177+
test("truncates title when text exceeds 80 chars", async () => {
178178
isFirstChatMessageResult = true;
179-
const longText = "A".repeat(50);
179+
const longText = "A".repeat(100);
180180
const msg = makeUserMessage({
181181
parts: [{ type: "text", text: longText }],
182182
});
183183

184184
await persistUserMessage("chat-1", msg);
185185

186186
expect(spies.updateChat).toHaveBeenCalledWith("chat-1", {
187-
title: `${"A".repeat(30)}...`,
187+
title: `${"A".repeat(80)}...`,
188188
});
189189
});
190190

apps/web/app/workflows/chat-post-finish.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export async function persistUserMessage(
124124
}
125125

126126
const title =
127-
textContent.length > 30 ? `${textContent.slice(0, 30)}...` : textContent;
127+
textContent.length > 80 ? `${textContent.slice(0, 80)}...` : textContent;
128128
await updateChat(chatId, { title });
129129
} catch (error) {
130130
console.error("[workflow] Failed to persist user message:", error);

0 commit comments

Comments
 (0)