mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 11:54:03 +00:00
feat(bot): add error logging to topic processor
Previously, the topic processor swallowed errors silently, making debugging impossible. This commit adds error logging to the topic processor catch block.
This commit is contained in:
@@ -157,7 +157,8 @@ const conversationalAssistant = createOpenAiChatAssistant(
|
||||
const topicProcessor = createTopicProcessor(
|
||||
runtime.openaiApiKey,
|
||||
runtime.topicProcessorModel,
|
||||
runtime.topicProcessorTimeoutMs
|
||||
runtime.topicProcessorTimeoutMs,
|
||||
getLogger('topic-processor')
|
||||
)
|
||||
const householdContextCache = new HouseholdContextCache()
|
||||
const anonymousFeedbackRepositoryClients = new Map<
|
||||
|
||||
@@ -245,7 +245,8 @@ function buildRecentMessagesSection(input: TopicProcessorInput): string | null {
|
||||
export function createTopicProcessor(
|
||||
apiKey: string | undefined,
|
||||
model: string,
|
||||
timeoutMs: number
|
||||
timeoutMs: number,
|
||||
logger?: { error: (obj: unknown, msg?: string) => void }
|
||||
): TopicProcessor | undefined {
|
||||
if (!apiKey) {
|
||||
return undefined
|
||||
@@ -506,7 +507,8 @@ If user dismisses ("не, забей", "cancel"), use dismiss_workflow.`
|
||||
default:
|
||||
return { route: 'silent', reason: 'unknown_route' }
|
||||
}
|
||||
} catch {
|
||||
} catch (error) {
|
||||
logger?.error({ event: 'topic_processor.failed', error }, 'Topic processor failed')
|
||||
return null
|
||||
} finally {
|
||||
clearTimeout(timeout)
|
||||
|
||||
Reference in New Issue
Block a user