Keep Discord mention ingestion alive without RAG

This commit is contained in:
Meta Vens 2026-07-05 22:34:33 +01:00
commit c5953cf07f
2 changed files with 17 additions and 6 deletions

View file

@ -335,7 +335,7 @@ export async function startBot(): Promise<void> {
const isDirectMessage = !message.inGuild();
await ingestIfIndexed(
await safelyIngestIfIndexed("message-create",
message,
config.channelIndexing,
ragPipeline,
@ -502,7 +502,7 @@ export async function startBot(): Promise<void> {
return;
}
await ingestIfIndexed(
await safelyIngestIfIndexed("message-update",
materializedMessage,
config.channelIndexing,
ragPipeline,
@ -713,6 +713,17 @@ export async function startBot(): Promise<void> {
await client.login(config.botToken);
}
async function safelyIngestIfIndexed(
context: string,
...args: Parameters<typeof ingestIfIndexed>
): Promise<void> {
try {
await ingestIfIndexed(...args);
} catch (error) {
console.error(`[${context}] Discord archive ingest failed; continuing without indexing.`, error);
}
}
async function resolveRepliedRepoIdentity(
message: Message,
registry: { identities: RepoDiscordIdentity[] },

View file

@ -685,10 +685,10 @@ function renderValueDetail(value) {
function projectPendingMention(mention) {
return {
identityId: stringOrNull(mention?.identityId),
sourceChannelId: stringOrNull(mention?.sourceChannelId),
sourceMessageId: stringOrNull(mention?.sourceMessageId),
createdAt: stringOrNull(mention?.createdAt),
prompt: truncate(String(mention?.prompt ?? mention?.content ?? ""), 220),
sourceChannelId: stringOrNull(mention?.sourceChannelId ?? mention?.channelId),
sourceMessageId: stringOrNull(mention?.sourceMessageId ?? mention?.messageId),
createdAt: stringOrNull(mention?.createdAt ?? mention?.queuedAt),
prompt: truncate(String(mention?.prompt ?? mention?.visiblePrompt ?? mention?.content ?? ""), 220),
};
}