()
| 322 | } |
| 323 | |
| 324 | async function ensureConversation() { |
| 325 | const conversations = await listConversations(); |
| 326 | const existing = conversations.find( |
| 327 | (conversation) => conversation.channelId === DEFAULT_WEB_CHANNEL_ID, |
| 328 | ); |
| 329 | if (existing) { |
| 330 | return existing.channelId; |
| 331 | } |
| 332 | |
| 333 | const created = await createConversation(); |
| 334 | return created.channelId || DEFAULT_WEB_CHANNEL_ID; |
| 335 | } |
| 336 | |
| 337 | async function loadConversationHistory(channelId) { |
| 338 | const messages = await getConversationMessages(channelId, 200); |
no test coverage detected