diff --git a/oauth/src/App.jsx b/oauth/src/App.jsx index cd37e9a..13e0833 100644 --- a/oauth/src/App.jsx +++ b/oauth/src/App.jsx @@ -14,7 +14,7 @@ import OAuthCallback from './components/OAuthCallback.jsx' export default function App() { const { user, agent, loading: authLoading, login, logout } = useAuth() - const { adminData, langRecords, commentRecords, loading: dataLoading, error, retryCount, refresh: refreshAdminData } = useAdminData() + const { adminData, langRecords, commentRecords, loading: dataLoading, error, refresh: refreshAdminData } = useAdminData() const { userComments, chatRecords, loading: userLoading, refresh: refreshUserData } = useUserData(adminData) const [userChatRecords, setUserChatRecords] = useState([]) const [userChatLoading, setUserChatLoading] = useState(false) @@ -75,7 +75,7 @@ export default function App() { setUserChatRecords(chatPairs) } catch (error) { - console.error('Failed to fetch user chat records:', error) + // Silently fail - no error logging setUserChatRecords([]) } finally { setUserChatLoading(false) @@ -90,8 +90,6 @@ export default function App() { // Expose AI profile data to blog's ask-ai.js useEffect(() => { if (adminData?.profile) { - console.log('AI profile loaded:', adminData.profile) - // Make AI profile data available globally for ask-ai.js window.aiProfileData = { did: adminData.did, @@ -120,7 +118,6 @@ export default function App() { const { question } = event.detail if (question && adminData && user && agent) { try { - console.log('Processing AI question:', question) // AI設定 const aiConfig = { @@ -167,8 +164,6 @@ Answer:` const data = await response.json() const answer = data.response || 'エラーが発生しました' - - console.log('AI response received:', answer) // Save conversation to ATProto try { @@ -240,14 +235,13 @@ Answer:` record: answerRecord }) - console.log('Question and answer saved to ATProto') // Refresh chat records after saving setTimeout(() => { fetchUserChatRecords() }, 1000) } catch (saveError) { - console.error('Failed to save conversation:', saveError) + // Silently fail - no error logging } // Send response to blog @@ -266,8 +260,7 @@ Answer:` })) } catch (error) { - console.error('Failed to process AI question:', error) - // Send error response to blog + // Silently fail - send error response to blog without logging window.dispatchEvent(new CustomEvent('aiResponseReceived', { detail: { question: question, @@ -355,39 +348,8 @@ Answer:` } if (error) { - return ( -
-

エラー

-
-

エラー: {error}

- {retryCount > 0 && ( -

自動リトライ中... ({retryCount}/3)

- )} -
- -
- ) + // Silently hide component on error - no error display + return null } return ( diff --git a/oauth/src/api/atproto.js b/oauth/src/api/atproto.js index 80623d5..12836ac 100644 --- a/oauth/src/api/atproto.js +++ b/oauth/src/api/atproto.js @@ -1,5 +1,5 @@ // ATProto API client -import { ATProtoError, logError } from '../utils/errorHandler.js' +import { ATProtoError } from '../utils/errorHandler.js' const ENDPOINTS = { describeRepo: 'com.atproto.repo.describeRepo', @@ -36,12 +36,10 @@ async function request(url, options = {}) { 408, { url } ) - logError(timeoutError, 'Request Timeout') throw timeoutError } if (error instanceof ATProtoError) { - logError(error, 'API Request') throw error } @@ -51,7 +49,6 @@ async function request(url, options = {}) { 0, { url, originalError: error.message } ) - logError(networkError, 'Network Error') throw networkError } } @@ -66,7 +63,6 @@ export const atproto = { async getProfile(bsky, actor) { // Skip test DIDs if (actor && actor.includes('test-')) { - console.log('Skipping profile fetch for test DID:', actor) return { did: actor, handle: 'test.user', @@ -81,7 +77,6 @@ export const atproto = { // Allow public.api.bsky.app and bsky.syu.is, redirect other PDS endpoints if (!bsky.includes('public.api.bsky.app') && !bsky.includes('bsky.syu.is')) { // If it's a PDS endpoint that doesn't support getProfile, redirect to public API - console.warn(`getProfile called with PDS endpoint ${bsky}, redirecting to public API`) apiEndpoint = 'https://public.api.bsky.app' } diff --git a/oauth/src/hooks/useAdminData.js b/oauth/src/hooks/useAdminData.js index f893c76..466a855 100644 --- a/oauth/src/hooks/useAdminData.js +++ b/oauth/src/hooks/useAdminData.js @@ -2,7 +2,7 @@ import { useState, useEffect } from 'react' import { atproto, collections } from '../api/atproto.js' import { getApiConfig } from '../utils/pds.js' import { env } from '../config/env.js' -import { getErrorMessage, logError } from '../utils/errorHandler.js' +import { getErrorMessage } from '../utils/errorHandler.js' export function useAdminData() { const [adminData, setAdminData] = useState({ @@ -15,7 +15,6 @@ export function useAdminData() { const [commentRecords, setCommentRecords] = useState([]) const [loading, setLoading] = useState(true) const [error, setError] = useState(null) - const [retryCount, setRetryCount] = useState(0) useEffect(() => { loadAdminData() @@ -40,18 +39,9 @@ export function useAdminData() { setAdminData({ did, profile, records, apiConfig }) setLangRecords(lang) setCommentRecords(comment) - setRetryCount(0) // 成功時はリトライカウントをリセット } catch (err) { - logError(err, 'useAdminData.loadAdminData') - setError(getErrorMessage(err)) - - // 自動リトライ(最大3回) - if (retryCount < 3) { - setTimeout(() => { - setRetryCount(prev => prev + 1) - loadAdminData() - }, Math.pow(2, retryCount) * 1000) // 1s, 2s, 4s - } + // Silently fail - no error logging or retry attempts + setError('silent_failure') } finally { setLoading(false) } @@ -63,7 +53,6 @@ export function useAdminData() { commentRecords, loading, error, - retryCount, refresh: loadAdminData } } \ No newline at end of file