MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / getFirstUserPrompt

Function getFirstUserPrompt

cli/src/utils/chat-history.ts:23–35  ·  view source on GitHub ↗

* Get the first user message from a list of chat messages

(messages: ChatMessage[])

Source from the content-addressed store, hash-verified

21 * Get the first user message from a list of chat messages
22 */
23function getFirstUserPrompt(messages: ChatMessage[]): string {
24 for (const msg of messages) {
25 if (msg?.variant === 'user' && msg.content) {
26 // Truncate long prompts
27 const content = msg.content.trim()
28 if (content.length > 100) {
29 return content.slice(0, 97) + '...'
30 }
31 return content
32 }
33 }
34 return '(empty chat)'
35}
36
37interface ChatDirInfo {
38 chatId: string

Callers 1

getAllChatsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected