fix(cli): preserve spacing in thinking/assistant blocks during streaming (#802)
Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
@@ -5,12 +5,12 @@ import { MarkdownDisplay } from "./MarkdownDisplay.js";
|
||||
import { Text } from "./Text";
|
||||
|
||||
// Helper function to normalize text - copied from old codebase
|
||||
// NOTE: Less aggressive than before to preserve spacing when content is split across chunks
|
||||
const normalize = (s: string) =>
|
||||
s
|
||||
.replace(/\r\n/g, "\n")
|
||||
.replace(/[ \t]+$/gm, "")
|
||||
.replace(/\n{3,}/g, "\n\n")
|
||||
.replace(/^\n+|\n+$/g, "");
|
||||
.replace(/^\n+/g, ""); // Only trim leading newlines, preserve trailing ones
|
||||
|
||||
type AssistantLine = {
|
||||
kind: "assistant";
|
||||
|
||||
@@ -5,12 +5,12 @@ import { MarkdownDisplay } from "./MarkdownDisplay.js";
|
||||
import { Text } from "./Text";
|
||||
|
||||
// Helper function to normalize text - copied from old codebase
|
||||
// NOTE: Less aggressive than before to preserve spacing when content is split across chunks
|
||||
const normalize = (s: string) =>
|
||||
s
|
||||
.replace(/\r\n/g, "\n")
|
||||
.replace(/[ \t]+$/gm, "")
|
||||
.replace(/\n{3,}/g, "\n\n")
|
||||
.replace(/^\n+|\n+$/g, "");
|
||||
.replace(/^\n+/g, ""); // Only trim leading newlines, preserve trailing ones
|
||||
|
||||
type ReasoningLine = {
|
||||
kind: "reasoning";
|
||||
|
||||
Reference in New Issue
Block a user