( history: ChatHistoryItem[], prompt?: string | null, )
| 56 | * messages already exist (e.g., after resume), skip to avoid replaying. |
| 57 | */ |
| 58 | export function shouldQueueInitialPrompt( |
| 59 | history: ChatHistoryItem[], |
| 60 | prompt?: string | null, |
| 61 | ): boolean { |
| 62 | if (!prompt) { |
| 63 | return false; |
| 64 | } |
| 65 | |
| 66 | // If there are any non-system messages, we already have conversation context |
| 67 | const hasConversation = history.some( |
| 68 | (item) => item.message.role !== "system", |
| 69 | ); |
| 70 | return !hasConversation; |
| 71 | } |
| 72 | |
| 73 | // eslint-disable-next-line max-statements |
| 74 | export async function serve(prompt?: string, options: ServeOptions = {}) { |
no outgoing calls
no test coverage detected