feat(chat): show provider thinking traces (#11784)
Co-authored-by: maria-rcks <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Cursor <[email protected]>
This commit is contained in:
32 files changed
+1923
-117
No files matched your search
@@ -2,7 +2,7 @@ import type { ChatAttachment } from "@t3tools/contracts";
|
||||
import { assistantCitationsToPlainText } from "@t3tools/shared/assistantCitations";
|
||||
|
||||
export type ThreadTitleMessage = {
|
||||
readonly role: "user" | "assistant" | "system";
|
||||
readonly role: "user" | "assistant" | "system" | "reasoning";
|
||||
readonly text: string;
|
||||
readonly attachments?: ReadonlyArray<ChatAttachment> | undefined;
|
||||
};
|
||||
@@ -25,7 +25,13 @@ export function limitTitleMessage(text: string, budget: number): string {
|
||||
/** Reserve space for user intent before adding assistant findings, in conversation order. */
|
||||
export function formatThreadTitleContext(messages: ReadonlyArray<ThreadTitleMessage>) {
|
||||
const sections = messages.flatMap((message, index) => {
|
||||
if (message.role === "system" || (!message.text.trim() && !message.attachments?.length))
|
||||
// Thinking traces are working notes, not what the thread is about, and they
|
||||
// dwarf the answer they precede. Titling on them would be worse and costlier.
|
||||
if (
|
||||
message.role === "system" ||
|
||||
message.role === "reasoning" ||
|
||||
(!message.text.trim() && !message.attachments?.length)
|
||||
)
|
||||
return [];
|
||||
return [{ index, message, prefix: `${message.role.toUpperCase()}:\n` }];
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user