MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / getLatestUserPrompt

Function getLatestUserPrompt

desktop/runtime/thread-publisher.ts:186–202  ·  view source on GitHub ↗
(thread: ThreadData)

Source from the content-addressed store, hash-verified

184}
185
186function getLatestUserPrompt(thread: ThreadData) {
187 let latestUserMessage: ProseMessage | undefined
188 for (let index = thread.messages.length - 1; index >= 0; index -= 1) {
189 const message = thread.messages[index]
190 if (message?.role === 'user') {
191 latestUserMessage = message as ProseMessage
192 break
193 }
194 }
195
196 if (!latestUserMessage) {
197 return null
198 }
199
200 const prompt = latestUserMessage.content.join('\n\n').trim()
201 return prompt.length > 0 ? prompt : null
202}
203
204export function normalizeThreadDataForReason(
205 thread: ThreadData,

Callers 3

updateInboxStartStateFunction · 0.70
updateInboxEndStateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected