refactor: P3 low priority improvements

P3-1: Magic numbers to named constants
- SMS_CONTENT_MAX_LENGTH = 500 (bank-sms-parser.ts)
- DEFAULT_HISTORY_LIMIT = 10 (deposit-agent.ts)
- LOG_RESULT_MAX_LENGTH = 200 (deposit-tool.ts)

P3-2: Debug command admin-only access
- Add DEPOSIT_ADMIN_ID check for /debug command
- Return "관리자만 사용 가능" for non-admins

P3-3: Stats query null handling
- Replace || with ?? for COUNT results
- Prevents 0 being overwritten incorrectly

P3-4: Memory save error logging
- Add logger.debug for saveMemorySilently failures
- Non-critical but helps debug memory issues

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kappa
2026-01-28 20:43:00 +09:00
parent 69e4dcc338
commit 79b8555893
5 changed files with 31 additions and 18 deletions

View File

@@ -413,7 +413,9 @@ export async function generateOpenAIResponse(
const saveableInfo = extractSaveableInfo(userMessage);
if (saveableInfo) {
// 비동기로 저장, 응답 지연 없음
saveMemorySilently(db, telegramUserId, saveableInfo).catch(() => {});
saveMemorySilently(db, telegramUserId, saveableInfo).catch(err => {
logger.debug('Memory save failed (non-critical)', { error: (err as Error).message });
});
}
return finalResponse;