MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / createBotRequest

Function createBotRequest

apps/web/src/lib/bot/request-logging.ts:31–52  ·  view source on GitHub ↗
(params: CreateBotRequestParams)

Source from the content-addressed store, hash-verified

29 * on this row existing, so a silent failure here would drop the result.
30 */
31export async function createBotRequest(params: CreateBotRequestParams): Promise<string> {
32 const [row] = await db
33 .insert(bot_requests)
34 .values({
35 created_by: params.createdBy,
36 organization_id: params.organizationId,
37 platform_integration_id: params.platformIntegrationId,
38 platform: params.platform,
39 platform_thread_id: params.platformThreadId,
40 platform_message_id: params.platformMessageId,
41 user_message: params.userMessage,
42 model_used: params.modelUsed ?? null,
43 status: 'pending',
44 })
45 .returning({ id: bot_requests.id });
46
47 if (!row) {
48 throw new Error('createBotRequest: insert returned no row');
49 }
50
51 return row.id;
52}
53
54type UpdateBotRequestParams = {
55 status?: BotRequestStatus;

Callers 1

processLinkedMessageFunction · 0.90

Calls 1

valuesMethod · 0.65

Tested by

no test coverage detected