MCPcopy Create free account
hub / github.com/TanStack/ai / truncateTitle

Function truncateTitle

examples/ts-react-chat/src/routes/threads.tsx:146–151  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

144const byRecency = (a: ThreadMeta, b: ThreadMeta) => b.updatedAt - a.updatedAt
145
146function truncateTitle(text: string): string {
147 const trimmed = text.trim()
148 return trimmed.length > TITLE_MAX
149 ? `${trimmed.slice(0, TITLE_MAX).trimEnd()}…`
150 : trimmed
151}
152
153function relativeTime(ts: number): string {
154 const seconds = Math.floor((Date.now() - ts) / 1000)

Callers 1

touchThreadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected